MCP Python Toolbox: Python Development Tools for AI Assistants
I've created an open-source Model Context Protocol (MCP) server that enables AI assistants like Claude to work with Python code and projects.
What is it?
MCP Python Toolbox implements the Model Context Protocol specification to give AI assistants the ability to perform Python development tasks through a standardized interface.
Core Features
The toolbox consists of four main modules:
FileOperations
- Read/write files with path validation
- Create/delete directories
- List directory contents with metadata
CodeAnalyzer
- AST-based Python code structure analysis
- Code formatting (Black, PEP8)
- Linting with Pylint
ProjectManager
- Virtual environment management
- Dependency installation and conflict checking
- Package version management
CodeExecutor
- Execute Python code in controlled environments
- Capture stdout, stderr, and exit codes
- Use project's virtual environment for consistent dependencies
Quick Setup
git clone https://github.com/gianlucamazza/mcp_python_toolbox.git
cd mcp_python_toolbox
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# Install the package in development mode
# Run with current directory as workspace
python -m mcp_python_toolbox
Integration with Claude
The tool can be configured to work with Claude Desktop to enhance AI-assisted Python development:
"python-toolbox": {
"command": "/path/to/python",
"args": [
"-m",
"mcp_python_toolbox",
"--workspace",
"/path/to/workspace"
],
"env": {
"PYTHONPATH": "/path/to/src",
# Other environment variables
}
}
Technical Implementation
The implementation follows a modular approach with clear separation of concerns:
- Safe file operations with workspace restrictions
- Python AST for code analysis
- Integration with standard tools (Black, Pylint)
- Controlled execution environment
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.
Top comments (1)
my x post