Get the FREE Ultimate OpenClaw Setup Guide →

codegraph

Always-fresh code dependency graph — sub-second incremental rebuilds, function-level tracing across 11 languages, 20-tool MCP server for AI agents, git diff impact with co-change analysis, A→B pathfinding, node role classification, local semantic search. Zero API keys required.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio optave-codegraph npx -y @optave/codegraph

How to use

codegraph is an MCP server that exposes a machine-readable map of your codebase as a navigable graph. It builds a function-level dependency graph across your codebase and makes it accessible to AI agents via a set of 30 tooling commands designed for code understanding, auditing, and impact analysis. Agents can query the graph to discover callers, dependencies, and test coverage, enabling powerful, context-rich interactions without re-grepping the repository. When run as an MCP server, codegraph serves these capabilities over the MCP protocol, so automated tools can integrate discovery and validation workflows directly into their agent pipelines.

To use it, install the MCP server and start it in your environment. The server exposes a rich command surface for exploration and analysis, including commands for impact assessment, context retrieval, and structured queries over the graph. This enables agents to request precise slices of the code graph—such as callers of a function, files impacted by a change, or tests related to a module—without requiring bespoke tooling per project. The result is faster, more reliable AI-driven code comprehension and safer, more informed edits in large codebases.

How to install

Prerequisites:

  • Node.js v20 or newer installed on your machine
  • npm (comes with Node.js) or pnpm/yarn as preferred

Installation steps:

  1. Install the MCP server globally (recommended for quick starts):
npm install -g @optave/codegraph
  1. Verify installation and run a quick help to confirm the CLI is available:
codegraph --help
  1. Start the MCP server (example usage via npx is also supported as the MCP command wrapper):
# If you installed globally
codegraph server --port 4242

# Alternatively, using npx (no global install)
npx -y @optave/codegraph server --port 4242
  1. Connect an MCP client to the running server using the provided host/port (default localhost:4242).

Additional notes

Notes and tips:

  • This MCP server emphasizes local analysis with zero external dependencies beyond the Graph build itself. There are no required API keys or cloud services.
  • If you run behind a corporate proxy, ensure your environment variables (HTTP_PROXY/HTTPS_PROXY) are properly configured for npm and Node.
  • Common env vars to consider when running in different environments include PORT (server port), HOST (binding address), and LOG_LEVEL (debug/info/warn/error).
  • If the graph needs to rebuild after code changes, ensure the filesystem watcher is active and that the codebase is accessible with sufficient I/O permissions. Check for sub-second incremental rebuilds as advertised in the project.
  • When integrating with agents, you can adjust the MCP endpoint and authentication method according to your security requirements (the MCP layer itself in Codegraph is typically intended to be used in trusted, local or isolated environments).

Related MCP Servers

Sponsor this space

Reach thousands of developers