Cursor + MCP setup

Prerequisites

Step 1 — Build the graph

cd /path/to/your/project
codegenome analyze .

Confirm .genome/watcher.db exists.

Step 2 — Start MCP (HTTP)

Terminal 1 — keep this running:

python -m codegenome --workspace . --build --mcp --watch

Or start a standalone HTTP server:

python -m codegenome.mcp_server \
  --db-path ./.genome/watcher.db \
  --transport http \
  --host 127.0.0.1 \
  --port 7331

Health check:

curl http://127.0.0.1:7331/health

Step 3 — Install Cursor MCP config

Terminal 2:

python -m codegenome.installer \
  --db-path "$(pwd)/.genome/watcher.db" \
  --client cursor \
  --transport http \
  --host 127.0.0.1 \
  --port 7331

On Windows PowerShell, use $PWD instead of $(pwd).

Step 4 — Generate Cursor rules

codegenome rules --client cursor --port 7331 .

Or copy the template manually from extensions/templates/watcher-knowledge-graph.mdc into .cursor/rules/.

Step 5 — Restart Cursor

Reload the window so MCP picks up ~/.cursor/mcp.json changes.

Alternative: stdio transport

codegenome mcp-start .
python -m codegenome.installer \
  --db-path "$(pwd)/.genome/watcher.db" \
  --client cursor \
  --transport stdio

Troubleshooting

See Troubleshooting for connection refused, empty tools, and port conflicts.