home / mcp / codegraph mcp server

Codegraph MCP Server

Generates and queries a graph of codebase entities and their relationships across languages.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "cartographai-mcp-server-codegraph": {
      "command": "npx",
      "args": [
        "-y",
        "@cartographai/mcp-server-codegraph",
        "/path/to/directory"
      ]
    }
  }
}

You run a Codegraph MCP Server to automatically build and query a graph of your codebase. It detects entities like functions, classes, and imports, and maps how they relate through calls, inheritance, and implementations across languages such as Python, JavaScript, and Rust. This helps you understand dependencies, large code flows, and architecture at a glance.

How to use

Start the server locally by pointing it at the directory containing your codebase. The server exposes a graph of entities and the relationships between them, which you can query from your MCP client to explore code structure, calls, and inheritance without leaving your editor.

Run the server from your command line using the following command. It uses npx to execute the MCP server package directly without a global install.

npx @cartographai/mcp-server-codegraph /path/to/directory
`

Claude Desktop configuration

If you want to integrate with Claude Desktop, add an MCP server configuration that points to the same command.

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

Available tools

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 using a given path.

list_entity_relationships

Lists the relationships of a specific entity by file path and entity name.