Wire NCI into Cursor
Drop one MCP entry into Cursor and the agent can ask exact questions about the libraries you have installed without leaving the editor. The server inherits NCI’s config-driven database resolution, so each open workspace gets the right index automatically.
Add the MCP server
Edit ~/.cursor/mcp.json, or open :
{ "mcpServers": { "nci": { "command": "npx", "args": ["-y", "@nativecontextindex/mcp"], "env": { "NCI_PROJECT_ROOT": "${workspaceFolder}" } } } }
Cursor expands ${workspaceFolder} in env when it loads mcp.json (config interpolation). That becomes NCI_PROJECT_ROOT inside nci-mcp, which passes global nci -r on every tool call — required for active_package when the server is registered in global ~/.cursor/mcp.json (where MCP cwd is often not the repo).
If nci is not on Cursor’s PATH, add NCI_BINARY too:
{ "mcpServers": { "nci": { "command": "npx", "args": ["-y", "@nativecontextindex/mcp"], "env": { "NCI_PROJECT_ROOT": "${workspaceFolder}", "NCI_BINARY": "/absolute/path/to/nci" } } } }
Find the absolute path with:
Apply changes
Cursor watches mcp.json and rebuilds the server list when you save — no app restart needed. Open to confirm nci is listed with two tools and three resources. If the toggle row looks stuck, the command palette’s Developer: Reload Window is the only escalation you should ever need.
Best-practice prompts
- “Look up
ZodObject.omitin the version of zod we have installed before writing the schema.” - “List the public exports of
@my-org/sharedso I can decide what to import.” - “Find every overload of
useStateand tell me which packages provide it.”
The agent picks the right nci_query subcommand. Pin package_name and package_version in the prompt when you want exact answers fast — the agent primer goes into more detail on why.
Re-index on demand
NCI’s tools read the database; they do not build it. Re-run nci index whenever the lockfile changes:
For monorepo setups see Monorepo indexing.
Troubleshooting
If Cursor reports the wrong NCI version or “binary not found”, set NCI_BINARY to the path printed by nci binary-path. The Node shim and nci-mcp both defer to it.
Skills
Cursor follows the open Agent Skills standard. NCI’s shipped skill (nci-answer-quality) drops into Cursor’s discovery path with no rewriting — see NCI Skills for the host-by-host map.