Configure structural codebase context compression inside Cursor to reduce LLM query costs by 66-79%.
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.
Run the local installer script to compile or download the daemon binary to your system:
Cursor has built-in support for Model Context Protocol (MCP). To add mcp-injector:
mcp-injectorcommand/usr/local/bin/mcp-injector (on macOS/Linux) or the path returned by the installer.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}"
}
}
}
}
Open any folder in Cursor. Restart the editor to allow the daemon to connect. Open the Cursor Chat panel (Cmd+L) and type:
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.