Cursor MCP: Give Cursor Real Codebase Context

repowise teamUpdated 8 min read
Compared in this post: repowise and
  • Cursor
  • Context7
On this page

To give Cursor real codebase context, register an MCP server in .cursor/mcp.json that answers questions about your repo from an index, not from text search. For repowise that is two commands: repowise init to index the repository, then repowise agents add --target=cursor --yes to write the Cursor config. Cursor then calls the tools whenever a question is about ownership, dependents, risk or history, and answers from the result.

Part of the series on giving AI coding agents real codebase context.

Cursor search versus MCP: what each one knows

Cursor's own search finds code by what it says; an MCP server tells the model what is true about the repo around that code. As of October 2026, Cursor's agent searches with Instant Grep, a local exact-match index that handles full regex and word boundaries and does not upload your code. That is the right tool for "where is PaymentService imported?"

Some questions are not answered by any file's text. Who owns this module, what has to change with it, which files break if it moves, and whether anything still calls it all live in the graph and the git history. MCP is Cursor's way to reach that: it connects the editor to external tools and data sources over stdio, SSE or HTTP.

QuestionCursor search aloneWith a repo-intelligence MCP server
Where is this string or symbol used?Exact matches in secondsSame, plus callers resolved through the graph
What breaks if I change this module?Inferred from imports it happens to readDependents, co-change partners and tests, from the graph
Who owns this file, and why is it shaped this way?Not in the textOwnership, past fixes and decision records
Is this file dead or just quiet?A guess from grepReachability from entry points, scored by confidence
What does this library call return today?Training dataA docs server such as Context7

Scroll the table sideways to see every column.

How to add an MCP server to Cursor

Cursor reads MCP servers from .cursor/mcp.json in the project, or ~/.cursor/mcp.json for every workspace. Both support ${env:NAME}, ${workspaceFolder} and ${userHome} interpolation (Cursor MCP docs). Use stdio for a server that reads your code: Cursor starts it as a local process, so nothing is exposed on a port.

For repowise, let the CLI write it:

bash
pip install repowise
cd your-repo
repowise init                              # builds the index
repowise agents add --target=cursor --yes  # .cursor/mcp.json, rules file, distill hook

The command registers the server with the absolute repo path, which matters because Cursor launches MCP processes from a directory that is not the workspace root. To see the entry before anything is written, or to paste it yourself:

bash
repowise agents print-config cursor

Restart Cursor, open the MCP settings, and check that the server is listed with its tools enabled. Cursor needs a type field on stdio entries, which the generated config includes. See the integration matrix for what each editor receives.

What the repowise server gives Cursor

repowise serves ten tools from one index: the dependency graph, git history, generated docs, decision records, code health and dead-code analysis. None of them edits your code. The ones Cursor reaches for most:

ToolCursor asks it
get_answerHow does X work? Where is Y? Why is Z like this? One cited answer.
get_contextWhat is in this file or symbol: docs, callers, owners, history, decisions.
get_symbolThe verified body of one function or class.
search_codebaseWhich file or symbol matches this name or topic.
get_riskIs this file risky to touch, and what has broken here before.
get_change_riskWhat did this pending diff make worse.
get_whyWhy was it built this way, and is a decision governing it.
get_health and get_dead_codeWhat to fix first, and what can be deleted.
get_overviewThe shape of an unfamiliar repo.

Scroll the table sideways to see every column.

Responses carry a _meta block that says which commit the answer describes and whether the index is behind HEAD, so an agent knows when to trust a result. Per-tool arguments are in the MCP tools reference. You can see the same data on a public repo: the FastAPI dependency graph, its generated docs and its hotspot analysis.

If your context budget is tight, a comma-separated list of tool names on repowise mcp --tools narrows the set for a small context window, for example repowise mcp --tools get_answer,get_context,get_risk.

A second server for library docs: Context7

Repo facts and library facts come from different places, so use a different server for each. Context7, by Upstash, pulls current version-specific documentation into the model's context. Its MCP tools are resolve-library-id and query-docs, and npx ctx7 setup installs it for Cursor after an OAuth sign-in (as of October 2026).

Ask repowise which file in your monorepo owns a route handler. Ask Context7 how that route's framework changed in its latest release. Mixing the two in one server blurs which answer is about your code. If you want the docs source to be your own, see Context7 alternatives for your own docs.

Verify it: a three-question smoke test

Cursor can have a server installed and still never call it. Run these three prompts in agent mode on a real branch, and open the tool-call trace for each. The common reasons an MCP server is not being called are worth a read if any fail.

  1. "Which file owns <a symbol you know>, and who last changed it?" Expect a get_context or get_answer call and a file path with owners, not a "probably in X".
  2. "What breaks if I change <a module>?" Expect named dependents and co-change partners, and the tests worth running (get_risk with changed_files).
  3. "Is <a quiet file> dead or just stable?" Expect a get_dead_code or get_context call, with the evidence that nothing reaches it.

If the answer arrives with no tool call, the model chose to guess. Tell it in your Cursor rules which questions belong to the server; the config repowise agents add writes already includes a managed rules file for this.

Keeping the index current

An index that lags the code gives confident wrong answers, so refresh it when the code moves. repowise update re-indexes what changed since the last run, and repowise update --working-tree covers uncommitted edits. Tool responses flag a stale file in _meta.stale_warning, so the agent can tell you when to refresh instead of trusting old detail.

Where to go next

FAQ

What is Cursor MCP?
Cursor MCP is Cursor's support for the Model Context Protocol, which connects the editor and its CLI to external tools and data sources. Servers run over stdio, SSE or HTTP and are configured in mcp.json. The agent calls their tools the way it calls its built-in ones.
Where does Cursor store MCP configuration?
In .cursor/mcp.json inside a project, or ~/.cursor/mcp.json for all workspaces. A project entry is better for repo-specific servers, because one global entry can only point at one repository.
Is Cursor codebase context the same as MCP?
No. Cursor's search finds code by its text. MCP lets the model call a server for facts that are not in the text, such as dependents, ownership, change history and dead code. They work together: search for exact matches, MCP for repository facts.
Do I need Context7 as well as a repo-intelligence server?
Often yes, because they answer different questions. A repo server knows your code and its history. Context7 knows current library documentation. Run both and let Cursor choose the tool that fits the question.
Is it safe to run an MCP server locally in Cursor?
A stdio server runs as a local process under Cursor, so your code does not leave the machine through the server. Cursor advises reviewing a server's source, using restricted keys and keeping secrets in environment variables. repowise is open source under AGPL-3.0 and its structural index needs no LLM key.
Does the repowise MCP server work in Cursor and other editors?
Yes. repowise agents add --target=cursor configures Cursor, and the same server works with Claude Code, Codex, VS Code, OpenCode, Hermes, GitHub Copilot CLI and Kiro. For any other MCP client, repowise agents print-config claude-code prints a standard entry to paste.