A powerful Model Context Protocol (MCP) service that enables Claude to intelligently explore, understand, and analyze Python projects. This service provides Claude with comprehensive tools to navigate codebases, analyze dependencies, search code patterns, and understand project structure automatically.
- Intelligent Project Discovery: Automatically identifies Python projects and their structure
- Comprehensive Code Analysis: Reads and analyzes Python files, configurations, and documentation
- Dependency Mapping: Extracts and analyzes dependencies from various requirement files
- Smart Code Search: Pattern-based searching across your entire codebase
- Project Structure Visualization: Interactive directory tree exploration
- Resource Management: Efficient handling of large codebases with smart filtering
- Python 3.8 or higher
- Poetry (recommended) or pip for dependency management
- Claude Desktop application
Want to try it right now? Here's the fastest way:
-
Clone and setup:
git clone https://github.com/yourusername/python-project-mcp cd python-project-mcp poetry install -
Test locally:
poetry run python python_project_mcp.py
-
Add to Claude Desktop config (replace paths with yours):
{ "mcpServers": { "python-project": { "command": "cmd", "args": ["/c", "cd /d C:\\path\\to\\python-project-mcp && poetry run python python_project_mcp.py"] } } } -
Restart Claude Desktop and try:
Set the project root to "C:\path\to\your\python\project"
-
Clone the repository:
git clone https://github.com/yourusername/python-project-mcp cd python-project-mcp -
Initialize Poetry and configure virtual environment:
poetry init poetry config virtualenvs.in-project true poetry env use python # or specify your Python path
-
Install dependencies:
poetry add mcp
-
Clone the repository:
git clone https://github.com/yourusername/python-project-mcp cd python-project-mcp -
Create and activate virtual environment:
python -m venv .venv # On Windows: .venv\Scripts\activate.bat # On macOS/Linux: source .venv/bin/activate
-
Install dependencies:
pip install mcp
-
Locate your Claude Desktop config file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- Windows:
-
Add the MCP server configuration:
Using Poetry (Recommended):
{ "mcpServers": { "python-project": { "command": "cmd", "args": ["/c", "cd /d C:\\path\\to\\your\\project && poetry run python python_project_mcp.py"] } } }Using Direct Python Path:
{ "mcpServers": { "python-project": { "command": "/path/to/your/project/.venv/bin/python", "args": ["/path/to/your/project/python_project_mcp.py"] } } }Platform-specific examples:
Windows with Poetry:
{ "mcpServers": { "python-project": { "command": "cmd", "args": ["/c", "cd /d C:\\Users\\YourUsername\\Projects\\python-project-mcp && poetry run python python_project_mcp.py"] } } }Windows with Direct Path:
{ "mcpServers": { "python-project": { "command": "C:\\Users\\YourUsername\\Projects\\python-project-mcp\\.venv\\Scripts\\python.exe", "args": ["C:\\Users\\YourUsername\\Projects\\python-project-mcp\\python_project_mcp.py"] } } }macOS/Linux with Poetry:
{ "mcpServers": { "python-project": { "command": "bash", "args": ["-c", "cd /Users/yourusername/projects/python-project-mcp && poetry run python python_project_mcp.py"] } } }macOS/Linux with Direct Path:
{ "mcpServers": { "python-project": { "command": "/Users/yourusername/projects/python-project-mcp/.venv/bin/python", "args": ["/Users/yourusername/projects/python-project-mcp/python_project_mcp.py"] } } } -
Restart Claude Desktop to load the new MCP service.
Before configuring with Claude, test the service locally:
Using Poetry (Recommended):
# Navigate to your project directory
cd /path/to/your/project
# Run the service with Poetry
poetry run python python_project_mcp.pyUsing Virtual Environment:
# Activate your virtual environment
.venv\Scripts\activate.bat # Windows
# or
source .venv/bin/activate # macOS/Linux
# Run the service
python python_project_mcp.pyThe service should start and wait for MCP protocol messages.
-
Open Claude Desktop
-
Start a new conversation
-
Try the following command to verify the service is working:
Set the project root to "/Users/yourusername/projects/your-python-project"Example paths:
- Windows:
"C:\Users\YourUsername\Projects\MyPythonApp" - macOS:
"/Users/yourusername/projects/my-python-app" - Linux:
"/home/yourusername/projects/my-python-app"
- Windows:
If successful, Claude will confirm the project root is set and show Python project indicators found.
Here's what happens when you point this MCP service at a typical Python project:
Set the project root to "/Users/john/projects/flask-blog" and give me a project overview
β
Project root set to: /Users/john/projects/flask-blog
Python project indicators found:
- 12 Python files in root
- Found requirements.txt
- Found app.py
- 2 Python packages found
π Flask Blog Project Overview
========================================
π Python Files: 23
π¦ Python Packages: app, tests
βοΈ Configuration Files: requirements.txt, config.py
π Documentation: README.md, docs/
π Dependencies: ~15 packages (Flask, SQLAlchemy, etc.)
Key components discovered:
- Flask application structure
- Database models and migrations
- Authentication system
- API endpoints
- Comprehensive test suite
This gives you instant insight into any Python project structure!
π₯ Coming Soon: Video demonstration showing the MCP service in action with Claude Desktop.
For now, try the Quick Start guide above to experience it yourself!
Set the project root to "/Users/yourusername/projects/my-python-app"
Show me the project structure with a maximum depth of 3 levels
Find all Python files in the project, excluding test files
Analyze the project dependencies including import statements
Search for "async def" in all Python files
Read the contents of main.py
Get complete project information and overview
The service provides Claude with the following tools:
| Tool | Description | Parameters |
|---|---|---|
set_project_root |
Set the root directory of the Python project | path (string) |
explore_project_structure |
Get project structure overview | max_depth (int), include_hidden (bool) |
read_file |
Read contents of a specific file | file_path (string) |
find_python_files |
Find Python files with optional filtering | pattern (string), include_tests (bool) |
analyze_dependencies |
Analyze project dependencies and imports | include_imports (bool) |
search_code |
Search for patterns within Python files | query (string), case_sensitive (bool), file_pattern (string) |
get_project_info |
Get comprehensive project information | None |
- Python Files:
.py,.pyx,.pyi - Configuration Files:
.toml,.cfg,.ini,.yaml,.yml,.json - Documentation:
.md,.rst,.txt - Requirements:
requirements.txt,requirements-dev.txt,pyproject.toml,setup.py,setup.cfg,Pipfile
The service automatically identifies Python projects by looking for:
- Python files in the root directory
- Common Python project files (
requirements.txt,pyproject.toml, etc.) - Python packages (directories with
__init__.py)
- Automatically excludes common build/cache directories (
__pycache__,.git,node_modules, etc.) - Handles large files gracefully (1MB limit with informative errors)
- Supports both hidden and visible file exploration
- Parses multiple requirement file formats
- Analyzes import statements across the codebase
- Provides usage statistics for imported modules
| Before (Manual Process) | After (With MCP Service) |
|---|---|
| Copy/paste files into Claude one by one | "Analyze my entire project structure" |
| Manually list dependencies | "What dependencies does this project use?" |
| Describe project structure in text | Claude explores and understands automatically |
| Limited to small code snippets | Full codebase analysis and search |
| Time-consuming context switching | Natural language project exploration |
- π Code Reviews: "Find all functions that handle user authentication"
- π§ Refactoring: "Show me all files that import the old database module"
- π Learning: "Explain the architecture of this Django project"
- π Debugging: "Search for error handling patterns in this codebase"
- π Documentation: "Generate documentation for all API endpoints"
- π Onboarding: "Help me understand how this legacy project works"
"Reduced onboarding time for new developers from 2 weeks to 2 days by letting Claude explain our complex microservices architecture."
"Students can now ask Claude to explain any open-source Python project structure, making learning more interactive."
"Quickly identify technical debt and outdated patterns across our legacy codebase."
"Automated discovery of inconsistent coding patterns and missing documentation."
Here's what the service discovers when analyzing itself:
π python-project-mcp/
π python_project_mcp.py (15.2KB)
π¦ pyproject.toml (1.2KB)
π README.md (8.5KB)
π .gitignore (0.8KB)
π .venv/
π lib/
π Scripts/
- From pyproject.toml:
mcp - From imports analysis:
asyncio,json,logging,os,sys,pathlib,typing
- 7 MCP tools for comprehensive project analysis
- 500+ lines of well-structured Python code
- Async/await patterns for efficient I/O operations
- Robust error handling throughout the codebase
- Comprehensive logging for debugging and monitoring
- 15 async functions for non-blocking operations
- Multiple file parsers for different configuration formats
- Smart filtering logic to handle large codebases efficiently
- Resource management with proper cleanup and limits
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
-
Service not appearing in Claude: Ensure the path in
claude_desktop_config.jsonis correct and Claude Desktop has been restarted. -
Permission errors: Make sure the Python executable and script have proper permissions.
-
Module import errors: Verify that the virtual environment is properly activated and MCP is installed.
-
Large file errors: The service has a 1MB file size limit. For larger files, consider using the search functionality instead.
To enable debug logging, modify the logging level in the script:
logging.basicConfig(level=logging.DEBUG)Made with β€οΈ for the Claude and Python communities