
sparshdrolia/persistent-code-mcp
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
A Model Context Protocol (MCP) server that creates and maintains a semantic knowledge graph of code generated by Claude.
Обзор
A Model Context Protocol (MCP) server that creates and maintains a semantic knowledge graph of code generated by Claude. Powered by LlamaIndex, this allows maintaining context across sessions with advanced semantic search capabilities without requiring the entire codebase to be present in the context window. When developing software with Claude: - Context windows are limited, making it difficult to work with large codebases - Previous code context is lost between sessions - Claude lacks persistent understanding of project structure - Redundant explanation of code is required in each session - Maintaining implementation consistency is challenging Persistent-Code solves these problems by: - Creating a knowledge graph of code components and their relationships - Tracking implementation status of each component - Providing tools to navigate, query, and understand the codebase - Assembling minimal necessary context for specific coding tasks - Maintaining persistent knowledge across chat...
README
Показан фрагмент оригинального README. Открыть оригинал.
Persistent-Code MCP Server with LlamaIndex
A Model Context Protocol (MCP) server that creates and maintains a semantic knowledge graph of code generated by Claude. Powered by LlamaIndex, this allows maintaining context across sessions with advanced semantic search capabilities without requiring the entire codebase to be present in the context window.
Problem & Solution
When developing software with Claude:
- Context windows are limited, making it difficult to work with large codebases
- Previous code context is lost between sessions
- Claude lacks persistent understanding of project structure
- Redundant explanation of code is required in each session
- Maintaining implementation consistency is challenging
Persistent-Code solves these problems by:
- Creating a knowledge graph of code components and their relationships
- Tracking implementation status of each component
- Providing tools to navigate, query, and understand the codebase
- Assembling minimal necessary context for specific coding tasks
- Maintaining persistent knowledge across chat sessions
LlamaIndex Integration
Persistent-Code leverages LlamaIndex to provide enhanced semantic understanding:
- Semantic Search: Find code components based on meaning, not just keywords
- Vector Embeddings: Code is embedded into vector space for similarity matching
- Knowledge Graph: Relationships between components are tracked semantically
- Contextual Retrieval: Related code is retrieved based on semantic relevance
This integration allows Claude to understand your codebase at a deeper level:
- Find functions based on what they do, not just what they’re called
- Get more relevant code components when preparing context
- Better understand the relationships between components
- More accurately retrieve examples of similar implementations
Installation
Prerequisites
- Python 3.10 or higher
- UV package manager (recommended) or pip
Setting Up
# Clone repository
git clone https://github.com/your-username/persistent-code-mcp.git
cd persistent-code-mcp
# Set up environment with UV
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -r requirements.txt
# Or with pip
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Usage
Initializing a Project
python -m persistent_code init --project-name "YourProject"
Starting the Server
python -m persistent_code serve --project-name "YourProject"
Configuring Claude for Desktop
- Edit your Claude for Desktop config file:
- Location:
~/Library/Application Support/Claude/claude_desktop_config.json - Add the following configuration:
- Location:
{
"mcpServers": {
"persistent-code": {
"command": "path to python in venv",
"args": [
"-m",
"persistent_code",
"serve",
"--project-name",
"default"
],
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →Конфигурация
{
"mcpServers": {
"persistent-code": {
"command": "path to python in venv",
"args": [
"-m",
"persistent_code",
"serve",
"--project-name",
"default"
],
"cwd": "persistent-code-mcp",
"env": {
"PYTHONPATH": "abs path to persistent-code-mcp"
}
}
}
}