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
T13 — agent guidance bundle:
- Add `api/mcp/templates/` shipped as package data (claude_mcp_section.md,
cursorrules.template) with the canonical 8-tool MCP guidance.
- Add `cgraph init-agent [--force]` Typer command that drops
CLAUDE.md and .cursorrules into CWD.
- Update AGENTS.md with the MCP tool table and env-var reference.
T14 — packaging / image dual-mode:
- `start.sh` dispatches on `CGRAPH_MODE` env var (web|mcp). Default
(web) preserves the existing FastAPI behaviour; mcp execs cgraph-mcp.
- `docker-compose.yml` gains an opt-in `code-graph-mcp` service under
the `mcp` profile for stdio attach.
- README quickstart section for both `claude mcp add-json` registration
and Docker compose profile usage.
Tests: 4 new (CliRunner against tmp_path); MCP suite green at 61 passed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
224
224
225
+
### MCP server (`cgraph-mcp`)
226
+
227
+
For agents that speak the [Model Context Protocol](https://modelcontextprotocol.io)
228
+
(Claude Code, Cursor, Cline, …), code-graph ships a stdio MCP server
229
+
that exposes the knowledge graph as 8 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)`|**First** thing in a new repo; or after large changes outside your edits. |`index_repo(path=".")`|
12
+
|`search_code(prefix, project)`| You know part of a symbol name and need its id. |`search_code(prefix="processPay", project="myrepo")`|
13
+
|`get_callers(symbol_id, project)`| "Who calls this?" — refactoring a function, tracking down a regression. |`get_callers(symbol_id=42, project="myrepo")`|
14
+
|`get_callees(symbol_id, project)`| "What does this call?" — understanding a function before editing it. |`get_callees(symbol_id=42, project="myrepo")`|
15
+
|`get_dependencies(symbol_id, project)`| All edges out of a symbol (CALLS + IMPORTS + DEFINES). |`get_dependencies(symbol_id=42, 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
+
|`ask(question, project)`| Open-ended natural-language question. **More expensive — use last.**|`ask(question="why does login fail when MFA is on?", project="myrepo")`|
19
+
20
+
## Rules of thumb
21
+
22
+
1.**Start with `search_code`** to turn names into ids. Most tools take a `symbol_id`.
23
+
2.**Prefer structural tools over `ask`.**`get_callers` is one cheap Cypher
24
+
hop; `ask` is two LLM round-trips. Use `ask` for fuzzy/conceptual
25
+
questions, not for "who calls X".
26
+
3.**`impact_analysis` before refactoring.** Even when you think you know
27
+
the answer — the transitive closure often surprises you.
28
+
4.**`branch` is optional** but pass it when working on a feature branch
29
+
so you query the right per-branch index.
30
+
31
+
## Environment
32
+
33
+
-`CODE_GRAPH_AUTO_INDEX=true` — auto-index CWD on first tool call (off by
34
+
default; opt-in because indexing big repos takes minutes).
35
+
-`FALKORDB_HOST` / `FALKORDB_PORT` — defaults to `localhost:6379`. If
36
+
unreachable on localhost, the server runs `cgraph ensure-db` to
0 commit comments