You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then ask Claude things like *"what functions call analyze_sources?"* or *"find the dependency chain between parse_config and send_request"* — it will handle the indexing and querying automatically.
238
238
239
+
### MCP server (`cgraph-mcp`)
240
+
241
+
For agents that speak the [Model Context Protocol](https://modelcontextprotocol.io)
242
+
(Claude Code, Cursor, Cline, …), code-graph ships a stdio MCP server
243
+
that exposes the knowledge graph as 7 first-class tools: `index_repo`,
This repo is indexed into a FalkorDB **code knowledge graph** exposed
4
+
to you over MCP as `code-graph`. Use it instead of grepping when you
5
+
need to understand how symbols connect.
6
+
7
+
## When to call each tool
8
+
9
+
| Tool | Call this when… | Example |
10
+
|---|---|---|
11
+
|`index_repo(path_or_url, branch?)`|**First** thing in a new repo; or after large changes outside your edits. Project name is **derived from the folder or repo URL** — read it back from the response. |`index_repo(path_or_url=".")`|
12
+
|`search_code(query, project)`| You know part of a symbol name and need its id (hybrid prefix + ranked match). |`search_code(query="processPay", project="myrepo")`|
13
+
|`find_symbol(name, project, file?)`| You know the exact symbol name (optionally in a given file) and want its id directly. |`find_symbol(name="processPayment", project="myrepo")`|
14
+
|`get_neighbors(symbol_id, project, relation?, direction?)`| "Who calls this?" (`direction="IN"`), "What does this call?" (`direction="OUT"`), or other edges via `relation` (CALLS/IMPORTS/DEFINES). Replaces the old get_callers/get_callees/get_dependencies. |`get_neighbors(symbol_id=42, project="myrepo", direction="IN")`|
15
+
|`get_file_neighbors(file, project)`| Symbols a file defines / depends on — "what's in this file and what does it touch?" |`get_file_neighbors(file="api/graph.py", project="myrepo")`|
16
+
|`impact_analysis(symbol_id, project, direction, depth)`|**"What breaks if I change this?"** Transitive upstream callers. |`impact_analysis(symbol_id=42, project="myrepo", direction="IN", depth=3)`|
17
+
|`find_path(source_id, dest_id, project)`| Show the call chain between two known symbols. |`find_path(source_id=10, dest_id=42, project="myrepo")`|
18
+
19
+
## Rules of thumb
20
+
21
+
1.**Start with `search_code` or `find_symbol`** to turn names into ids. Most tools take a `symbol_id`.
22
+
2.**Use `get_neighbors` with `direction`** for who-calls / what-calls: `IN` = callers, `OUT` = callees. Pass `relation` for IMPORTS/DEFINES edges.
23
+
3.**`impact_analysis` before refactoring.** Even when you think you know
24
+
the answer — the transitive closure often surprises you.
25
+
4.**`branch` is optional** but pass it when working on a feature branch
26
+
so you query the right per-branch index.
27
+
5.**Response shape.** Tools that return collections (`search_code`,
0 commit comments