← All docs
Connect a server
Most MCP clients use a JSON configuration file to know which servers to load. Here's how to set it up.
Claude Desktop
- Open Claude Desktop → Settings → Developer → Edit Config. This opens
claude_desktop_config.json. - Add your server:
{ "mcpServers": { "my-server": { "command": "npx", "args": ["-y", "@example/mcp-server"], "env": { "API_KEY": "your-key-here" } } } } - Save and restart Claude Desktop. Look for the 🔌 icon — your server's tools are now available.
Cursor
- Open Cursor → Settings → MCP → Add new MCP server.
- Enter the command and arguments (same format as above).
- Cursor will start the server automatically.
Tips
- API keys: never commit them to git. Use environment variables.
- Local vs remote: some servers run on your machine (
command), others connect to a URL (urlinstead ofcommand). - Troubleshooting: check the client's logs. Most connection issues are wrong paths or missing env vars.