Cursor MCP server setup: mcp.json location and examples
Add MCP servers to Cursor in ~/.cursor/mcp.json for all projects, or .cursor/mcp.json for one project. Both use a mcpServers JSON object. This guide covers local commands, remote URLs, environment variables and the enable toggle in Cursor.
| What | macOS | Windows |
|---|---|---|
| Global config | ~/.cursor/mcp.json | %USERPROFILE%\.cursor\mcp.json |
| Project config | .cursor/mcp.json in the project root | |
| Format and key | Plain JSON, servers under mcpServers | |
Global or project? A server in ~/.cursor/mcp.json is available everywhere; one in a project’s .cursor/mcp.json belongs to that project. Cursor’s documentation does not say which one wins when both define the same name, so give a server the same name in both places only if you can tell which one you are testing.
How to add an MCP server in Cursor
Create the global or project file shown above, then add a server definition. Open Customize in Cursor to check its status and enable it. Use the command or URL supplied by the server’s maintainer; only run local servers you trust.
Local server: mcp.json example
A local (stdio) server has a command, optional args and optional env. A remote server has a url and optional headers.
{
"mcpServers": {
"my-server": {
"type": "stdio",
"command": "python",
"args": ["mcp-server.py"],
"env": { "API_KEY": "value" }
}
}
}
Remote server: URL example
{
"mcpServers": {
"my-remote": {
"url": "https://example.com/mcp"
}
}
}
These are templates: replace mcp-server.py or the example URL with your server’s actual path or endpoint. Keep existing servers in the same mcpServers object.
envFileloads environment variables from a file. It is for local servers only; remote servers do not support it.authis for remote servers and takesCLIENT_ID,CLIENT_SECRETandscopes.
Variables you can use
Cursor expands these in command, args, env, url and headers, which keeps secrets and machine-specific paths out of a file you commit:
${env:NAME}reads an environment variable${userHome}is your home folder${workspaceFolder}is the project root and${workspaceFolderBasename}its name${pathSeparator}(or${/}) is the separator for the operating system
The on/off toggle is not in the file
Cursor lets you switch a server off without removing it, from Customize in the sidebar. That state is stored inside Cursor, not in mcp.json. The file can look completely correct while the server is switched off in the interface, and editing the file cannot turn it back on. If a server is in the file and not running, check the toggle first.
Smaller things that cost time
~/.cursoroutlives Cursor. The folder stays after you uninstall the app, so finding it on a machine is not evidence that Cursor is installed.- Tool limits. Older write-ups describe a cap of 40 tools. Cursor’s current MCP documentation does not mention a tool-count limit.
- Absolute paths. An editor launched from the Dock or Start menu may not see the
PATHof your terminal. Ifnpxoruvxis not found, put the full path incommand; see why your MCP server is not showing up.