A code indexing system accessible via MCP (Model Context Protocol)
npm install code-graph-mcpA code indexing system that creates searchable code graphs accessible via MCP (Model Context Protocol) for LLM consumption.
- 🔍 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
``bash`
npx code-graph-mcp
1. Configure Repositories: Edit config/repos.json to specify which repositories to index:
`json`
{
"repositories": [
{
"url": "https://github.com/your-org/your-repo",
"name": "your-repo",
"priority": "high"
}
]
}
2. Index Repositories (automatically syncs and indexes):
`bash`
npx code-graph-mcp index
3. Start MCP Server:
`bash`
npx code-graph-mcp start
- 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
- 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
The config/repos.json file defines which repositories to index:
`json`
{
"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"
}
}
`bash`
npm run build
`bash`
npm run dev
`bash``
npm test
MIT