Codegraph MCP Server

MCP server for graph representation of a codebase

Local serverstdioPython

What is the Codegraph MCP server?

Codegraph MCP server is a locally run integration for AI assistants that speak the Model Context Protocol. MCP server for graph representation of a codebase.

What you get

A Model Context Protocol server that provides tools to generate and query a graph representation in your codebase.

  • 📊 Creates a graph representation of your codebase
  • 🔍 Identifies entities (functions, classes, imports) and their relationships
  • 🔗 Tracks relationships like function calls, inheritance, and implementations
  • 🌐 Supports multiple programming languages (Python, JavaScript, Rust)

What the assistant can call

Once Codegraph is connected, these are the calls the assistant has available:

  • index — Indexes the codebase to create a graph of entities and relationships
  • list_file_entities — Provides a list of all entities within a specified file
  • list_entity_relationships — List the relationships of a specific entity
  • Inputs — path (string): relative path of the file

Setting it up

@cartographai/mcp-server-codegraph on npm is all you need. Most clients run it directly, so configuration is a few lines and a restart.

Choosing this one

Among the developer tooling options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. Codegraph's toolset — index, list_file_entities, list_entity_relationships and 1 more — is a fair guide to whether it matches your workflow. It is maintained by CartographAI; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the codegraph mcp server does with a few real requests.

Available tools

ToolWhat it does
indexIndexes the codebase to create a graph of entities and relationships.
list_file_entitiesProvides a list of all entities within a specified file.
list_entity_relationshipsList the relationships of a specific entity
Inputspath (string): relative path of the file

How to install the Codegraph MCP server

{
  "mcpServers": {
    "server-codegraph": {
      "command": "npx",
      "args": ["-y", "@cartographai/mcp-server-codegraph"]
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Example prompts to try

  • Use Codegraph to index.
  • Use Codegraph to list file entities.
  • Use Codegraph to list entity relationships.

Frequently asked questions

It connects Codegraph to MCP-compatible AI assistants such as Claude and Cursor, exposing 4 tools (index, list_file_entities, list_entity_relationships, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Codegraph directly.