personal-mcp-server

LiadMatus/personal-mcp-server

3.2

If you are the rightful owner of personal-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Personal MCP Server is a FastAPI-based server implementing the Model Context Protocol (MCP) for streaming structured context into a persistent memory buffer, ideal for real-time syncing with LLMs like ChatGPT.

๐Ÿš€ Personal MCP Server

A unified Model Context Protocol server that bridges AI assistants with your development workflow

Python FastAPI MCP

Features โ€ข Installation โ€ข Usage โ€ข API โ€ข Deployment โ€ข Contributing


โœจ Features

๐Ÿค– MCP Protocol Support

Perfect integration with AI assistants like Claude and Cline, providing:

  • ๐Ÿ”ง Git Operations - Complete repository management with branch operations
  • ๐Ÿ“ File Management - Read, write, search, and batch operations
  • ๐Ÿ’พ Context Storage - Persistent memory with full-text search capabilities
  • ๐Ÿ—๏ธ Project Templates - Quick scaffolding for Python, React, FastAPI, and more
  • ๐Ÿค– Automatic Context Logging - Every interaction automatically logged and organized
  • ๐Ÿ” Project Discovery - Automatic detection and cataloging of all your projects

๐ŸŒ HTTP API Support

RESTful endpoints for web applications:

  • ๐Ÿ“ Context Management - Add, retrieve, and organize context streams
  • ๐Ÿ“Š Repository Updates - Specialized git workflow endpoints
  • ๐Ÿ” Health Monitoring - Server status and performance metrics
  • ๐Ÿš€ Production Ready - CORS support, error handling, and comprehensive logging

๐Ÿšข Deployment Ready

Multiple deployment options with full configuration:

  • ๐Ÿณ Docker - Production-ready containerization with health checks
  • โ˜๏ธ Cloud Platforms - Heroku, Railway, Render, DigitalOcean, GCP, AWS
  • ๐Ÿ”ง Development - Auto-reload, comprehensive testing, and debugging tools

๐Ÿš€ Installation

Prerequisites

  • Python 3.8 or higher
  • Git (for repository operations)

Quick Start

# Clone the repository
git clone https://github.com/LiadMatus/personal-mcp-server.git
cd personal-mcp-server

# Install dependencies
pip install -r requirements.txt

# Run in MCP mode (for AI assistants)
python3 mcp_server.py

# Or run in HTTP mode (for web applications)
python3 unified_mcp_server.py --http

Development Installation

# Install with development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black .

# Type checking
mypy .

๐Ÿ’ก Usage

๐Ÿ”Œ MCP Mode (AI Assistant Integration)

Perfect for Claude, Cline and other MCP-compatible AI assistants:

python3 mcp_server.py

Claude Desktop Configuration:

{
  "mcpServers": {
    "personal-mcp-server": {
      "command": "python3",
      "args": ["mcp_server.py"],
      "cwd": "/path/to/Personal-MCP-Server",
      "type": "stdio"
    }
  }
}

๐ŸŒ HTTP Mode (Web API)

For web applications and direct API access:

python3 unified_mcp_server.py --http
  • ๐Ÿ”— API Base: http://localhost:8000
  • ๐Ÿ“š Interactive Docs: http://localhost:8000/docs
  • ๐Ÿ” Health Check: http://localhost:8000/status

๐Ÿ› ๏ธ Available Tools

๐Ÿ”ง Git Operations
  • list_git_repos - Discover all repositories in common directories
  • get_repo_status - Detailed repository information with status
  • git_command - Execute any git command safely
  • git_branch - Branch management (list, create, switch, delete)
  • git_diff - View changes, diffs, and staged content
  • git_commit - Create commits with automatic staging options
๐Ÿ“ File Management
  • read_file - Read file contents with encoding detection
  • write_file - Create or update files with directory creation
  • list_directory - Browse directory contents with filtering
  • search_files - Find files by name or content with regex support
  • batch_file_operation - Bulk operations (copy, move, delete, rename)
๐Ÿ’พ Context & Memory
  • add_context - Store information in persistent context streams
  • get_context - Retrieve stored context with optional limits
  • search_context - Full-text search with date and stream filters
  • Automatic Logging - Every tool interaction automatically logged
  • Session Tracking - Unique session IDs for interaction history
๐Ÿ—๏ธ Project Templates
  • create_project_template - Scaffold new projects with best practices
  • Supported Types: Python, JavaScript, React, FastAPI, MCP Server
  • Features: Git initialization, proper .gitignore, README templates
  • Smart Detection: Automatic project type detection for existing projects

๐Ÿค– Automatic Context Features

๐Ÿ“Š Interaction Logging

Every MCP tool call is automatically logged with:

  • Tool name and sanitized arguments
  • Execution time and success/failure status
  • Result summaries (large content truncated)
  • Error messages and debugging information

๐Ÿ” Project Discovery

On startup, the server automatically:

  • Scans Documents and Desktop for git repositories
  • Detects project types (Python, JavaScript, React, Vue, etc.)
  • Catalogs technologies and configuration files
  • Creates comprehensive project profiles

๐Ÿ“‹ Context Streams

Organized context storage:

  • session_[ID] - Complete interaction history
  • project_[name] - Individual project discoveries
  • tool_[name] - Significant operations (commits, file writes)
  • system_overview - Server initialization info
  • projects_overview - All discovered projects summary

๐Ÿ“ก API Reference

Context Management

POST   /add_context           # Store new context
GET    /get_context?target=ID # Retrieve context by stream ID
DELETE /delete_context?target=ID # Remove context stream
GET    /status                # Server health and statistics

Repository Operations

POST   /repos/update_context  # Repository-specific context updates

System Information

GET    /                      # Basic server information
GET    /status                # Detailed server status with metrics

Example Status Response:

{
  "status": "ok",
  "stored_contexts": ["session_abc123", "project_my-app"],
  "total_items": 42,
  "server_uptime": "2:30:15",
  "mcp_tools": 15,
  "mcp_resources": 6
}

๐Ÿšข Deployment

๐Ÿณ Docker Deployment

# Build and run with Docker
docker build -t personal-mcp-server .
docker run -p 8000:8000 -v $(pwd)/context_data.json:/app/context_data.json personal-mcp-server

# Or use Docker Compose
docker-compose up --build

# Production with nginx
docker-compose --profile production up -d

โ˜๏ธ Cloud Deployment

Heroku
heroku create your-mcp-server
git push heroku main
Railway
railway login
railway init
railway up
Render, DigitalOcean, GCP, AWS

See our comprehensive for detailed instructions.

๐Ÿ”ง Environment Variables

  • PORT - Server port (default: 8000)
  • PYTHONUNBUFFERED - Enable immediate output
  • PYTHONDONTWRITEBYTECODE - Prevent .pyc files

๐Ÿ“ Project Structure

Personal-MCP-Server/
โ”œโ”€โ”€ ๐Ÿš€ mcp_server.py           # MCP mode entry point
โ”œโ”€โ”€ ๐ŸŒ unified_mcp_server.py   # Main server implementation
โ”œโ”€โ”€ ๐Ÿ“‹ requirements.txt        # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“ฆ setup.py               # Package configuration
โ”œโ”€โ”€ ๐Ÿ’พ context_data.json       # Persistent context storage
โ”œโ”€โ”€ ๐Ÿณ Dockerfile             # Container configuration
โ”œโ”€โ”€ ๐Ÿšข docker-compose.yml     # Multi-service setup
โ”œโ”€โ”€ ๐Ÿ“– README.md              # This documentation
โ”œโ”€โ”€ ๐Ÿš€ DEPLOYMENT.md          # Deployment guide
โ”œโ”€โ”€ ๐Ÿค CONTRIBUTING.md        # Contribution guidelines
โ”œโ”€โ”€ ๐Ÿ“„ LICENSE                # MIT license
โ”œโ”€โ”€ ๐Ÿ“‹ Procfile               # Heroku deployment config
โ”œโ”€โ”€ ๐Ÿ“š UNIFIED_SERVER_GUIDE.md # Additional server documentation
โ””โ”€โ”€ ๐Ÿงช tests/                 # Test suite
    โ”œโ”€โ”€ __init__.py
    โ””โ”€โ”€ test_context_store.py

๐Ÿงช Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=. --cov-report=html

# Run specific test file
pytest tests/test_context_store.py

# Test with different Python versions
tox

๐Ÿ”ง Development

Local Development

# Run with auto-reload
uvicorn unified_mcp_server:app --reload --host 0.0.0.0 --port 8000

# Run MCP mode with debugging
python3 mcp_server.py

# Format code
black .

# Lint code
flake8 .

# Type checking
mypy .

Development Tools

  • Black - Code formatting
  • flake8 - Linting
  • mypy - Type checking
  • pytest - Testing framework
  • coverage - Test coverage reporting

๐Ÿ“Š Monitoring & Health Checks

Health Endpoint

curl http://localhost:8000/status

Docker Health Checks

Built-in health checks monitor:

  • Server responsiveness
  • Context storage functionality
  • MCP tool availability
  • Resource accessibility

Logging

Comprehensive logging with:

  • Structured log format
  • Error tracking and debugging
  • Performance metrics
  • Interaction history

๐Ÿ”’ Security & Best Practices

Security Features

  • Content Sanitization - Large content automatically truncated
  • Input Validation - Pydantic models for all API inputs
  • Error Handling - Graceful error responses without data leaks
  • CORS Configuration - Configurable cross-origin policies

Production Considerations

  • Use environment variables for sensitive configuration
  • Enable HTTPS in production deployments
  • Configure appropriate CORS origins
  • Set up monitoring and alerting
  • Regular backups of context data

๐Ÿค Contributing

We welcome contributions! Please see our for details.

Quick Contribution Steps

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with tests
  4. Run the test suite (pytest)
  5. Format your code (black .)
  6. Submit a pull request

Development Setup

# Clone your fork
git clone https://github.com/YOUR_USERNAME/personal-mcp-server.git
cd personal-mcp-server

# Install development dependencies
pip install -e ".[dev]"

# Run tests to ensure everything works
pytest

๐Ÿ“„ License

This project is licensed under the MIT License - see the file for details.


๐Ÿ™ Acknowledgments

  • MCP Protocol - Model Context Protocol
  • FastAPI - Modern, fast web framework for building APIs
  • Claude & Cline - AI assistants that inspired this integration
  • Contributors - Everyone who has contributed to this project

Built with โค๏ธ by Liad Matusovsky

Empowering AI assistants with powerful development tools

โญ Star this repo if you find it useful! โญ