redtokens-codegraph-mcp
v0.1.6A local MCP server for building structural code graphs from repositories
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
start_viz
Start the interactive 3D visualization of the active repo's graph and return its URL for the human to open in a browser. The viz shares this process's graph connection, so it always reflects the current state — including annotations you add and any re-scan you trigger. Args: port: optional; 0 (default) picks the first free port from 8000. Returns: {status: 'started'|'already_running'|'error', url, port}.
| Parameter | Type | Description |
|---|---|---|
port | integer |
stop_viz
Stop the visualization server, freeing its port. The graph itself and all MCP tools are unaffected.
viz_status
Whether the visualization is currently running, and its URL/port.
use_repo
Point CodeGraph at a project folder and make it the ACTIVE repo — the first thing to call when you start working on a codebase. On first use it builds the graph automatically (no manual indexing); afterwards it reopens the existing per-repo graph and catches up on any edits. Every other tool operates on the active repo, so they take no path. Graphs AND your saved annotations persist per-repo across sessions under ~/.codegraph/graphs/, keyed by the folder path. Args: path: absolute path to the project root, e.g. 'E:/work/m…
| Parameter | Type | Description |
|---|---|---|
path * | string | |
rebuild | boolean |
search_symbol
Find symbols whose name contains `query` (case-insensitive substring). This is the ENTRY POINT: use it first to get the exact name of a function / component / class before calling any other tool, since those match by exact name. Args: query: any part of a name, e.g. 'dashboard', 'attend', 'User'. Returns: list of {name, file, line, kind, isAsync, httpMethod, httpPath}. Empty list means no match — try a shorter/different substring.
| Parameter | Type | Description |
|---|---|---|
query * | string |
get_callers
DIRECT callers (one hop): the functions that call `symbol`. Use to answer 'who uses this?' or before renaming/changing a signature. For the full transitive blast radius use impact_of instead. Args: symbol: exact name from search_symbol. Returns: list of {name, file, line, kind, ...}.
| Parameter | Type | Description |
|---|---|---|
symbol * | string |
get_callees
DIRECT callees (one hop): the functions `symbol` itself calls. Use to see what this function depends on immediately. For the full downstream chain use trace_flow. Args: symbol: exact name from search_symbol. Returns: list of {name, file, line, kind, ...}.
| Parameter | Type | Description |
|---|---|---|
symbol * | string |
impact_of
TRANSITIVE callers: everything that reaches `symbol` within `depth` hops of calls. This is the 'what could break if I change `symbol`?' query — it walks the reverse call graph outward. Args: symbol: exact name from search_symbol. depth: how many call-hops to follow (default 3). Returns: de-duplicated list of {name, file, line, kind, ...}.
| Parameter | Type | Description |
|---|---|---|
symbol * | string | |
depth | integer |
trace_flow
TRANSITIVE callees: everything `symbol` reaches within `depth` hops — its execution path / full downstream dependency set. The forward mirror of impact_of. Args: symbol: exact name from search_symbol. depth: how many call-hops to follow (default 3). Returns: de-duplicated list of {name, file, line, kind, ...}.
| Parameter | Type | Description |
|---|---|---|
symbol * | string | |
depth | integer |
explain_symbol
BEST FIRST CALL for understanding one symbol — the whole picture in a single request, so you rarely need several separate tools. Fields that don't apply to this symbol's kind come back as empty lists. Args: symbol: exact name from search_symbol. Returns: { definitions, # where it's defined (name, file, line, kind) callers, callees, # direct, one hop each middleware, # if it's a route handler renders, renderedBy, # if it's a UI component extends, subclasses, instantiators, # if it's…
| Parameter | Type | Description |
|---|---|---|
symbol * | string |
get_file_imports
File-level dependency view: which files this file imports (its dependencies) and which files import it (its dependents / reverse deps). Use to gauge how central a file is or what a file-level change touches. Args: file: repo-relative path as shown in search_symbol results, e.g. 'routes/messRoute.js'. Returns: {file, imports: [paths], importedBy: [paths], exports: [symbols]}.
| Parameter | Type | Description |
|---|---|---|
file * | string |
get_middleware_for
The middleware chain applied to a route handler (auth, validation, rate-limiting, etc.). Use before touching a route to see what guards run first, or to check whether an endpoint is protected. Args: route: route name as shown by search_symbol, e.g. 'post /attend/:messId/day'. Returns: list of middleware {name, file, line, ...}.
| Parameter | Type | Description |
|---|---|---|
route * | string |
get_render_tree
UI composition for a React (or similar) component: what it renders (its direct child components in JSX) and what renders it (its direct parents). Use for 'what does this screen contain', 'where is this component used', or 'what breaks visually if I change it'. Args: component: exact component name from search_symbol. Returns: {component, renders: [children], renderedBy: [parents]}.
| Parameter | Type | Description |
|---|---|---|
component * | string |
get_class_hierarchy
Class relationships: its parent (extends), its subclasses, and who constructs it (`new ClassName()`). Use before changing a base class or a shared service class to see who is affected. Args: class_name: exact class name from search_symbol. Returns: {class, extends, subclasses, instantiators}.
| Parameter | Type | Description |
|---|---|---|
class_name * | string |
add_relationship
Record a semantic relationship you discovered between two EXISTING symbols — knowledge the static graph can't derive from syntax alone. This is how the graph evolves: the edge is saved per-repo and shown to every future session (via explain_symbol / get_relationships). `relationship_type` is a free-form UPPER_SNAKE label you choose, e.g.: WRITES_TO / READS_FROM — touches a DB table / collection / data source AUTHENTICATES / VALIDATES — middleware role for a route or input SENDS_EMAIL / CALLS_EXTERNAL_API — outbound side e…
| Parameter | Type | Description |
|---|---|---|
from_symbol * | string | |
relationship_type * | string | |
to_symbol * | string | |
note | string |
annotate_symbol
Attach classification tags and an explanatory note to one symbol — durable memory that survives edits and future sessions (find them again with find_by_tag, or see them in explain_symbol). Use it to record what a symbol IS or does that isn't obvious from its name. Tags MERGE with any existing tags (they don't replace). A non-empty note overwrites the previous note. Args: symbol: exact name from search_symbol. tags: list of short labels, e.g. ['database','auth','payment','cron']. note: one or two sentences of…
| Parameter | Type | Description |
|---|---|---|
symbol * | string | |
tags * | array | |
note | string |
get_relationships
All AI-discovered (add_relationship) edges touching a symbol, in BOTH directions. Use to recall what has already been learned about a symbol before re-deriving it. Args: symbol: exact name from search_symbol. relationship_type: optional filter, e.g. 'WRITES_TO'. Returns: list of {direction, type, symbol, file, note}.
| Parameter | Type | Description |
|---|---|---|
symbol * | string | |
relationship_type | string |
find_by_tag
Retrieve every symbol previously tagged (via annotate_symbol) with `tag`. Use to answer cross-cutting questions like 'show all DB-touching functions' once you've annotated them. Args: tag: a tag string, e.g. 'database'. Returns: list of {name, file, line, kind, ...}.
| Parameter | Type | Description |
|---|---|---|
tag * | string |
reindex
Force an immediate re-scan of the active repo right now. Normally UNNECESSARY — every read auto-syncs changed files first — but useful after a large batch of edits when you want to guarantee freshness before a series of queries. Returns: {changed, deleted, unchanged, nodes, edges}.