Knowledge Graph MCP Server
A high-performance, lightweight Knowledge Graph MCP server for code analysis, optimized for Apple Silicon.
Features
Fast Indexing: Optimized for Apple Silicon (MLX) and multi-core CPUs
Smart Incremental Indexing: Content hashing skips unchanged files (instant re-indexing)
Smart Scope: Automatically ignores dependencies (node_modules, venv, target, etc.)
Hybrid Search: Semantic + exact keyword search
Graph Analysis: Understand code relationships (definitions, references, calls)
Multi-Language: Python, JavaScript, TypeScript, Java, Go
Installation
MCP Client Configuration
Add to your MCP client (e.g., Claude Desktop) configuration:
Available Tools
The server exposes 8 tools that LLMs can use for code analysis:
1. reindex_codebase
Purpose: Index a codebase to enable all other tools.
Parameters:
project_root_path(string): Absolute or relative path to the project directory
LLM Usage:
Returns: Indexing statistics (files processed, nodes/edges created, time taken)
2. search_code
Purpose: Search for code using hybrid semantic + keyword search with optional filtering.
Parameters:
query(string): Search query (concept or exact name)limit(int, default=5): Maximum results to returnfile_type(string, optional): Filter by file extension (e.g., "py", "java", "ts")
LLM Usage:
Returns: List of matching code snippets with:
File path and line numbers
Code content
Match type (semantic or keyword)
Confidence score (0.0-1.0, where 1.0 = 100% match)
3. get_structure
Purpose: Get the structure of a file (imports, classes, functions, methods).
Parameters:
file_path(string): Path to the file
LLM Usage:
Returns: Structured JSON with:
imports: List of import statementsdefinitions: Classes and functions with:Nested methods (for classes)
Line numbers
Docstrings
4. find_definitions
Purpose: Find where a symbol (function, class, variable) is defined.
Parameters:
symbol_name(string): Name of the symbol to find
LLM Usage:
Returns: List of definitions with file paths, line numbers, and code snippets
5. find_references
Purpose: Find where a symbol is called/used in the codebase.
Parameters:
name(string): Name of the symbol
LLM Usage:
Returns: List of call sites with:
Source file and line number
Caller name
Target file and type
6. get_file_summary
Purpose: Get a summary of a file's contents.
Parameters:
file_path(string): Path to the file
LLM Usage:
Returns: File summary with:
Total lines
Top-level structure (classes, functions)
7. get_usage_context
Purpose: Get the full context for a symbol (definition + usage).
Parameters:
symbol_name(string): Name of the symbol
LLM Usage:
Returns: Combined information:
Where it's defined (with code)
Where it's used (with surrounding context)
8. validate_edit
Purpose: Validate code syntax before making changes (supports Python, JavaScript, TypeScript, Java, Go).
Parameters:
file_path(string): Path to the filenew_content(string): Proposed new content
LLM Usage:
Returns: Validation result:
valid: true/falseerrors: List of syntax errors (if any)
Example Workflows
Initial Setup
Code Exploration
Refactoring
Performance
Indexing Speed: ~500 files/s (initial), ~3500 files/s (incremental)
Search Speed: <100ms for most queries
Languages: Python, JavaScript, TypeScript, Java, Go
Smart Scope: Auto-excludes ~3000+ dependency files
License
MIT License - see LICENSE for details
This server cannot be installed