CodeGraph is a debugging tool that uses graph database and LLM to simplify on-call debugging in microservice architectures. First, it creates a mapping of relationships between microservices down to the expression level. Secondly, it prepare a strategy to debug from trace to code level. Then, it provides an MCP interface for clients like Claude Desktop, Cline, or Roo Code to interact with a microservice code and traces.
There are 3 layers in this architecture:
-
Graph-Based Service Mapping/ Code-Level Relationship Tracking
- Automatically scans and analyzes microservice ecosystem
- Creates a directed graph representing service dependencies and interactions
- Maps specific functions and lines responsible for service interactions
- Maps both direct (API calls) and indirect (message queue) relationships
- Tracks configuration dependencies between services
- Maintains versioned snapshots of service relationships over time
-
Root Cause Analysis
- Based on the graph structure to trace error propagation paths
- Provides context-aware debugging suggestions
- Generates human-readable explanations of complex failure scenarios
-
Real-Time Monitoring and Updates
- Continuously monitors service health and communication patterns
- Updates the graph database as services evolve
- Detects and flags potential breaking changes
- Maintains historical context for debugging similar issues
Target:
- Reduce MTTR for production incidents
- Understand the full impact of service changes before deployment
- Identify potential failure points in the service architecture
- Make data-driven decisions about service dependencies
CodeGraph consists of three main components:
-
Graph Extractor
- Analyzes microservice codebases
- Extracts dependency information
- Constructs relationship graphs
- Implements smart filtering logic
-
Graph Database
- Stores service relationships
- Maintains code-level connections
- Enables fast traversal and querying
- Supports real-time updates
-
MCP Server
- Provide interface for LLM to query
- Bun / Node 20
- pnpm (v8 or higher)
- Podman / Docker and Docker Compose
The project consists of the following components:
- common: Shared types, utilities, and functions used across the project
- graph-extractor: Extracts code structure information from source code and builds the graph representation
- server: Provides an MCP server for interacting with the graph data
- infra: Contains infrastructure as code for deployment
The project includes an MCP (Model Context Protocol) server that provides tools and resources for code structure analysis. This allows AI assistants to directly interact with the code structure graph.
pnpm dev
query_graph: Execute a Cypher query against the code structure graphextract_code_structure: Extract code structure from a codebase
graph://structure/overview: Overview of the code structure graphgraph://structure/node/{id}: Details of a specific node in the graphgraph://structure/relationships/{type}: Relationships of a specific type in the graph
pnpm test
pnpm lint
pnpm format
pnpm build
pnpm clean