MCP Python Toolbox
local-only server
The server can only run on the client’s local machine because it depends on local resources.
Integrations
Provides dependency management for Flask applications, allowing installation and version management of the web framework.
Supports running tests for Python projects through the testing framework.
Provides comprehensive Python development tools including code analysis, formatting with Black/PEP8, linting with Pylint, project management with virtual environments, dependency handling, and safe code execution capabilities.
MCP Python Toolbox
A Model Context Protocol (MCP) server that provides a comprehensive set of tools for Python development, enabling AI assistants like Claude to effectively work with Python code and projects.
Overview
MCP Python Toolbox implements a Model Context Protocol server that gives Claude the ability to perform Python development tasks through a standardized interface. It enables Claude to:
- Read, write, and manage files within a workspace
- Analyze, format, and lint Python code
- Manage virtual environments and dependencies
- Execute Python code safely
Features
File Operations (FileOperations
)
- Safe file operations within a workspace directory
- Path validation to prevent unauthorized access outside workspace
- Read and write files with line-specific operations
- Create and delete files and directories
- List directory contents with detailed metadata (size, type, modification time)
- Automatic parent directory creation when writing files
Code Analysis (CodeAnalyzer
)
- Parse and analyze Python code structure using AST
- Extract detailed information about:
- Import statements and their aliases
- Function definitions with arguments and decorators
- Class definitions with base classes and methods
- Global variable assignments
- Format code using:
- Black (default)
- PEP8 (using autopep8)
- Comprehensive code linting using Pylint with detailed reports
Project Management (ProjectManager
)
- Create and manage virtual environments with pip support
- Flexible dependency management:
- Install from requirements.txt
- Install from pyproject.toml
- Support for specific package versions
- Advanced dependency handling:
- Check for version conflicts between packages
- List all installed packages with versions
- Update packages to specific versions
- Generate requirements.txt from current environment
Code Execution (CodeExecutor
)
- Execute Python code in a controlled environment
- Uses project's virtual environment for consistent dependencies
- Temporary file management for code execution
- Capture stdout, stderr, and exit codes
- Support for custom working directories
Installation
- Clone the repository:
- Create and activate a virtual environment:
- Install the package in development mode:
Usage
Running as a CLI Tool
The simplest way to start the server is using the CLI:
Setting Up with Claude Desktop
Claude Desktop can automatically launch and manage the MCP Python Toolbox server. Here's how to configure it:
- Install and set up the MCP Python Toolbox as described above
- Add a configuration entry for the Python Toolbox in Claude Desktop's MCP tools configuration:
- Customize the paths to match your environment
- Claude Desktop will automatically start the MCP server when needed
- Claude will now have access to Python development tools through the MCP interface
Programmatic Usage
Core Module Examples
File Operations
Code Analysis
Project Management
Code Execution
Development
Running Tests
Type Checking
Linting
Formatting
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Implements the Model Context Protocol specification
- Built with modern Python development tools and best practices
- Uses industry-standard formatting (Black) and linting (Pylint) tools
This server cannot be installed
A Model Context Protocol server that enables AI assistants like Claude to perform Python development tasks through file operations, code analysis, project management, and safe code execution.