Python Runner MCP Server

Python Runner MCP Server

python_runner_mcp•bytaiji1985

A FastMCP-based server that executes Python code with pre-installed data science and machine learning libraries and captures output, errors, and return values.

License: MIT License•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Executes Python code in isolated namespaces and returns output, error messages, and success status.
  • •Ships with pre-installed data science and machine learning libraries such as numpy, pandas, scikit-learn, matplotlib, and others.
  • •Captures standard output, error output, and return values in real time.

BEST FOR

  • •Running pandas data analysis and statistical summaries through Claude Desktop.
  • •Training and evaluating scikit-learn machine learning models from within an MCP client.

ABOUT PYTHON_RUNNER_MCP

Python Runner MCP Server is cataloged as an MCP server attributed to taiji1985. A FastMCP-based server that executes Python code with pre-installed data science and machine learning libraries and captures output, errors, and return values. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Python Runner MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Is this tool safe to run arbitrary code with?

It executes code in isolated namespaces, but the README warns that it runs arbitrary Python and should only be used in a trusted environment.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 1e1338c0d342 · 采集于 2026-11-13 11:31:54 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

Python Runner MCP Server

English | 中文

A Python code execution server based on the FastMCP framework, designed specifically for data science and machine learning workflows.

🚀 Features

  • Safe Python Code Execution: Execute Python code in isolated namespaces
  • Rich Data Science Libraries: Pre-installed with commonly used data science and machine learning packages
  • Real-time Output Capture: Capture standard output, error output, and return values
  • MCP Protocol Support: Fully compatible with Model Context Protocol
  • Easy to Use: Provides a simple and clean API interface

Use uvx to run the server directly without installation: [TODO ..... ]

# Run directly (no pre-installation required)
uvx python-runner

Configure in Claude Desktop

Add the following configuration to your Claude Desktop config file:

{
  "mcpServers": {
    "python-runner": {
      "command": "uvx",
      "args": ["python-runner"]
    }
  }
}

Config file locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Debug and Test

# Use MCP Inspector to debug the server
npx @modelcontextprotocol/inspector uvx python-runner

📦 Pre-installed Libraries

This project comes pre-installed with the following commonly used data science and machine learning libraries:

  • Data Processing: numpy, pandas, scipy
  • Machine Learning: scikit-learn
  • Data Visualization: matplotlib, seaborn, plotly
  • Scientific Computing: sympy
  • Image Processing: pillow
  • Network Analysis: networkx
  • Interactive Development: jupyter
  • HTTP Requests: requests

🛠️ Manual Installation (For Development)

Prerequisites

  • Python 3.12 or higher
  • uv package manager (recommended) or pip
# Clone the repository
git clone <repository-url>
cd python_runner

# Install dependencies
uv sync

Install with pip

# Clone the repository
git clone <repository-url>
cd python_runner

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -e .

🚀 Usage

Using with Claude Desktop

After configuration, you can directly use Python code execution functionality in Claude Desktop:

Please help me execute this Python code:

import pandas as pd
import numpy as np

# Create sample data
data = pd.DataFrame({
    'sales': [100, 150, 200, 120, 180],
    'profit': [20, 30, 50, 25, 40]
})

print("Sales data statistics:")
print(data.describe())

Running as Standalone MCP Server

# Using uvx (recommended)
uvx python-runner

# Or run locally
python main.py

Direct API Call

from main import execute_python

# Execute simple Python code
result = execute_python("""
print("Hello, World!")
x = 1 + 2
print(f"Result: {x}")
""")

print(result)
# Output:
# {
#     'output': 'Hello, World!\nResult: 3\n',
#     'error': '',
#     'success': True
# }

Data Science Examples

# Data analysis example
code = """
import pandas as pd
import numpy as np

# Create sample data
data = pd.DataFrame({
    'x': np.random.randn(100),
    'y': np.random.randn(100)
})

print(f"Data shape: {data.shape}")
print(f"Statistical summary:\n{data.describe()}")
"""

result = execute_python(code)
print(result['output'])
# Machine learning example
code = """
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score

# Generate sample data
X, y = make_classification(n_samples=1000, n_features=20, random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Train model
clf = RandomForestClassifier(random_state=42)
clf.fit(X_train, y_train)

# Predict and evaluate
y_pred = clf.predict(X_test)
accuracy = accuracy_score(y_test, y_pred)
print(f"Model accuracy: {accuracy:.4f}")
"""

result = execute_python(code)
print(result['output'])

📋 API Reference

execute_python(code: str) -> dict

Execute Python code and return the result.

Parameters:

  • code (str): Python code string to execute

Returns:

  • dict: Dictionary containing the following keys:
    • output (str): Standard output content
    • error (str): Error message (if any)
    • success (bool): Whether execution was successful

🔒 Security

  • Code executes in isolated namespaces
  • Captures and redirects standard output and error output
  • Provides detailed error tracking information

⚠️ Warning: This tool executes arbitrary Python code. Please ensure you use it in a trusted environment.

🤝 Contributing

Issues and Pull Requests are welcome!

  1. Fork this repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • FastMCP - Excellent MCP framework
  • All maintainers of the pre-installed open-source data science libraries

Made with ❤️ for the data science community

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Python Runner MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/python_runner_mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools