Home / Token cost / Codegraph

The Codegraph MCP server costs 7,958 tokens before the first call.

Connect Codegraph and its 38 tool definitions are loaded into the model's context on every request — 4.0% of a 200k window spent before your agent does anything.

QUICK ANSWER The Codegraph MCP server's tool definitions consume 7,958 tokens — 4.2× the median MCP server (1,905 tokens). A scoped grant exposing only the tools you use cuts that roughly in proportion.

MEASURED FROM SCHEMAS 38 tools · 7,958 tokens · 4.0% of 200k · 0.8% of 1M Method →

What that buys before your agent starts working.

Tool definitions are overhead: they occupy context on every request and compete with your code, documents and conversation history for the same window.

200K WINDOW 4.0%
1M WINDOW 0.8%

Corpus context: Codegraph ranks #316 of 3,213 measured MCP servers by definition cost. The median is 1,905 tokens, p90 is 7,952, and the heaviest (Fusionauth) is 183,337 — 92% of a 200k window on its own.

Where the 7,958 tokens go.

Each row is one tool definition as a tools/list entry — name, description and input schema — counted with o200k_base. Average: 209 tokens per tool.

ToolCategoryTokens% of server
codegraph_memory_store Read 343 4.3%
codegraph_get_edit_context Read 338 4.2%
codegraph_get_curated_context Read 336 4.2%
codegraph_traverse_graph Execute 326 4.1%
codegraph_get_ai_context Read 306 3.8%
codegraph_symbol_search Read 289 3.6%
codegraph_analyze_complexity Read 287 3.6%
codegraph_find_entry_points Read 286 3.6%
codegraph_get_dependency_graph Read 269 3.4%
codegraph_find_by_signature Read 263 3.3%
codegraph_get_detailed_symbol Read 257 3.2%
codegraph_search_git_history Read 249 3.1%
codegraph_compare_symbols Read 247 3.1%
codegraph_memory_search Read 246 3.1%
codegraph_analyze_impact Read 240 3.0%
codegraph_find_unused_code Read 230 2.9%
codegraph_get_call_graph Read 223 2.8%
codegraph_find_duplicates Read 219 2.8%
codegraph_find_by_imports Read 217 2.7%
codegraph_get_callees Read 204 2.6%
codegraph_analyze_coupling Read 198 2.5%
codegraph_get_callers Read 197 2.5%
codegraph_find_implementors Read 194 2.4%
codegraph_get_symbol_info Read 194 2.4%
codegraph_cross_project_search Read 187 2.3%
codegraph_index_directory Destructive 186 2.3%
codegraph_memory_context Read 185 2.3%
codegraph_find_similar Read 182 2.3%
codegraph_cluster_symbols Read 169 2.1%
codegraph_find_related_tests Read 162 2.0%
codegraph_index_files Write 143 1.8%
codegraph_memory_list Read 135 1.7%
codegraph_mine_git_history_for_file Write 130 1.6%
codegraph_mine_git_history Write 99 1.2%
codegraph_memory_invalidate Read 73 0.9%
codegraph_memory_get Read 62 0.8%
codegraph_reindex_workspace Read 55 0.7%
codegraph_memory_stats Read 32 0.4%

Most agents use a handful of these tools. They pay for all 38.

A PolicyLayer grant exposes only the tools you allow — ungranted definitions are filtered out of the tool list, so they never enter the context window. Estimates below assume typical-weight tools (209 tokens each).

Grant scopeDefinition costReduction
All 38 tools (no gateway) 7,958 tokens
3 granted tools ~628 tokens −92%
5 granted tools ~1,047 tokens −87%
10 granted tools ~2,094 tokens −74%

Codegraph token-cost questions.

How many tokens does the Codegraph MCP server use?+

Its 38 tool definitions total 7,958 tokens — 4.0% of a 200k context window — measured with tiktoken o200k_base over the serialised tools/list payload. Exact counts vary slightly by client and model.

Why does Codegraph consume tokens before I send a message?+

MCP clients load every connected server's tool definitions — name, description, and input schema — into the model's context so it knows what it can call. That payload is charged against your context window on every request, whether or not a tool is used.

How do I reduce Codegraph's token usage?+

Expose fewer tools. A PolicyLayer grant scopes Codegraph to only the tools you allow — ungranted definitions are filtered out of the tool list, so they never enter the context window. A grant of 3 typical tools costs roughly 628 tokens, a 92% reduction.

Does deferred tool loading fix this?+

Partially, in some clients. Claude Code defers MCP tool schemas behind a tool-search step by default, and VS Code has experimental grouping — but you still pay tokens per search and reload, and Cursor, Windsurf and Gemini CLI load definitions upfront. Reducing the exposed tool set cuts the cost in every client.

How these numbers were measured.

01
Serialisation

Each tool is serialised as a tools/list entry — name, description, input schema — from the schemas in the PolicyLayer scan database. Clients differ slightly in framing, so treat counts as close estimates.

02
Tokeniser

tiktoken o200k_base (GPT-4o/o-series). Anthropic's current tokeniser isn't published, so Claude's exact counts will differ; for English text and JSON schemas the totals are close enough to treat these as estimates.

03
Deferred loading

Some clients now defer schema loading (Claude Code's tool search; VS Code experimental grouping). You still pay per search and reload — and Cursor, Windsurf and Gemini CLI load everything upfront.

Computed 07-06-2026 from the PolicyLayer scan database over all 38 catalogued Codegraph tools. Counts refresh with every site build.

Expose only the tools you use — the rest never enter your context.

A PolicyLayer grant scopes Codegraph to the tools you actually allow. Ungranted definitions never load, and every call that does run is checked against policy first.

Free to start. No card required.

4,600+ MCP servers and 31,000+ tools scanned and risk-classified.

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.