mcpField
C
code-graph

code-graph

github.com/falkordbDevelopment35060 installsUpdated 3d ago
Repository

About code-graph

code-graph is a skill for managing the cgraph database, indexing code repositories, and querying code structure. It helps coding agents inspect definitions, relationships, and call paths without requiring users to run cgraph commands themselves.

Key features

  1. 01Create and maintain repository indexes
  2. 02Search code entities by name prefix
  3. 03Explore node neighbors and relationships
  4. 04Trace function call paths
  5. 05List repositories and view index stats

Use cases

  1. 01Find a function or class in an indexed codebase
  2. 02Inspect what a function calls or defines
  3. 03Trace how one function reaches another
  4. 04Check which repositories are indexed

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/falkordb/code-graph --skill code-graph

After installing, type/code-graphin Claude Code to confirm it loaded.

Bundled filesreferences/management.mdreferences/querying.md

Details

From the project README

Code Graph Skill

You own the full cgraph lifecycle: database, indexing, and querying. The user should never need to run cgraph commands manually.

Ownership Rules

  • If cgraph commands fail with connection errors, run cgraph ensure-db first.
  • If cgraph is not found, see management.md for installation instructions.
  • Index at session start or after significant code changes: cgraph index . --ignore node_modules --ignore venv --ignore .git --ignore __pycache__
  • No need to re-index between consecutive queries if no code has changed.
  • All command output is JSON on stdout. Status/progress goes to stderr.
  • --repo defaults to the current directory name if omitted.

Indexing

# Index the current project
cgraph index . --ignore node_modules --ignore venv --ignore .git --ignore __pycache__

# Index a specific folder with a custom name
cgraph index /path/to/project --repo my-project --ignore node_modules

# Clone and index a remote repository
cgraph index-repo https://github.com/org/repo --ignore node_modules

Searching

# Search for entities by prefix
cgraph search get_user
cgraph search parse
cgraph search MyClass

Results return JSON with node id, labels (File, Class, Function, etc.), and properties (name, path, src_start, src_end). Use the id for follow-up queries.

Exploring Relationships

# Get all neighbors of a node
cgraph neighbors 42 --repo my-project

# Filter by relationship type
cgraph neighbors 42 --rel CALLS          # what does it call?
cgraph neighbors 42 --rel DEFINES         # what does it define?

# Filter by destination label
cgraph neighbors 42 --label Function      # only function neighbors

# Multiple nodes at once
cgraph neighbors 42 55 --repo my-project

Finding Paths

# Trace call-chain paths between two nodes
cgraph paths 42 99 --repo my-project

Follows CALLS edges to find how one function reaches another.

Repository Info

# List all indexed repos
cgraph list

# Show stats for a repo
cgraph info --repo my-project

Working with Results

  • Search results include path, src_start, src_end — use the Read tool to load the actual source code at those locations.
  • Node labels: File, Class, Function, Interface, Struct
  • Edge types: DEFINES (hierarchy), CALLS (call graph), EXTENDS (inheritance), IMPLEMENTS (interfaces), RETURNS (return types), PARAMETERS (param types)
  • See querying.md for detailed JSON structures and common query patterns.

Comments

Markdown supported