PKG-INFO•5.41 kB
Metadata-Version: 2.4
Name: persistent-code
Version: 0.1.0
Summary: An MCP server for maintaining code knowledge across LLM chat sessions
Home-page: https://github.com/yourusername/persistent-code-mcp
Author: Your Name
Author-email: your.email@example.com
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: mcp>=1.2.0
Requires-Dist: llama-index>=0.9.0
Requires-Dist: networkx>=3.1
Requires-Dist: sentence-transformers>=2.2.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: fastapi>=0.103.0
Requires-Dist: uvicorn>=0.23.0
Requires-Dist: python-dotenv>=1.0.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary
# Persistent-Code MCP Server
A Model Context Protocol (MCP) server that creates and maintains a knowledge graph of code generated by Claude. This allows maintaining context across sessions 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
## Installation
### Prerequisites
- Python 3.10 or higher
- UV package manager (recommended) or pip
### Setting Up
```bash
# 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
```bash
python -m persistent_code init --project-name "YourProject"
```
### Starting the Server
```bash
python -m persistent_code serve --project-name "YourProject"
```
### Configuring Claude for Desktop
1. Edit your Claude for Desktop config file:
- Location: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Add the following configuration:
```json
{
"mcpServers": {
"persistent-code": {
"command": "python",
"args": [
"-m",
"persistent_code",
"serve",
"--project-name",
"YourProject"
],
"cwd": "/absolute/path/to/persistent-code-mcp"
}
}
}
```
2. Restart Claude for Desktop
3. 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 graph
- `update_component`: Update an existing component
- `add_relationship`: Create a relationship between components
### Code Retrieval and Navigation
- `get_component`: Retrieve a component by ID or name
- `find_related_components`: Find components related to a given component
- `search_code`: Search the codebase semantically
### Status Management
- `update_status`: Update implementation status of a component
- `get_project_status`: Retrieve implementation status across the project
- `find_next_tasks`: Suggest logical next components to implement
### Context Assembly
- `prepare_context`: Assemble minimal context for a specific task
- `continue_implementation`: Provide context to continue implementing a component
- `get_implementation_plan`: Generate a plan for implementing pending components
### Code Analysis
- `analyze_code`: Analyze code and update the knowledge graph
## Example Workflow
1. Initialize a project:
```bash
python -m persistent_code init --project-name "TodoApp"
```
2. Start the server:
```bash
python -m persistent_code serve --project-name "TodoApp"
```
3. Ask Claude to design your project:
```
Can you help me design a Todo app with Python and FastAPI? Let's start with the core data models.
```
4. Claude will create components and track them in the knowledge graph
5. Continue development in a later session:
```
Let's continue working on the Todo app. What's our implementation status?
```
6. Claude will retrieve the current status and suggest next steps
7. Implement specific components:
```
Let's implement the task completion endpoint for our Todo app
```
8. Claude will retrieve relevant context and provide consistent implementation
## 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.