All Guides
codebase
mcp
ai-agents

Index Your Codebase for Claude Code, Cursor, and Codex

Give AI coding agents deep, AST-aware context over your repo. Works with Claude Code, Cursor, Codex, and any MCP client.

April 6, 2026

Index Your Codebase for Claude Code, Cursor, and Codex

The core limitation of AI coding agents isn't intelligence — it's visibility. They read files one at a time, which means they miss the SSOTokenExpirationHandler sitting three directories away when you ask about auth timeouts. They guess at code that already exists because they have no way to search for it.

Indexed solves this by building a local semantic index of your entire codebase and exposing it to your agent via MCP. It uses tree-sitter to parse code into AST-aware chunks (not raw text), then embeds those chunks into a local vector index for semantic retrieval. Your agent gets real search results instead of reading ten files hoping one is relevant.

Everything stays on your machine. No API calls, no cloud sync.

Prerequisites

  • Indexed installed
  • A codebase to index
  • Claude Code, Claude Desktop, OpenAI Codex, Cursor, GitHub Copilot, or another MCP-capable editor

Index your codebase

Point Indexed at your repo:

Terminal
indexed index create files -c my-repo -p ~/work/my-project

The CLI streams progress while it parses and embeds; with code_chunking enabled, source files split at AST boundaries.

To filter what gets indexed, use include/exclude patterns:

Terminal
# Only index selected languages; patterns are regex (repeat --include / --exclude)
indexed index create files -c my-repo -p ~/work/my-project \
  --include ".*\\.py$" --include ".*\\.ts$" --include ".*\\.go$" \
  --exclude ".*test.*" --exclude ".*vendor.*" --exclude ".*node_modules.*"

For git repos, change tracking defaults to git-aware updates when configured — see Local Files & Code.

Connect your AI agent

Follow MCP Setup for Claude, Codex, Cursor, GitHub Copilot, the shared mcpServers JSON, and a uv run snippet for source installs. Indexed runs as an MCP server via stdio — your editor launches it as a subprocess. The config is nearly identical across all tools.

For Claude Code, add Indexed to your MCP config (project or user scope):

mcp_config.json
{
  "mcpServers": {
    "indexed": {
      "command": "indexed",
      "args": ["mcp", "run"]
    }
  }
}

For Claude Desktop, edit your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Same JSON structure. Restart Claude Desktop after saving.

Installed from source?

If you cloned the repo and installed with uv, use this config instead:

{
  "command": "uv",
  "args": ["run", "--directory", "/path/to/indexed", "indexed", "mcp", "run"]
}

Replace /path/to/indexed with the path to your cloned repository.

Verify it works

Open your agent and try a query against your codebase:

  • "Search my indexed documents for the authentication middleware"
  • "Find where we define the database connection pool"
  • "What tools do you have available from Indexed?"

Your agent should call the search or search_collection tool and return results with file paths and relevant code snippets.

Example: searching your codebase

You: "Where is rate limiting implemented in our API?"

Agent calls: search_collection("my-repo", "rate limiting API")

Agent responds:

Rate limiting is implemented in src/middleware/rate_limiter.py. The RateLimitMiddleware class (line 14) uses a sliding window counter backed by Redis. Configuration lives in src/config/limits.yaml. There's also a per-route override in src/api/routes.py at line 87.

The agent found the right code on the first try because the index understood what "rate limiting" means at the code level — not just as a string to match.

Keeping the index fresh

Update your index when the code changes:

Terminal
indexed index update my-repo

Git-based change tracking detects which files changed since the last index. Only those files get re-processed. To automate it:

crontab
0 8 * * * /path/to/indexed index update my-repo 2>&1 >> ~/.indexed/update.log

Troubleshooting

Tools not appearing in your agent — Make sure indexed is on your PATH (which indexed). Restart your editor after editing the config file, and double-check the JSON for trailing commas.

Empty search results — Run indexed index inspect to confirm the collection exists. Try indexed index search "your query" from the CLI to isolate whether the problem is the index or the MCP connection.

Slow first response — The embedding model loads into memory on the first query. Subsequent queries in the same session are fast.

Next steps