MCP ConfigsMay 12, 2026·2 min read

CodeGraphContext — Graph Index for Code + MCP

CodeGraphContext indexes a repo into a code graph so developers and agents can query call chains, dependencies, and architecture via CLI or MCP mode.

Agent ready

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Native · 94/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Mcp
Install
Single
Trust
Trust: Established
Entrypoint
README.md
Universal CLI install command
npx tokrepo install c1dbc5db-1dde-463c-b63b-5c0393595eb6
Intro

CodeGraphContext indexes a repo into a code graph so developers and agents can query call chains, dependencies, and architecture via CLI or MCP mode.

  • Best for: large codebases where agents need reliable call graphs and dependency queries
  • Works with: Python 3.10+; CLI plus MCP mode for IDE/agent integration
  • Setup time: 20–45 minutes

Practical Notes

  • Index once, then query call chains/dependencies instead of re-reading files repeatedly.
  • Start with a small subfolder first to validate performance before indexing monorepos.

Two modes: CLI for humans, MCP for agents

You can use CodeGraphContext as:

  • a CLI to ask structural questions (callers/callees, dependencies),
  • an MCP server so your assistant can query structure via tools.

Practical workflow for better agent context

1) Index your repo

codegraphcontext index

2) Ask “structure” questions first

Good first questions:

  • “What calls this function?”
  • “Where does this module get instantiated?”
  • “Show the call chain from HTTP handler to DB write.”

3) Feed the query results to your agent

Instead of dumping full files, give the agent:

  • the top 10 nodes in the call chain,
  • the 3–5 files it must open,
  • constraints (touch only X modules, avoid breaking API).

Operational advice

  • Use file watching mode during refactors only when needed (it updates the graph continuously).
  • Treat the graph DB as a cache: rebuild when your repo changes dramatically.

FAQ

Q: Do I need MCP to get value? A: No. The CLI alone helps answer structural questions quickly.

Q: When should I re-index? A: After large refactors or when results look stale; treat the graph as a cache.

Q: How does this help agents? A: It gives reliable call/dependency context so agents stop guessing where logic lives.

🙏

Source & Thanks

Source: https://github.com/CodeGraphContext/CodeGraphContext > License: MIT > GitHub stars: 3,218 · forks: 573

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets