home / mcp / mcp python toolbox mcp server
A Model Context Protocol (MCP) server that provides a comprehensive set of tools for Python development
Configuration
View docs{
"mcpServers": {
"gianlucamazza-mcp_python_toolbox": {
"command": "python",
"args": [
"-m",
"mcp_python_toolbox",
"--workspace",
"/path/to/your/project"
],
"env": {
"PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
"PYTHONPATH": "/path/to/mcp_python_toolbox/src",
"VIRTUAL_ENV": "/path/to/mcp_python_toolbox/.venv"
}
}
}
}You run an MCP server that exposes Python development tools through a standardized interface. With this server, you can manage workspace files, analyze and format Python code, handle virtual environments and dependencies, and execute code in a controlled environment, all from your MCP client. This makes AI-assisted Python work efficient and safe within your projects.
Start the server from your development environment to enable Python tooling in your MCP client. The server runs as a local process and uses your workspace as the root for all operations.
Typical usage patterns include: reading and writing project files, analyzing Python code to extract structure, formatting and linting code, managing virtual environments and dependencies, and executing code in an isolated context that respects your project’s dependencies.
To run the server locally in your workspace, use the standard start command shown in the setup instructions. You can point the server to your workspace directory so all actions occur within that scope.
Example programmatic usage shows how you can instantiate the server in code and begin serving requests from your MCP client. This lets your client request file operations, code analysis results, and code execution outcomes directly from the server.
Prerequisites you need on your system before installing: - Python 3.8+ installed and available on your PATH - Git for cloning the repository - Internet access for fetching dependencies
Step 1: Clone the project
``
git clone https://github.com/gianlucamazza/mcp_python_toolbox.git
cd mcp_python_toolbox
``
Step 2: Create and activate a virtual environment
``
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# or
. .venv\Scripts\activate # Windows
``
Step 3: Install the package in development mode
```
pip install -e ".[dev]"The server is designed to be run as a local stdio process that your MCP client can communicate with. Start the server with a workspace path to ensure all operations are isolated to that project.
CLI start example to run the server with a specific workspace shows the expected runtime entry point.
# Start with current directory as workspace
python -m mcp_python_toolbox
# Or specify a workspace directory
python -m mcp_python_toolbox --workspace /path/to/your/projectProgrammatic usage demonstrates how to instantiate and run the server from your own Python client.
Allows safe file operations within a workspace, including reading and writing files, listing directories with metadata, and automatic parent directory creation.
Parses Python code to extract imports, functions, classes, and globals; formats code with Black or autopep8; and lint with Pylint.
Manages virtual environments and dependencies, installs from requirements.txt or pyproject.toml, checks for conflicts, updates packages, and can generate a requirements.txt.
Executes Python code in a controlled environment using the project’s virtual environment, capturing stdout, stderr, and exit codes.