How to configure MCP in claude_desktop_config.json
Quick answer
To configure
MCP in claude_desktop_config.json, add an mcp section specifying the server type (e.g., stdio), and any relevant parameters like command or port. This enables the Claude desktop client to communicate with MCP servers for AI agent integrations.PREREQUISITES
Python 3.8+Claude Desktop installedBasic knowledge of JSON configuration files
Setup
Ensure you have the Claude Desktop app installed and access to the claude_desktop_config.json file, typically located in your user configuration directory. No additional packages are required for MCP configuration itself.
Step by step
Edit your claude_desktop_config.json to include an mcp section. Specify the server type and parameters. For example, to configure an MCP server using stdio transport with a command to launch your MCP agent:
{
"mcp": {
"server": "stdio",
"command": "python",
"args": ["-m", "mcp.server.stdio", "--port", "0"]
}
} Common variations
You can configure MCP with different transports such as stdio or sse. For example, to connect to an MCP server running on a local port via SSE:
{
"mcp": {
"server": "sse",
"url": "http://localhost:8080/mcp"
}
} Troubleshooting
- If the MCP server does not start, verify the
commandandargsare correct and executable. - Check that the port specified is free and accessible if using network transports.
- Review Claude Desktop logs for MCP connection errors to diagnose issues.
Key Takeaways
- Add an
mcpsection inclaude_desktop_config.jsonto enable MCP integration. - Specify the
servertype and required parameters likecommandorurldepending on transport. - Use
stdiofor local subprocess MCP servers orssefor networked MCP servers. - Verify commands and ports to avoid connection failures.
- Check logs for troubleshooting MCP connection issues.