Skip to content

Docs

How Do I Connect Cursor to an MCP Server?

Cursor supports MCP (Model Context Protocol) natively. That lets the agent in your editor reach tools and context that are not in the repo: your notes, decisions, and runbooks included.

Quick answer

Cursor connects to an MCP server through a JSON config file. Add the server under mcpServers in ~/.cursor/mcp.json (available in every project) or .cursor/mcp.json inside a repo (that project only). A remote server needs only its url (for Hjarni, https://hjarni.com/mcp). Restart Cursor, complete the OAuth sign-in it opens in your browser, and the server's tools appear in the agent.

What Cursor can do with an MCP server

Yes, Cursor supports MCP: remote servers over HTTP with OAuth, and local servers it launches itself. Once connected, the agent can use whatever tools that server offers. Connected to a knowledge base like Hjarni, Cursor can:

Search
Find relevant notes by keyword or topic before it writes code
Read
Pull in the full content of an architecture note, ADR, or runbook
Create
Save a new note straight from the editor after a session
Organize
Tag notes, move them between folders, add links
Follow instructions
Read your custom AI instructions and apply them to every response

The specific capabilities depend on the MCP server. Each server exposes its own set of tools.

In practice that looks like: ask Cursor why the auth layer uses custom middleware and it reads the ADR instead of guessing; hit the same Sidekiq retry bug six months later and it walks your old runbook; finish a tricky refactor and have it write the lesson down for next time.

What you need

  • Cursor on a paid plan. MCP is listed under Pro and above (Pro, Pro+, Ultra, and the Teams tiers), not the free Hobby plan. There is no extra flag to enable beyond that.
  • The MCP server you want to connect. Either a remote URL like https://hjarni.com/mcp, or a local command Cursor can launch.

The config file: two scopes

Cursor reads MCP servers from mcp.json, and the same format works in two places:

  • ~/.cursor/mcp.json is global. The server is available in every project you open. Right for a knowledge base, since your notes are not repo-specific.
  • .cursor/mcp.json inside a repo is project-scoped. The server only exists in that project. Right for project-specific tooling, and the file can be committed so teammates get it too.

Both take a single mcpServers object with one entry per server.

Remote servers (OAuth)

A remote MCP server that supports OAuth needs only its URL: no API key, no token in the file.

{
  "mcpServers": {
    "hjarni": {
      "url": "https://hjarni.com/mcp"
    }
  }
}

Save the file and restart Cursor. On first use, Cursor opens the server's OAuth page in your browser. Sign in and authorize, once. The connection persists across sessions after that.

If a server only offers bearer-token auth, you can pass the token in a headers block, but prefer OAuth whenever the server supports it, so no credential lives in a file. The Cursor bearer token fix covers that setup and the 401s that come with it.

Local servers

For a local MCP server, Cursor launches the process itself. Give it a command instead of a URL:

{
  "mcpServers": {
    "your-server": {
      "command": "npx",
      "args": ["-y", "your-mcp-server"]
    }
  }
}

Remote and local entries can live side by side in the same mcpServers object.

Verifying the connection

Open Cursor Settings > MCP: the server should be listed with its tools. Then open the agent and ask it to use one. For example, if you connected Hjarni:

"Search Hjarni for our deploy runbook."

Cursor should call the server's search tool and answer from your notes. If you see the tool call in the response, the connection is working.

Troubleshooting

The server does not appear after editing mcp.json

Restart Cursor: config changes are read at startup. If it still does not appear, check the JSON for typos by pasting it into the MCP Config Validator, and make sure you edited the scope you think you did (a project-scoped .cursor/mcp.json only applies inside that repo).

The OAuth window never opened, or sign-in did not finish

Trigger it again from Cursor Settings > MCP, and check your browser did not block the popup. The connection is only live after the flow completes.

The server returns 401

For an OAuth server, redo the sign-in. For a bearer-token server, Cursor is probably not sending the header. See the bearer token fix.

Tools are listed but the agent will not use them

Ask explicitly ("search Hjarni for…") the first time, and approve the tool call when Cursor asks. Once it has seen the tools work, it reaches for them on its own.

Try it with Hjarni

Hjarni is a knowledge base with a built-in MCP server. Connect it to Cursor and your agent can read the context that is not in the repo (architecture decisions, runbooks, conventions) and write new notes back. Stop re-explaining your codebase.

The MCP server URL is https://hjarni.com/mcp. Add the entry above to ~/.cursor/mcp.json, restart, sign in. Two minutes. For the full setup with use cases, see Hjarni for Cursor.

Connect your notes

Common questions

FAQ

Does Cursor support MCP servers?

Yes. Cursor connects to both remote and local MCP servers through a JSON config file: ~/.cursor/mcp.json for every project, or .cursor/mcp.json inside a repo for that project only. A remote server with OAuth, like Hjarni, needs only its URL.

Do I need a paid Cursor plan to use MCP?

Yes. Cursor lists MCP support under its paid plans (Pro and above, including the Teams tiers), not the free Hobby plan. Hjarni itself works on its free plan.

Where does Cursor's MCP config file live?

Two places, same format. ~/.cursor/mcp.json in your home directory applies to every project you open. .cursor/mcp.json inside a repo applies to that project only. Both take the same mcpServers object.

Why doesn't my MCP server show up in Cursor?

The usual causes, in order: Cursor was not restarted after the config change, the JSON has a typo (paste it into the MCP Config Validator to check), the OAuth sign-in never finished, or the entry lives in a project-scoped .cursor/mcp.json of a different repo.

Do I need an API key or bearer token to connect Cursor to an MCP server?

Not when the server supports OAuth. Put only the url in mcp.json and Cursor runs the sign-in in your browser on first use. Bearer tokens are the fallback for servers without OAuth; see the Cursor bearer token fix if you hit a 401.

Can Cursor write back to an MCP server?

Yes, when the server exposes write tools. Connected to Hjarni, Cursor's agent can save a runbook after a debugging session or update a decision log, and it asks for your approval before running a tool unless you have allowed it.

Give your AI notes it can actually read. Free.

Hjarni is a knowledge base with a built-in MCP server. Create a free account and your endpoint is ready in about a minute.

Get started free

Give your AI notes it can actually read. Free.

Start here

Write once. You both remember.

Free to start. No credit card required.

Works with Claude and ChatGPT today.