Add Documentation Search to Cursor with MCP: A Step-by-Step Tutorial
To add documentation search to Cursor, you register an MCP server in a `.cursor/mcp.json` file, give it an API key in a header, and let Cursor's agent call its search tools while it codes. Ten lines of JSON are enough. This tutorial walks through the exact configuration for a hosted knowledge base, the prompts that work well from the editor, and a troubleshooting table for when the server stays silent.
Why connect documentation to Cursor through MCP?
Cursor's agent is good at reading the code in your repository. It is much weaker on everything that lives outside it: your internal API conventions, the vendor SDK that shipped a breaking change last month, the compliance rules your team must follow when handling customer data. When that knowledge is missing, the agent guesses, and a confident guess in generated code is expensive to catch in review.
The Model Context Protocol (MCP) is an open standard that lets an AI client such as Cursor call external tools. A documentation server exposes a search tool; the agent decides when to call it, receives passages, and builds its answer or its code change from them. The benefits are concrete:
- Answers grounded in a source you chose, not in whatever the model remembers from training.
- Citations you can check: each answer comes with numbered passages, so you see which document a claim comes from.
- No copy and paste: you stop pasting long doc pages into the chat, which also keeps your context window for the code.
- One setup, many clients: the same server works in Claude, ChatGPT and other MCP clients, so the team shares one source of truth.
If you want the broader picture of how assistants use knowledge bases over MCP, see connecting a knowledge base to AI agents with MCP. Here we stay focused on Cursor.
What you need before you start
- A recent version of Cursor with MCP support (any current release).
- A knowledge base to search. Either a public base from the Kopik catalog, or your own documentation uploaded as a private base (PDF, Word, text or Markdown files; creating a base is free).
- A Kopik API key, created from your dashboard. It starts with `kpk_`. Only the free `list_bases` tool works without a key.
- Write access to the project folder, since the configuration file lives at its root.
Your own docs are the best first test
Upload your internal API guide or engineering handbook as a private base. Questions to your own bases are free (reasonable use, about 200 a day), so you can experiment without watching a meter. Our guide to a private knowledge base as your own RAG for AI agents covers that setup in more depth.
Step 1: configure the MCP server in .cursor/mcp.json
Create a folder named `.cursor` at the root of your project, and inside it a file named `mcp.json`. Cursor reads it when the project opens. Paste this content, replacing the key with yours: `{ "mcpServers": { "kopik": { "url": "https://kopik.fr/api/mcp", "headers": { "Authorization": "Bearer kpk_…" } } } }`. Cursor also reads a global `mcp.json` in the `.cursor` folder of your home directory if you want the server available in every project.
What each field in mcp.json does
| Field | Value | Why it matters |
|---|---|---|
| `mcpServers` | Object holding all servers | Cursor ignores the file if this top-level key is misspelled |
| `kopik` | Any name you like | Label shown in Cursor's MCP settings and in tool calls |
| `url` | `https://kopik.fr/api/mcp` | Streamable HTTP endpoint, stateless, nothing to install locally |
| `headers.Authorization` | `Bearer kpk_…` | Your API key; required for every tool except `list_bases` |
Pin the server to a single base
The URL above exposes the whole catalog: the agent passes a `base` argument on each call. If the project only ever needs one documentation set, point the server at that base instead: `https://kopik.fr/api/mcp?base=your-base-slug`. Every base page shows its own URL. In that mode the `base` argument disappears from the tools, the agent cannot wander into another base, and prompts get shorter. It also works for private bases, as long as the key belongs to the owner.
Keep the key out of git
A project-level `.cursor/mcp.json` with a real key in it should not be committed. Add it to `.gitignore`, or put the server in your global configuration and commit only a template without the key. Treat a `kpk_` key like any other production secret, and revoke it from the dashboard if it leaks.
Step 2: check that Cursor sees the tools
Open Cursor's MCP settings. The `kopik` server should appear as enabled with three tools listed. If you edited the file while Cursor was open, toggle the server off and on, or reload the window. The tools are:
Tools exposed by the Kopik MCP server
| Tool | Arguments | Returns | Cost |
|---|---|---|---|
| `list_bases` | `topic`, `query` (both optional) | Public bases matching your filter | Free, no key needed |
| `ask_base` | `base`, `question`, `maxPriceCents` (optional) | A written answer plus numbered source passages | The base's price per question |
| `search_base` | `base`, `question`, `maxPriceCents` (optional) | Relevant passages only, no written answer | Same price as `ask_base` |
By default Cursor asks you to approve each tool call before it runs. Keep that on at first: it shows you exactly which base and question the agent sends, which is the fastest way to learn how it uses the server.
Prompts that work well from the editor
The agent decides on its own when to call a tool, but naming the tool and the base makes it reliable. A few patterns that hold up in daily use:
- Discover a base: "Use list_bases with the query 'GDPR transfers' and tell me which base fits a question about standard contractual clauses."
- Ask with sources: "Ask the base eu-gdpr-official-texts-data-transfers whether we need a transfer impact assessment for a US subprocessor. Quote the passages you rely on."
- Code from your own docs: "Call ask_base on my-api-guide: how does pagination work on the orders endpoint? Then update fetchOrders in this file to follow it."
- Raw passages for the agent to reason on: "Use search_base on my-api-guide for 'retry policy and idempotency keys', then write the retry wrapper and cite the passage numbers in a comment."
- Cap the spend: "Ask the base us-small-business-tax-irs-guide about deducting a home office, with maxPriceCents set to 10."
Two habits make a difference. First, ask for the passages, not only the conclusion, so you can verify before merging. Second, prefer `search_base` when the agent will write code anyway: it gets the raw evidence and does the reasoning in your context, at the same price.
Troubleshooting a Cursor MCP server that stays silent
Common symptoms and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Server missing or shown in error | Invalid JSON (trailing comma, smart quotes) or wrong file location | Validate the JSON, check the file is `.cursor/mcp.json` at the project root, reload |
| `list_bases` works, `ask_base` fails | Missing or malformed key | Header must read `Bearer kpk_…` with one space; check the key has not been revoked |
| Base not found | Typo in the slug, or a private base queried with someone else's key | Copy the slug from the base page; use the owner's key for private bases |
| Call refused without charge | `maxPriceCents` lower than the base's price | Raise the cap or pick another base |
| Agent answers without calling the tool | Prompt too vague | Name the tool and the base explicitly, or pin the server to one base |
| Rate limit errors | Limits reached | 20 questions per minute and 1,000 per day per user; 120 requests per minute per IP |
If you script calls yourself, note that JSON-RPC batches are capped at 10 requests. Full details, including the REST equivalent of each tool, are in the developer documentation.
Security and cost: what to know before rolling out to a team
Retrieved text is data, not instructions. Kopik wraps base content in kopik-untrusted tags so the client can tell document text apart from your prompt, which limits prompt injection from a document that contains something like "ignore previous instructions". Keep tool approval on for anything that writes files or runs commands in the same session.
On cost, API and MCP calls are always billed at the base's price per question, from prepaid credits; the free questions offered on the website do not apply here. Your own bases stay free within reasonable use. If your team handles regulated data (HIPAA, SOC 2 scope, state privacy laws), decide what goes into a base the same way you would for any SaaS vendor, and keep sensitive bases private.
Get your API key and connect Cursor
The developer page lists the MCP URL, every tool and the REST API, with setup for Cursor, Claude Code and other clients.
Frequently asked questions
Where does Cursor look for MCP configuration?
In a `.cursor/mcp.json` file at the root of the project, and in a global `mcp.json` inside the `.cursor` folder of your home directory. The project file is handy for team setups; the global one makes a server available everywhere.
Do I need to install anything locally to use a remote MCP server in Cursor?
No. A remote server over Streamable HTTP only needs a URL and, if required, a header. Kopik's server at https://kopik.fr/api/mcp is stateless and runs entirely on the hosted side.
Can Cursor search my private documentation, not just public bases?
Yes. Upload your docs as a private base, then use your own API key. You can point the server at that base alone with ?base=your-base-slug. Questions to your own bases are free within reasonable use.
What is the difference between ask_base and search_base?
ask_base returns a written answer with numbered source passages. search_base returns only the passages, which suits an agent that will reason and write code itself. Both cost the same.
How do I stop the agent from spending too much?
Pass maxPriceCents in your prompt or instructions. If the base costs more than the cap, the call is refused without any charge. Daily and per-minute limits also apply per user.
Get the Kopik newsletter
New knowledge bases, RAG guides and product news. One email every week or two, unsubscribe in one click.
By subscribing you agree to receive our newsletter. We never share your address.