A Model Context Protocol (MCP) server for tracking and managing multiple projects with Claude Code.
- Project Tracking: Track multiple projects with context preservation
- Metadata Storage: Store project metadata including git branch, automation status, and active tasks
- Project Search: Search and filter projects by name, path, or type
- Service Discovery: Automatically discover project-specific tracking services and automation daemons
- Database Queries: Query project tracking databases directly
- Project Switching: Optional integration with external project managers for seamless switching
- Context Preservation: Maintain context when switching between projects
pip install -r requirements.txtpython3 setup.pyThe setup script will:
- Create a
config.jsonfile with your preferences - Initialize the SQLite database with the proper schema
- Create necessary directories
- Generate a README file
Add the MCP server to your Claude Code configuration file (usually ~/.claude_code_mcp.json):
{
"mcpServers": {
"project-tracker": {
"command": "python3",
"args": ["/absolute/path/to/mcp-project-tracker/src/server.py"]
}
}
}Replace /absolute/path/to/ with the actual path to your installation.
The config.json file contains all settings. See config.example.json for detailed documentation.
{
"database": {
"path": "/home/username/.mcp_project_tracker.db"
},
"projects": {
"root_directory": "/home/username/Projects",
"auto_discover": true
},
"project_manager": {
"enabled": false,
"script_path": ""
},
"tracking": {
"auto_track_daemons": true,
"track_git_branches": true,
"track_automation_status": true
}
}- database.path: Full path to the SQLite database file (will be created if it doesn't exist)
- projects.root_directory: Root directory where your projects are stored
- projects.auto_discover: Automatically discover and track projects in the root directory
- project_manager.enabled: Enable integration with an external project manager script
- project_manager.script_path: Path to your project manager script (if enabled)
- tracking.auto_track_daemons: Automatically detect automation daemons in projects
- tracking.track_git_branches: Track and store git branch information
- tracking.track_automation_status: Track automation status and active tasks
Once configured with Claude Code, you can use the following MCP tools:
-
list_projects
- Lists all tracked projects with their status, automation state, git branch, and last accessed time
- Returns: Array of projects with metadata
-
get_project_context
- Gets detailed context for a specific project
- Parameters:
project_path(string) - Returns: Full project context including tasks, git info, and metadata
-
switch_project
- Switches to a different project, preserving context
- Parameters:
project_path(string) - Returns: Success status and project information
-
get_project_stats
- Gets statistics about all tracked projects
- Returns: Counts by type, automation coverage, recently accessed projects
-
search_projects
- Searches for projects by name, path, or type
- Parameters:
query(string) - Returns: Matching projects
-
get_recent_switches
- Gets recent project context switches
- Parameters:
limit(number, optional, default: 10) - Returns: Array of recent switches with timestamps and reasons
-
update_project_context
- Updates or saves context for a specific project
- Parameters:
project_path(string),context_data(object) - Returns: Success status
-
discover_project_services
- Discovers tracking services and databases within a specific project
- Parameters:
project_path(string) - Returns: List of discovered services (daemons, databases, state files)
-
scan_all_services
- Scans all tracked projects to discover their tracking services
- Returns: Summary of all projects with services
-
query_tracking_database
- Queries a project-specific tracking database
- Parameters:
db_path(string),query(string, optional) - Returns: Schema information and query results
Stores project metadata and context information:
| Column | Type | Description |
|---|---|---|
| project_path | TEXT (PRIMARY KEY) | Full path to the project |
| project_name | TEXT | Human-readable project name |
| project_type | TEXT | Type of project (e.g., "python", "web", "nodejs") |
| last_accessed | TEXT | ISO timestamp of last access |
| automation_status | TEXT | Automation status (e.g., "active", "inactive") |
| git_branch | TEXT | Current git branch |
| active_tasks | TEXT (JSON) | Array of active tasks |
| context_data | TEXT (JSON) | Additional context data |
| mcp_session_id | TEXT | MCP session identifier |
| created_at | TEXT | ISO timestamp of creation |
Indexes:
idx_last_accessedonlast_accessed DESCidx_project_typeonproject_type
Tracks context switches between projects:
| Column | Type | Description |
|---|---|---|
| id | INTEGER (PRIMARY KEY) | Auto-incrementing ID |
| from_project | TEXT | Source project path |
| to_project | TEXT | Destination project path |
| switch_time | TEXT | ISO timestamp of switch |
| context_preserved | INTEGER | 1 if context was preserved, 0 otherwise |
| switch_reason | TEXT | Reason for the switch |
Indexes:
idx_switch_timeonswitch_time DESC
Once configured, you can ask Claude Code:
- "List all my tracked projects"
- "Switch to the web-app project"
- "Show me recent project switches"
- "What services are running in my backend project?"
- "Search for all Python projects"
- "Update the context for my current project with this task list"
If you have an external project manager script, you can integrate it:
- Set
project_manager.enabledtotrueinconfig.json - Set
project_manager.script_pathto your script's path - Your script should accept
--switch <project_path>arguments
Example script interface:
python3 /path/to/project_manager.py --switch /path/to/projectThe tracker can automatically discover:
- Automation daemons (
.automation/auto_track_daemon.py) - Tracking databases (
tracking.db,.automation/tracking.db,frontend/tracking.db) - Development state files (
.automation/state/development_state.json)
Use discover_project_services to scan a specific project or scan_all_services to scan all tracked projects.
You can query any SQLite database within your projects:
{
"db_path": "/path/to/project/tracking.db",
"query": "SELECT * FROM commits ORDER BY timestamp DESC LIMIT 10"
}If no query is provided, the tool returns the database schema and sample data from each table.
- Run
python3 setup.pyto initialize the database - Check that
database.pathinconfig.jsonis correct
- Use
update_project_contextto manually add a project - Enable
auto_discoverinconfig.json - Verify
projects.root_directoryis correct
- Ensure the database path is writable
- Check that project directories are accessible
mcp-project-tracker/
├── src/
│ └── server.py # MCP server implementation
├── config.json # Your configuration (created by setup)
├── config.example.json # Example configuration with documentation
├── setup.py # Interactive setup script
├── requirements.txt # Python dependencies
└── README.md # This file
- mcp (>=1.0.0): Model Context Protocol SDK
- sqlite3: Database storage (included with Python)
- json: Configuration and serialization (included with Python)
- pathlib: Path handling (included with Python)
MIT License - feel free to modify and distribute.
This is a generic version designed to be customizable for any workflow. Feel free to:
- Add new tracking features
- Extend the database schema
- Create custom integrations
- Share your improvements
For issues or questions:
- Check the configuration in
config.json - Review the database schema
- Verify Claude Code MCP configuration
- Check file permissions and paths