What is an MCP Configuration File?

2 min read Updated

An MCP configuration file (.mcp.json or mcp.json) is the JSON file an AI client such as Claude Code or Cursor reads to determine which MCP servers to launch or connect to. Each entry declares either a local command with arguments and environment variables, or a remote server URL.

WHY IT MATTERS

The format is broadly shared across clients: an mcpServers object keyed by server name. A local server entry specifies command, args, and env for a stdio process; a remote server entry specifies a url (and typically a transport type and optional headers). Locations vary by client: Claude Code reads a project-scoped .mcp.json at the repository root plus user- and local-scoped config, Cursor uses .cursor/mcp.json, VS Code uses .vscode/mcp.json, and Claude Desktop uses claude_desktop_config.json.

Checked-in project configs are deliberately shareable — add a server to .mcp.json, commit it, and every teammate's client offers it. That makes the file a genuine governance surface:

  • Review — a new server entering the fleet shows up as a PR diff, which is the cheapest moment to ask what it is, who published it, and what its tools can do.
  • Inventory — config sprawl across repositories, user scopes, and multiple clients is how tool sprawl and shadow MCP take hold; nobody holds the full list.
  • Secretsenv blocks invite credentials into version control; clients support environment-variable expansion precisely so raw keys need not be committed.

Clients add their own safeguards — Claude Code, for example, prompts before using project-scoped servers from a freshly cloned repo — but the config file itself grants whatever the named server exposes.

See mcp configuration file working in your own stack — route your MCP servers through PolicyLayer and every tool call is checked against policy before it runs.

GOVERN YOUR MCP SERVERS →

Enforced before the call runs. Nothing to install.

HOW POLICYLAYER USES THIS

PolicyLayer treats configuration as the fleet's entry point: pointing config entries at the PolicyLayer gateway means every declared server is registered, policy-evaluated, and audited centrally rather than wired directly to each client. The CLI scanner (npx policylayer) reads local MCP configs, discovers the declared servers, and classifies their tools against the catalogue at policylayer.com/tools.

FREQUENTLY ASKED QUESTIONS

Where does each client look for MCP configuration?
Claude Code reads .mcp.json at the project root plus user and local scopes; Cursor reads .cursor/mcp.json; VS Code reads .vscode/mcp.json; Claude Desktop reads claude_desktop_config.json. All share the mcpServers structure.
Should .mcp.json be committed to version control?
Project-scoped configs are designed to be committed so the team shares the same servers — which also makes them reviewable in pull requests. Keep secrets out of env blocks by using environment-variable expansion instead of literal values.
What is the difference between a local and a remote server entry?
A local entry gives a command, args, and env to spawn a stdio server process; a remote entry gives a URL (usually with a transport type) for an HTTP-based server the client connects to over the network.

FURTHER READING

Let agents act without letting them run wild.

Route your MCP servers through PolicyLayer and every tool call is checked against your policy before it runs — allow, deny, or require approval. Per-identity grants. Full audit log. Live in minutes.

Free to start. No card required.

43,000+ MCP servers and 220,000+ tools scanned and risk-classified.

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.