Cursor MCP setup: mcp.json, remote servers and sign-in
Set up an MCP server in Cursor: project or global mcp.json, the url form for a remote server and command for a local one, variables and env files, OAuth sign-in, and where to turn a server on.
Cursor reads MCP servers from a JSON file. Put it in .cursor/mcp.json in a repo for that project only, or in ~/.cursor/mcp.json for every project you open. A remote server needs one field, its url. A local server needs the command that starts it. Cursor signs you in to a remote server that asks for it, and you switch servers on and off from Customize in the sidebar.
Everything below is from Cursor's MCP documentation, with a remote Search Console server as the worked example.
TL;DR:
- Where:
.cursor/mcp.jsonin the project, or~/.cursor/mcp.jsonin your home directory for every project. - Remote server:
{"url": "https://..."}, plusheadersif it takes a key. - Local server:
command,argsandenv. Only local servers can read anenvFile. - Secrets: write
${env:NAME}in the file instead of the value. - Sign-in: Cursor runs OAuth for servers that need it. Tools ask for approval before they run, unless your run mode allowlists them.
Where does Cursor's mcp.json go?
Two places, and they do different jobs. The docs:
- Project: "Create
.cursor/mcp.jsonin your project for project-specific tools." - Global: "Create
~/.cursor/mcp.jsonin your home directory for tools in every project you open in the editor or CLI."
A project file can be committed, so everyone who opens the repo gets the same servers. Keep it free of secrets (see below). A global file is yours alone and is the place for a server you use on every repo.
One exception to know before you rely on the global file: Cursor's cloud agents do not read ~/.cursor/mcp.json. They use the servers configured for them on cursor.com.
How do you add a remote MCP server?
Give it a name under mcpServers and its URL. Nothing else is required:
{
"mcpServers": {
"queryscope": { "url": "https://mcp.queryscope.dev/mcp" }
}
}
That is the hosted Search Console server this site runs. Cursor names three transports, stdio, SSE and Streamable HTTP, and a url entry covers the two remote ones. A server that takes a key rather than a sign-in gets a headers object next to the URL:
{
"mcpServers": {
"my-api": {
"url": "https://api.example.com/mcp",
"headers": { "Authorization": "Bearer ${env:MY_API_TOKEN}" }
}
}
}
How do you add a local (stdio) server?
Replace the URL with the command Cursor should start, its arguments, and any environment it needs:
{
"mcpServers": {
"local-tools": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mcp-server"],
"env": { "API_KEY": "${env:LOCAL_TOOLS_KEY}" }
}
}
}
Cursor runs that process on your machine and talks to it over standard input and output. A local server is the right choice when it has to read files on disk or reach something only your machine can. For a server that only calls an online service, the remote form is less to maintain: nothing to install, nothing to keep up to date.
Try it
Point an SEO agent at your own site, not just an essay about one.
QueryScope holds the plan for your site, reads your real Search Console, and hands the coding agent you already have one change at a time to rank for the searches you decided to win. From $49/month, everything included.
How do you keep keys out of mcp.json?
Use Cursor's variables. The docs say "Cursor resolves variables in these fields: command, args, env, url, and headers." The ones worth knowing:
${env:NAME}reads an environment variable, so the file holds the name of the secret and never the secret.${workspaceFolder}is the project root, "the folder that contains.cursor/mcp.json", which is how a project server points at a script inside the repo (example below).${userHome}is your home directory.
"args": ["${workspaceFolder}/tools/mcp_server.py"]
A local server can also load a whole file of variables with "envFile": ".env". That option is local only: "Remote servers (HTTP/SSE) do not support envFile." For a remote server, put the variable in headers instead.
How does sign-in work?
Cursor handles it. The docs: "Cursor supports OAuth for servers that require it. Sign-in uses the authorization code flow with PKCE." A server that supports dynamic registration needs no client ID from you: "Cursor registers as a public client with no client secret." When the access token runs out, Cursor "renews an expired access token with the refresh token the server issued", and asks you to sign in again only if the server gave it none.
For the Search Console server, that sign-in is Google's consent screen on the first call. You approve read-only access (webmasters.readonly) and pick the site the connection defaults to, and you can revoke it from your Google account later.
How do you turn a server on, and approve its tools?
From the sidebar. The docs: "Enable or disable MCP servers from Customize in the sidebar." Each server there has a toggle.
Tools ask before they run: "Cursor asks for approval before using MCP tools by default. Click the arrow next to the tool name to see arguments." Reading those arguments is worth the second it takes, at least the first few times a new server is used. If you want a trusted tool to run without asking, MCP "follows the same Run Modes as terminal commands", so an allowlisted tool runs straight away in a mode that allows it.
The server will not connect
Open the Output panel (Cmd+Shift+U in the docs) and pick "MCP Logs". The usual causes are plain ones:
- Invalid JSON. JSON allows no trailing comma and no comments, and either one makes the whole file invalid.
- A server in the wrong file. A server in
.cursor/mcp.jsonbelongs to that project, so it is only there when that project is open. - A variable that is not set in the environment Cursor runs in, so
${env:NAME}resolves to nothing. - The toggle is off in Customize.
A server that connects and is still never called is a different problem: the agent sees the tool and decides not to use it. A project rule that says when to use it fixes that. Cursor SEO has the rule we use for search data.
Setting up Search Console in Cursor
The remote example above is the whole setup for QueryScope: one entry with the URL, Google's read-only sign-in on the first call, and then you ask the agent about a search from the site's repo. It reads your own Search Console, holds the plan for the searches you chose, and hands back one change at a time. The Search Console MCP server page says what it covers and what it keeps past Search Console's 16 months. The same URL works in Claude Code, where adding an MCP server is one command.
Sources
- Cursor Docs, Model Context Protocol (MCP), read 2026-11-29 (
.cursor/mcp.jsonand~/.cursor/mcp.json; cloud agents not reading the global file; stdio, SSE and Streamable HTTP; theurl,headers,command,args,envandenvFilefields; the variables and the fields they resolve in;envFilenot supported for remote servers; OAuth with PKCE, dynamic registration and token refresh; Customize toggles; tool approval and Run Modes; MCP Logs in the Output panel).
Try it
Put an SEO agent in your editor.
Ask your coding agent what to work on. QueryScope reads your real Search Console, holds the searches you decided to win, and hands back one move at a time with the proof it worked. From $49/month, everything included. 1, 3 or 10 sites.