This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Model Context Protocol (MCP) server that provides seamless interaction with CodeGPT's Code Graphs. The server enables semantic code search, dependency analysis, and code retrieval across repository knowledge graphs.
# Build the project
npm run build
# Build and watch for changes during development
npm run watch
# Test the MCP server locally
node dist/index.js
# Debug MCP server with wrapper
node debug-mcp.js- src/index.ts: Main MCP server implementation with all tool definitions
- debug-mcp.js: Wrapper script for debugging ES module compatibility
- dist/: Compiled JavaScript output (generated by TypeScript)
The server implements 6 main tools for interacting with CodeGPT's knowledge graphs:
- list-graphs: Lists available repository graphs (only when CODEGPT_GRAPH_ID not set)
- get-code: Retrieves complete code implementation of functionalities
- find-direct-connections: Explores immediate relationships in the code graph
- nodes-semantic-search: Semantic search for code functionalities
- docs-semantic-search: Semantic search through documentation
- get-usage-dependency-links: Deep dependency analysis for impact assessment
The server uses environment variables for configuration:
CODEGPT_API_KEY(required): API key for CodeGPT serviceCODEGPT_ORG_ID(optional): Organization IDCODEGPT_GRAPH_ID(optional): Specific graph ID
Arguments can also be passed via command line in order: API_KEY, ORG_ID, GRAPH_ID.
- Uses
@modelcontextprotocol/sdkfor MCP protocol implementation - Implements dynamic schema generation based on environment variables
- Includes extensive error handling and logging
- TypeScript with ES2022 target and NodeNext modules
- Communicates with CodeGPT API at
https://api-mcp.codegpt.co/api/v1
The package is published to npm as mcp-code-graph with binary entry point at dist/index.js.