Integrations
Used in the example workflow to design and implement a Todo app, with the MCP server tracking components and providing consistent implementation guidance.
Offers code component management for Python projects, including semantic search, relationship tracking, and implementation status monitoring across development sessions.
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
Usage
Initializing a Project
Starting the Server
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:
- Restart Claude for Desktop
- Connect to your MCP server by asking Claude about your code
Available Tools
Knowledge Graph Management
add_component
: Add a new code component to the graphupdate_component
: Update an existing componentadd_relationship
: Create a relationship between components
Code Retrieval and Navigation
get_component
: Retrieve a component by ID or namefind_related_components
: Find components related to a given componentsearch_code
: Search the codebase semantically
Status Management
update_status
: Update implementation status of a componentget_project_status
: Retrieve implementation status across the projectfind_next_tasks
: Suggest logical next components to implement
Context Assembly
prepare_context
: Assemble minimal context for a specific taskcontinue_implementation
: Provide context to continue implementing a componentget_implementation_plan
: Generate a plan for implementing pending components
Code Analysis
analyze_code
: Analyze code and update the knowledge graph
Example Workflow
- Initialize a project:Copy
- Start the server:Copy
- Ask Claude to design your project:Copy
- Claude will create components and track them in the knowledge graph
- Continue development in a later session:Copy
- Claude will retrieve the current status and suggest next steps
- Implement specific components:Copy
- Claude will retrieve relevant context and provide consistent implementation
Using Semantic Search
With the LlamaIndex integration, you can now use more natural language to find components:
Claude will use semantic search to find relevant components, even if they don't explicitly contain the words "task completion".
Running the LlamaIndex Demo
We've included a demo script to showcase the semantic capabilities:
This will demonstrate analyzing a Calendar application and performing semantic searches for functionality.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
This server cannot be installed
Creates and maintains a semantic knowledge graph of code that allows maintaining context across sessions with Claude, providing advanced search capabilities without requiring the entire codebase in the context window.