-
Notifications
You must be signed in to change notification settings - Fork 51
MCP-T13 + T14: cgraph init-agent + Docker dual-mode #683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0337331
MCP-T13 + T14: cgraph init-agent + Docker mode switch
DvirDukhan 2b22c67
MCP smoke harness + template fixes from end-to-end run
DvirDukhan d5deee2
docs(mcp): reconcile agent guidance + smoke to the real tool surface
DvirDukhan ac97cba
fix(mcp): address PR #683 review comments
DvirDukhan 2c2e667
Merge branch 'staging' into dvirdukhan/mcp-t13-t14-packaging
galshubeli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # code-graph MCP server — agent guidance | ||
|
|
||
| This repo is indexed into a FalkorDB **code knowledge graph** exposed | ||
| to you over MCP as `code-graph`. Use it instead of grepping when you | ||
| need to understand how symbols connect. | ||
|
|
||
| ## When to call each tool | ||
|
|
||
| | Tool | Call this when… | Example | | ||
| |---|---|---| | ||
| | `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=".")` | | ||
| | `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")` | | ||
| | `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")` | | ||
| | `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")` | | ||
| | `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")` | | ||
| | `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)` | | ||
| | `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")` | | ||
|
|
||
| ## Rules of thumb | ||
|
|
||
| 1. **Start with `search_code` or `find_symbol`** to turn names into ids. Most tools take a `symbol_id`. | ||
| 2. **Use `get_neighbors` with `direction`** for who-calls / what-calls: `IN` = callers, `OUT` = callees. Pass `relation` for IMPORTS/DEFINES edges. | ||
| 3. **`impact_analysis` before refactoring.** Even when you think you know | ||
| the answer — the transitive closure often surprises you. | ||
| 4. **`branch` is optional** but pass it when working on a feature branch | ||
| so you query the right per-branch index. | ||
| 5. **Response shape.** Tools that return collections (`search_code`, | ||
| `find_symbol`, `get_neighbors`, `get_file_neighbors`, `find_path`, | ||
| `impact_analysis`) put the array in `structuredContent.result` per | ||
| the MCP spec. The text content is the same JSON for convenience. | ||
| `index_repo` returns a single object. | ||
|
|
||
| ## Environment | ||
|
|
||
| - `CODE_GRAPH_AUTO_INDEX=true` — auto-index CWD on first tool call (off by | ||
| default; opt-in because indexing big repos takes minutes). | ||
| - `FALKORDB_HOST` / `FALKORDB_PORT` — defaults to `localhost:6379`. If | ||
| unreachable on localhost, the server runs `cgraph ensure-db` to | ||
| spin up the official Docker image. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Cursor rules — code-graph MCP | ||
|
|
||
| This project is indexed into a FalkorDB code knowledge graph via the | ||
| `code-graph` MCP server. Use it instead of grepping when you need to | ||
| understand how symbols connect. | ||
|
|
||
| ## Tool selection | ||
|
|
||
| - Symbol lookup by name: use `code-graph.search_code` (hybrid prefix + | ||
| ranked match) or `code-graph.find_symbol` for an exact name — both give | ||
| you the numeric id every other tool needs. | ||
| - "Who calls X?": `code-graph.get_neighbors` with `direction="IN"`. | ||
| - "What does X call?": `code-graph.get_neighbors` with `direction="OUT"`. | ||
| - Other edges (IMPORTS / DEFINES): `code-graph.get_neighbors` with the | ||
| matching `relation`. | ||
| - What a file defines/touches: `code-graph.get_file_neighbors`. | ||
| - Refactoring impact ("what breaks if I change X"): | ||
| `code-graph.impact_analysis` with `direction="IN"`. | ||
| - Call chain between two specific symbols: `code-graph.find_path`. | ||
|
|
||
| ## Rules | ||
|
|
||
| - Always `search_code`/`find_symbol` first to resolve names to ids. | ||
| - Use `get_neighbors(direction=...)` for "who/what calls" questions. | ||
| - Run `impact_analysis(direction="IN", depth=3)` before any non-trivial | ||
| refactor. | ||
| - Pass `branch` when on a feature branch. | ||
|
|
||
| ## First run | ||
|
|
||
| If the repo isn't indexed yet, call `index_repo(path=".")` once. After | ||
| that, navigate via the structural tools. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.