Guide · Cursor

How to give Cursor context about your project

Cursor is a strong coding agent with an empty head. It reads your repository, not your product. Here are the four ways to give Cursor project context, what each one is good for, where each one breaks, and when to move up a level.

Updated 9 minute readApplies to Cursor 1.x in Agent mode

Why Cursor builds the wrong thing

The failure looks like this. You ask Cursor to add a plan gate to the billing page. It reads the code, finds a customer object, and writes a check on customer.tier. There is no tier. The entity has plan_id. The spec that says so is in Notion, or in a Slack thread, or in your head. Cursor never had it.

Cursor builds from what is in its context window: the open files, the rules it loaded, whatever you typed or attached. Everything else is a guess. Giving Cursor context about your project means deciding where the truth about your product lives and how the agent reaches it on every session, not only the one where you remembered to paste.

There are four ways to do that. The first three hold instructions and access. Only the fourth holds the spec itself. They stack: most teams end up with two, rules for how they code and something heavier for what they are building.

  1. 01

    .cursorrules / .cursor/rules

    Standing instructions: conventions, commands, what never to do.

  2. 02

    @Docs and pasting

    Hand the agent a document. Lasts one session, or one crawled URL.

  3. 03

    .cursor/mcp.json

    A live source the agent queries mid-task: a schema, a tracker, a wiki.

  4. 04

    ContextsBase over MCP

    The spec, data model, and test cases themselves, published.

Method 1

.cursorrules and .cursor/rules

Rules are plain text Cursor loads into the context window before the agent starts. The legacy form is a single .cursorrules file in the repository root. The current form is a .cursor/rules folder of .mdc files, each with frontmatter that decides when it attaches. Cursor calls these Project Rules.

.cursor/rules/billing.mdc
---
description: Product rules for the billing area
globs: ["src/billing/**", "e2e/billing/**"]
alwaysApply: false
---

- Plans are free and premium. The column is users.plan_id.
  There is no tier field anywhere. Do not add one.
- Password reset links expire in 15 minutes and work once.
- Every business rule gets a Playwright test in e2e/ before the PR.
- Never call Stripe from a component. Go through lib/billing.
globs attaches the rule when a matching file is open. alwaysApply: true loads it in every conversation. Leave both off and the agent picks the rule up from its description when it decides the rule is relevant.

Rules are the right home for conventions: the framework, the folder layout, how to run tests, what never to do. Keep each one under about fifty lines and scoped with globs. A rule that is always on and three hundred lines long crowds out the code the agent should be reading.

The legacy .cursorrules file

.cursorrules
# Legacy single file at the repository root
Next.js 14 app with Tailwind. Package manager is pnpm.
Plans are free and premium. The column is users.plan_id, not tier.
Run "pnpm test:e2e" before you open a PR.
Cursor still reads it, alongside anything in .cursor/rules. New rules should go in the folder so they can be scoped to the files they are about.

Works for

  • Coding conventions, stack choices, and commands that rarely change.
  • Solo developers who want one place to write down house style.
  • Facts that fit in a sentence, like the plan_id line above.

Where it breaks

  • The spec changes and nobody updates the rule. Rules drift because no one owns them.
  • You try to describe a data model in prose. Twelve entities and their foreign keys do not fit.
  • Two people write conflicting rules. The agent sees both and picks one.
  • You want to know what the agent actually built, and from which version. Rules are read-only.

Method 2

@Docs and pasting documents into Cursor

The fastest way to give Cursor context is to hand it the document. Paste the spec into the chat, attach a file with @Files, or add a URL under @Docs so Cursor crawls and indexes it. For a library’s public reference, @Docs is excellent. For your own product spec, it has a shelf life of one conversation.

cursor · chat · new session
you

Add the plan gate to the billing page. The rules are in the spec I pasted yesterday. @Docs Stripe

agent

I don’t see a spec in this conversation. I’ll infer the rules from the code.

Reading src/billing/page.tsx … adding a check on customer.tier === "premium"

There is no tier field. The entity has plan_id. Nothing in this session says so.

The mockup is the common case. The spec was pasted yesterday. Today is a new session, the paste is gone, and the agent does the reasonable thing: it infers the rules from the code. Inference is how you get customer.tier. Nothing in the repository contradicts it, so nothing stops it.

@Docs does persist, because Cursor keeps the index. But it only crawls public URLs, it stores the page as prose, and it has no idea which feature you are building next. It answers “what does this library do” well and “what should this app do” poorly.

Works for

  • One-off tasks where the spec is short and you have it open anyway.
  • Public documentation for a framework or API you depend on.
  • Debugging, where the context that matters is a log or an error, not a product rule.

Where it breaks

  • Any task that spans more than one chat. The paste does not follow you.
  • Private documents. @Docs cannot index pages behind a login.
  • Data models. A pasted table of fields is prose to the agent; it will still invent a column.
  • Two agents or two teammates. Each pastes a different version and nobody can tell which one shipped.

Method 3

.cursor/mcp.json with an MCP server

MCP, the Model Context Protocol, lets Cursor call tools on a server you point it at. You register servers in .cursor/mcp.json for one project, or ~/.cursor/mcp.json for all of them. A server can run locally as a command or remotely over HTTP. Once enabled under Cursor Settings, MCP, its tools appear in Agent mode and the agent decides when to call them.

.cursor/mcp.json
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://localhost:5432/app"
      ]
    },
    "internal-docs": {
      "url": "https://docs.internal.example.com/mcp",
      "headers": { "Authorization": "Bearer ${DOCS_TOKEN}" }
    }
  }
}
Two shapes: a local stdio server launched with a command, and a remote server reached by URL. Environment variables in the file are expanded by Cursor, so tokens stay out of git.

This is a real step up. The agent now pulls context on demand instead of relying on what was pasted. Point it at a Postgres server and it can read the schema instead of guessing at customer.tier. Point it at an internal docs server and it can fetch the page it needs.

What a generic MCP server gives you

Most off-the-shelf MCP servers are adapters: a database, a file tree, a wiki, an issue tracker. They give the agent access to a system it could not otherwise reach. Access is not structure. The agent can now read every column in users. It still has to work out what the product is supposed to do with them, and the server itself is yours to run, secure, and keep online.

Works for

  • Live sources the agent should query rather than memorise: a schema, an issue tracker, logs.
  • Teams with a platform engineer who can own a server.
  • Facts that change faster than anyone would update a rules file.

Where it breaks

  • The source is raw. A schema tells the agent the columns, not the business rule that governs them.
  • There is no queue. Two agents on the same backlog still pick the same task.
  • There is nothing to write back to. The agent finishes and the record lives only in the chat.
  • You now maintain a server. Auth, uptime, and version drift are your problem.

Method 4

A structured product knowledge base over MCP

Method 4 is method 3 with the right thing on the other end. Instead of a raw source, the MCP server holds the product itself as structured objects: features with business rules, entities with fields and foreign keys, flows, test cases written as Given, When, Then, and iterations that order the work. That is what ContextsBase is: context infrastructure for coding agents. You write the knowledge once. Cursor builds from it every session.

contextsbase · what you wrote
I-1Accounts
Open to agents
  1. 1F-1

    Sign up with email

    tests T-1, T-2

    Implemented
  2. 2F-2

    Sign in with Google

    tests T-3

    Implemented
  3. 3F-3

    Password reset

    tests T-7, T-8

    In progress
  4. 4F-4

    Two-factor auth

    tests T-9, T-10

    Pending
  5. 5F-5

    Delete account

    tests T-11

    Pending

5 features · 11 test cases · entities User, Session, ResetToken · published

MCP
cursor · agent mode
  1. you ›Implement iteration I-1
  2. Claimed F-1 Sign up with email
  3. F-1 built · T-1, T-2 passed · recorded
  4. Claimed F-2 Sign in with Google
  5. F-2 built · T-3 passed · recorded
  6. Claimed F-3 Password reset
  7. ·spec: 2 rules · entities: User, Session, ResetToken · tests: T-7, T-8
  8. ·T-7 link expires in 15 minutes · T-8 link works once
Left: iteration I-1 as you wrote it. Right: Cursor works the list over MCP, one claim at a time, and records what it built.

The instruction is one line: Implement iteration I-1. Cursor calls next_iteration_item, which claims the next unstarted feature and returns everything in one bundle: the spec and its rules, the entities it touches, the flow, the test cases, and the theme tokens. It builds, turns T-7 and T-8 into Playwright tests, and calls record_test_automation and record_feature_implementation. The feature flips to Implemented. Nobody pasted anything.

Connect Cursor

Create a project, publish at least one feature, and generate an MCP token under the project’s Agents tab. Then add the server to .cursor/mcp.json:

.cursor/mcp.json
{
  "mcpServers": {
    "contextsbase": {
      "url": "https://app.contextsbase.com/api/v1/mcp",
      "headers": {
        "Authorization": "Bearer mcp_live_••••••••••••••••••••••••"
      }
    }
  }
}
Tokens start with mcp_live_ and carry scopes for read, write, and records. Keep the file out of git, or reference the token through an environment variable the way the previous section does.

Enable the server under Cursor Settings, MCP. In Agent mode you should see five tools:

list_iterationsnext_iteration_itemget_feature_specrecord_test_automationrecord_feature_implementation

Keep your .cursor/rules for conventions. Delete the spec you pasted into them. Each implementation record carries a fingerprint of the spec it was built from, so when the feature changes later the record turns Outdated instead of silently drifting.

Works for

  • The same spec is needed in more than one session, by more than one person or agent.
  • You want tests that assert business rules, not just that a button rendered a toast.
  • You need a record of what was built from which version of the spec.
  • Ordered work: agents pull the next step with an atomic claim instead of you dragging cards.

Where it breaks

  • Nobody writes the spec. If features stay in Draft, there is nothing for the agent to pull.
  • You only need conventions. A rules file is simpler for that, and you should keep it.
  • You want the agent to read raw production data. That is a job for method 3, alongside this one.

Cursor context methods compared

Setup time is for a working first version. “Survives new sessions” means the agent has the context tomorrow without you doing anything. “Agent can write back” means the method records what was built, not only what was asked.

Four ways to give Cursor project context, compared on setup time, persistence, write-back, and tests
MethodSetup timeSurvives new sessionsAgent can write backTests included
.cursorrules / .cursor/rules5 minutesYes, lives in the repoNo, you edit the fileNo
@Docs and pasting documents0 minutes, every sessionPaste: no. @Docs index: yesNoNo
.cursor/mcp.json + generic MCP server30 minutes to days, you run the serverYesOnly if the server exposes a write toolNo, raw sources only
ContextsBase over MCP10 minutesYes, published knowledgeYes, implementation and test recordsYes, Given / When / Then per feature

When to upgrade

Start with rules. Move up when you hit one of these.

  1. 01

    Stay on rules

    While the project is yours alone and the product fits in a few sentences. Add @Docs for the libraries you lean on.

  2. 02

    Add an MCP server

    When the agent needs a live source: the real schema, the issue tracker, recent logs. Prose in a rules file cannot keep up.

  3. 03

    Move to a structured knowledge base

    The second time you paste the same spec, the first time the agent invents a field, or the day a second person or a second agent starts working the same backlog.

  4. 04

    Keep them layered

    Rules for how you code. ContextsBase for what you are building. A raw MCP server for data only the database knows.

The same four levels exist for Claude Code, with CLAUDE.md in place of rules and .mcp.json in place of .cursor/mcp.json. That guide is How to give Claude Code context about your project. If you are weighing rules files against a knowledge base specifically, the Cursor rules alternative page puts them side by side.

Stop pasting the spec into Cursor.

One feature, one iteration, one entry in .cursor/mcp.json. Ten minutes.

  • Free for one project
  • Bring your own agent

Frequently asked questions

What is the difference between .cursorrules and .cursor/rules?

.cursorrules is the legacy single file at the repository root. .cursor/rules is a folder of .mdc files, each with frontmatter that decides when the rule attaches: always, when a matching file is open, when the agent judges it relevant, or only when you mention it with @. Cursor still reads .cursorrules, but new rules belong in .cursor/rules so they can be scoped.

Does Cursor remember project context between chat sessions?

Rules in the repository persist because Cursor reloads them every session. Text you paste into a chat does not carry into the next one. Cursor can also generate Memories from your conversations, but they are per project, stored by Cursor, and not shared with teammates. An MCP server persists because the agent calls it fresh each time.

Can Cursor read a Notion page or Google Doc as project context?

Only indirectly. You can paste the text, or add a public URL under @Docs so Cursor crawls and indexes it. Private pages behind a login do not index. An MCP server can expose the document, but the agent still receives prose, not a data model or a list of test cases.

How do I add an MCP server to Cursor?

Create .cursor/mcp.json in the project, or ~/.cursor/mcp.json for every project, and add an entry under mcpServers with either a command that launches a local server or a url for a remote one. Enable it under Cursor Settings, MCP. The server's tools then appear to the agent in Agent mode.

Does ContextsBase replace .cursor/rules?

No. Keep rules for coding conventions: framework choices, formatting, how to run the test suite. Use ContextsBase for product knowledge: features, business rules, entities, flows, test cases, and the iteration queue. They only overlap if you have been pasting specs into rules files, and that is the part you move.

Is ContextsBase free to try with Cursor?

Yes. The free plan covers one project, 100 features per project, 3 members, 1 MCP token, and unlimited open iterations. That is enough to publish an iteration and point Cursor at it.

Is there a version of this guide for Claude Code?

Yes. The Claude Code guide covers CLAUDE.md, memory, claude mcp add, and the same ContextsBase connection, with the same four levels.