MCP Integration
ContextWeaver can run as a Model Context Protocol server, allowing MCP-compatible AI clients to retrieve context from the current codebase.
Start the MCP server
contextweaver mcpRecommended workflow
- Run
contextweaver initin the target codebase. - Configure
~/.contextweaver/.env. - Run
contextweaver indexto build the initial index. - Configure the ContextWeaver server in your MCP client.
- Use semantic retrieval, file listing, symbol definition, and reference tools to fetch code context.
Configure in your client
ContextWeaver runs over stdio with the command contextweaver mcp. Here is how to connect two common clients.
Codex
Codex stores MCP configuration in config.toml (default ~/.codex/config.toml, or .codex/config.toml in a trusted project).
Add it via the CLI:
codex mcp add contextweaver -- contextweaver mcpOr edit config.toml directly:
[mcp_servers.contextweaver]
command = "contextweaver"
args = ["mcp"]Run /mcp in the Codex TUI to see connected servers.
Claude Code
Claude Code adds stdio servers with claude mcp add. All options must come before the server name, and the command to launch follows --:
claude mcp add contextweaver -- contextweaver mcpUse --scope to choose where the config lives: local (default, private to you in the current project), project (written to .mcp.json at the project root and shared via version control), or user (available across all your projects). Project-scoped example:
claude mcp add --scope project contextweaver -- contextweaver mcpA project-scoped server is written to .mcp.json:
{
"mcpServers": {
"contextweaver": {
"command": "contextweaver",
"args": ["mcp"]
}
}
}Run /mcp inside Claude Code to check the connection status.
If
contextweaveris not on yourPATH, replacecommandwith the full path to the executable (find it withwhich contextweaver).
MCP tool capabilities
- Semantic code retrieval
- Indexed file listing
- Symbol definition lookup
- Symbol reference lookup
- Index and health statistics
On the first query, ContextWeaver can automatically trigger indexing. Later queries reuse local SQLite and LanceDB indexes.