code-graph-mcp
v0.2.6
Published
A code indexing system accessible via MCP (Model Context Protocol)
Maintainers
Readme
Code Graph MCP Server
A code indexing system that creates searchable code graphs accessible via MCP (Model Context Protocol) for LLM consumption.
Features
- 🔍 Semantic Code Search - Search across multiple repositories with context
- 📊 Code Graph Analysis - Understand relationships between functions, classes, and modules
- 🚀 Fast Indexing - Targeted repository indexing for relevant codebases only
- 🔌 MCP Integration - Direct LLM access via Model Context Protocol
- 🛠️ Multi-Language Support - TypeScript, JavaScript, Python, Go, Rust, Java via Tree-sitter
- 📱 Cross-Platform - Works on Windows, macOS, and Linux
Quick Start
Installation
npx code-graph-mcpSetup
- Configure Repositories: Edit
config/repos.jsonto specify which repositories to index:
{
"repositories": [
{
"url": "https://github.com/your-org/your-repo",
"name": "your-repo",
"priority": "high"
}
]
}- Index Repositories (automatically syncs and indexes):
npx code-graph-mcp index- Start MCP Server:
npx code-graph-mcp startArchitecture
Core Components
- Repository Manager - Clone and manage repositories from config list
- Code Parser - Extract symbols, AST, relationships using tree-sitter
- Graph Database - Store code relationships in SQLite
- Search Engine - Semantic and structural code search
- MCP Server - Protocol interface for LLM access
- CLI Interface - Management and configuration tools
MCP Tools Available
search_code- Semantic code search across repositoriesfind_references- Find symbol usage and referencesget_call_graph- Trace function calls and dependenciesanalyze_dependencies- File/module dependency analysisget_symbol_info- Symbol definitions and documentationexplore_codebase- High-level structure analysis
Configuration
Repository Configuration
The config/repos.json file defines which repositories to index:
{
"repositories": [
{
"url": "https://github.com/microsoft/vscode",
"name": "vscode",
"priority": "high",
"branch": "main",
"include": ["src/**/*.ts"],
"exclude": ["node_modules/**", "**/*.test.*"]
}
],
"settings": {
"maxFileSize": "1MB",
"indexBinaryFiles": false,
"languages": ["typescript", "javascript", "python"],
"updateInterval": "1h"
}
}Development
Build
npm run buildDevelopment Mode
npm run devTesting
npm testLicense
MIT
