MCP in Cursor: mcp.json, OAuth and keys
The short version: Cursor reads MCP servers from ~/.cursor/mcp.json (all projects) and .cursor/mcp.json (one project). A remote server needs nothing but a url field, and Cursor will offer to sign in over OAuth. If a browser sign-in is awkward, a key goes into headers through an environment variable.
Two files, two scopes
| File | Where it applies | What belongs there |
|---|---|---|
~/.cursor/mcp.json | Every project | Search and documentation — whatever you always want |
.cursor/mcp.json | This repository only | Project-specific tools; the file can be committed for the team — but without keys |
You can open the list of servers in Cursor's settings, in the MCP section: it shows which servers are connected, how many tools each has, and a toggle to switch a server off for a while. If you are still getting to know the protocol, start with the overview of MCP servers.
Path 1. A URL and OAuth sign-in
The shortest route is to write down the addresses only. Tick the tools below and a ready mcp.json assembles itself.
No keys: paste the URL into your client and sign in — Claude, Cursor and any other OAuth client.
Settings → MCP in Cursor
Add the config to ~/.cursor/mcp.json
Save and sign in via OAuth
Build your server
Check the tools — URLs and config update themselves.
Connector URLs
Image Generation (Nano Banana)
https://twelver.ru/api/mcp/v1/image-generationWeb Search
https://twelver.ru/api/mcp/v1/web-search{
"mcpServers": {
"twelver-image-generation": {
"url": "https://twelver.ru/api/mcp/v1/image-generation"
},
"twelver-web-search": {
"url": "https://twelver.ru/api/mcp/v1/web-search"
}
}
}The same mcp.json works in LM Studio, Windsurf, Cline, VS Code and any client that reads an mcp.json.
Save the file and a sign-in button appears next to the server in settings. Click it, sign in to your Twelver account in the browser, and the server goes active. OAuth needs a registered account.
Path 2. A key in a header
On shared machines, in containers, and whenever the browser sign-in will not go through, a key is easier. Get one with the button below, no registration:
A key for Cursor
Get an sk-… key right here on the page
Pick any model series — the model in Cursor stays its own; the MCP server only needs the key. It is substituted into the line below.
Press it and get your base_url and API key.
No sign-up, no card.
Free. Your key appears right here.
~/.zshrc or ~/.bashrcThe highlighted parts are stand-ins. The button above issues them in seconds, no sign-up.export TWELVER_API_KEY="sk-<your-key>"Then refer to the variable from mcp.json — Cursor expands it at launch, and the key never reaches the repository:
{
"mcpServers": {
"twelver-web-search": {
"url": "https://twelver.app/api/mcp/v1/web-search",
"headers": {
"Authorization": "Bearer ${env:TWELVER_API_KEY}"
}
},
"twelver-image": {
"url": "https://twelver.app/api/mcp/v1/image-generation",
"headers": {
"Authorization": "Bearer ${env:TWELVER_API_KEY}"
}
}
}
}Cursor on macOS, launched from the Dock, may not see variables from ~/.zshrc. If the server answers 401, start Cursor from the terminal with cursor . so it inherits the shell environment.
Call approval
By default Cursor asks for permission before every MCP tool call and shows you the parameters. That is sensible for tools that change something or spend your balance. For search and page reading you can drop the prompt by adding the tool to the auto-run allowlist — the agent then works without pauses.
What to ask the agent for
- "Read the current docs on migrating to the new version of the library and draft a plan of edits" —
web-searchandweb-crawlinstead of an answer from the model's stale memory. - "Generate three hero images for the landing page at 16:9 and put the first one into the markup" —
text-to-imagereturns links to the files. More on generation in image and video generation over MCP.
If it does not work
| Symptom | Cause | What to do |
|---|---|---|
| The server shows an error indicator | Broken JSON, or a wrong address | Check the file is valid and that the url was copied in full |
| 401 with a key | Cursor cannot see the environment variable | Launch Cursor from the terminal, or check the variable is actually set |
| There is no sign-in button | The config carries a key in headers — the server accepted it, no sign-in needed | That is normal; remove headers if you would rather sign in through the browser |
| The agent does not use the tools | The server is switched off, or the request does not need a tool | Check the toggle and ask explicitly: "search the web for…" |
Wiring the same thing up in other clients? Instructions for Claude and LM Studio. The server builder page for Cursor is Twelver MCP servers for Cursor.
Frequently asked questions
How do I connect MCP to Cursor?
~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project). A remote server needs a url; sign-in is either OAuth via the button in settings, or a key in headers. Save the file and the server appears in the MCP section of Cursor's settings.Where is mcp.json in Cursor?
~/.cursor/mcp.json. The project one is at the root of the repository: .cursor/mcp.json. If the file does not exist, create it by hand.How do I pass a key to an MCP server in Cursor without writing it into the file?
"Authorization": "Bearer ${env:VARIABLE_NAME}" in the headers field. Cursor substitutes the value at launch.Can I turn off MCP call approval in Cursor?
Which MCP servers should I connect in Cursor?
Try it yourself
Everything in this guide runs inside Twelver
One chat for text, images, video, music and voice — no separate services or subscriptions.
Open Twelver chat