DEV Community

Gianluca Mazza
Gianluca Mazza

Posted on

Introducing MCP Python Toolbox: Supercharge AI Assistants with Python Capabilities

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
Enter fullscreen mode Exit fullscreen mode

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
  }
}
Enter fullscreen mode Exit fullscreen mode

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.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (1)

Collapse
 
gianlucamazza profile image
Gianluca Mazza

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post