mcp-injector for Cursor IDE

Configure structural codebase context compression inside Cursor to reduce LLM query costs by 66-79%.

Why use mcp-injector with Cursor?

Cursor is incredibly powerful at analyzing codebase context, but when you add entire directories to Composer or Chat, it frequently hits context limits or consumes millions of expensive tokens. mcp-injector solves this by serving a compressed AST representation of your project directly to Cursor on-demand. When Cursor needs to read the full body of a method or structure, it automatically requests it back locally without bloating your prompt history.

1. Install the daemon

Run the local installer script to compile or download the daemon binary to your system:

curl -fsSL https://foldwork.dev/install | sh

2. Configure Cursor MCP

Cursor has built-in support for Model Context Protocol (MCP). To add mcp-injector:

  1. Open Cursor's Settings (Cmd+, on macOS, Ctrl+, on Linux/Windows).
  2. Navigate to the Features tab.
  3. Scroll down to the MCP section.
  4. Click + Add New MCP Server.
  5. Fill in the fields exactly as follows:
    • Name: mcp-injector
    • Type: command
    • Command: /usr/local/bin/mcp-injector (on macOS/Linux) or the path returned by the installer.

Manual Configuration (mcp.json)

If you prefer editing the JSON config file directly, Cursor reads MCP servers from ~/.cursor/mcp.json. Add the server entry:

{
  "mcpServers": {
    "mcp-injector": {
      "command": "/usr/local/bin/mcp-injector",
      "env": {
        "MCP_WORKSPACE": "${workspaceFolder}"
      }
    }
  }
}

3. Verification

Open any folder in Cursor. Restart the editor to allow the daemon to connect. Open the Cursor Chat panel (Cmd+L) and type:

Use get_project_map to check the structure of this workspace.

Cursor will run the tool and display the folded codebase signature tree. If it lists your Go/TS/Python package exports with { ... } stubs, the configuration is working.