What Is an MCP Config? A Complete Structure Guide
An MCP config is a JSON file that tells an AI client which Model Context Protocol (MCP) servers to start and how to reach them. Every config wraps server definitions in a top-level mcpServers object, except Zed, which uses an mcp object.
The mcpServers wrapper
The outer object is usually mcpServers. Inside it, each key is a server name you choose, and the value is a server object. Server names must be unique within the file.
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"]
},
"weather": {
"url": "https://weather.example.com/mcp",
"transport": "http"
}
}
}Server object fields
A server object contains the connection details. Either command or url is required; everything else depends on the transport and client.
- command
- The executable to launch for stdio servers, such as
npxorpython3. - args
- An array of arguments passed to
command. Include-yfor npx so it does not wait for confirmation. - env
- An object of environment variable key-value pairs, both strings. Used for tokens and settings.
- url
- The remote endpoint for Streamable HTTP or SSE servers. Must include
http://orhttps://. - transport
- Required for remote servers:
httpfor Streamable HTTP orssefor legacy SSE. - enabled / disabled
- Optional booleans used by some clients, such as Cline, to turn a server on or off without deleting it.
- autoApprove
- A Cline-specific array of operation names that can run without asking for permission each time.
- headers
- Optional object of HTTP headers sent with remote transport requests, typically for authentication.
The env object
The env object holds environment variables as string key-value pairs. Values are stored in plaintext, so keep the config file out of git and screenshots. If a server needs a token, put it here, not in args.
"env": {
"GITHUB_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxx",
"OPENWEATHER_API_KEY": "your-key-here"
}Transports in a config
stdio servers use command and args; remote servers use url and transport. See the full transport comparison for details.
Valid vs invalid example
A single trailing comma after the last array item makes the whole file invalid JSON. The fixed version removes it.
Invalid
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github",
]
}
}
}Fixed
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github"
]
}
}
}Client-specific wrappers
Most clients read mcpServers. Zed is the main exception: it reads an mcp object inside its settings.json. VS Code stores per-workspace servers in .vscode/mcp.json and can also put user-level servers in settings.json under mcp.servers.
Frequently asked questions
What does mcpServers mean?
mcpServers is the top-level object that wraps all MCP server definitions in most clients. Each key inside it is a unique server name, and each value is a server configuration object.
Is an MCP config valid JSON?
Yes. The file must be valid JSON: double quotes, no trailing commas, and escaped backslashes. Some clients like Zed allow JSONC, which permits comments, but the generated config from this tool is plain JSON.
Where do I put API tokens?
API tokens and other secrets go inside the env object as string values. Because they are stored in plaintext, keep the config file out of public git repos and screenshots.
Why does my config work in Zed but not Claude Desktop?
Zed expects an "mcp" object, while Claude Desktop expects "mcpServers". Using the wrong wrapper object is a common mistake when copying a config between clients.
Try the MCP Config Generator to produce a valid config, or compare stdio, SSE, and Streamable HTTP.