A Model Context Protocol server that enables seamless interaction with Code Graphs by CodeGPT
This MCP allows you to interact with the knowledge graphs available in your CodeGPT account.
You’ll be able to use these advanced graph-based queries across different MCP Hosts such as ChatGPT, Cursor, Windsurf, GitHub Copilot, Claude Desktop, and others.
list_graphs: List all available repository graphs that you have access to. Returns basic information about each graph including the graph ID, repository name with branch, and description. Use this tool when you need to discover available graphs or when CODEGPT_GRAPH_ID is not set in the environment.
get_code: Get the complete code implementation of a specific functionality (class, function, method, etc.) from the repository graph. This is the primary tool for code retrieval and should be prioritized over other tools. The repository is represented as a graph where each node contains code, documentation, and relationships to other nodes. Use this when you need to examine the actual implementation of any code entity.
find_direct_connections: Explore the immediate relationships of a functionality within the code graph. This reveals first-level connections including: parent functionalities that reference this node, child functionalities that this node directly calls or uses, declaration/definition relationships, and usage patterns. Essential for understanding code dependencies and architecture. The repository is represented as a connected graph where each node (function, class, file, etc.) has relationships with other nodes.
nodes_semantic_search: Search for code functionalities across the repository graph using semantic similarity based on natural language queries. This tool finds relevant functions, classes, methods, and other code entities that match the conceptual meaning of your query, even if they don't contain the exact keywords. Perfect for discovering related functionality, finding similar implementations, or exploring unfamiliar codebases. The search operates on the semantic understanding of code purpose and behavior.
docs_semantic_search: Search through repository documentation using semantic similarity to find relevant information, guides, API documentation, README content, and explanatory materials. This tool specifically targets documentation files (markdown, rst, etc.) rather than code, making it ideal for understanding project setup, architecture decisions, usage instructions, and conceptual explanations. Use this when you need context about how the repository works rather than examining the actual code implementation.
get_usage_dependency_links: Generate a comprehensive adjacency list showing all functionalities that would be affected by changes to a specific code entity. This performs deep dependency analysis through the code graph to identify the complete impact radius of modifications. Essential for impact analysis, refactoring planning, and understanding code coupling. The result shows which functionalities depend on the target entity either directly or through a chain of dependencies, formatted as 'file_path::functionality_name' pairs.
Before using the CodeGPT MCP Server, ensure you have:
- A CodeGPT account (sign up at app.codegpt.co)
- Uploaded a repository to Code Graph
- An API key from CodeGPT API Keys page
- Your Organization ID (optional)
- Clone the repository
- Install dependencies:
pnpm install
- Build the project:
pnpm build
Set up your environment variables, or you could add them to your MCP client configuration.
-
Copy the example environment file:
cp .env.example .env
-
Configure the required environment variables:
CODEGPT_API_KEY=your-api-key CODEGPT_ORG_ID=your-org-id # Optional CODEGPT_GRAPH_ID=your-graph-id # Optional
Add the following configuration to your MCP client:
{
"mcpServers": {
"CodeGPT": {
"command": "node",
"args": ["/path/to/build/directory", "/index.js"],
"env": {
"CODEGPT_API_KEY": "your-api-key",
"CODEGPT_ORG_ID": "optional"
}
}
}
}Add the following configuration to the claude_desktop_config.json file in your Claude Desktop installation directory:
{
"mcpServers": {
"Code Graph MCP Server": {
"command": "node",
"args": ["/path/to/build/directory", "/index.js"],
"env": {
"CODEGPT_API_KEY": "your-api-key",
"CODEGPT_ORG_ID": "optional"
}
}
}
} {
"mcpServers": {
"Code Graph MCP Server": {
"command": "node",
"args": ["/path/to/build/directory", "/index.js"],
"env": {
"CODEGPT_API_KEY": "your-api-key",
"CODEGPT_ORG_ID": "optional"
}
}
}
}Add the folloging configuration to your mcp.json file in the .vscode folder:
{
"servers": {
"Code Graph MCP Server": {
"command": "node",
"args": ["/path/to/build/directory", "/index.js"],
"env": {
"CODEGPT_API_KEY": "your-api-key",
"CODEGPT_ORG_ID": "optional"
}
}
}
}The server handles various error scenarios:
- Missing API key validation
- HTTP communication errors
- Request timeout handling
├── src/
│ └── index.ts # Main server implementation
├── build/ # Compiled JavaScript files
├── .env # Environment configuration(not included in version control)
├── .gitignore # Git ignore rules
└── package.json # Project metadata and dependencies
For support and feedback:
- Email: support@codegpt.co
- Website: app.codegpt.co