- Home
- MCP servers
- Python
Python
- python
8
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"shibing624-mcp-run-python-code": {
"command": "uvx",
"args": [
"mcp-run-python-code"
]
}
}
}You can run practical Python scripting workflows through an MCP server that lets you execute Python code, install packages, save code to files, and run existing Python scripts. It’s designed to integrate with MCP clients and supports safe code execution, on-demand package installation, and retrieving specific results from executed code.
How to use
You interact with the MCP server by starting it in stdio mode and then sending requests through an MCP client. You can execute Python code directly, save code to a file and run it, install packages with pip, and run existing Python files. You can also request a particular variable value from the executed code and receive structured results or error messages to aid debugging.
How to install
Prerequisites you need on your machine before starting the MCP server:
- Python is installed on your system (recommended versions depend on your code).
- pip is available for installing Python packages.
- A compatible MCP client is available to send requests to the server.
Running the MCP server locally
You can run the MCP server in stdio transport mode using one of the provided commands. Choose the command that fits your setup.
uvx mcp-run-python-code
uv run mcp-run-python-code
python -m mcp-run-python-code
Running the FastAPI server for HTTP endpoints
If you prefer HTTP endpoints for executing Python code, you can run the FastAPI server variant. It exposes health checks and endpoints to execute code, save code to a file, install packages, and run files.
python run_python_code/fastapi_server.py
Using with Cursor
To connect with a Cursor MCP client, run the stdio MCP server variant as shown above. Cursor will communicate with the server through the stdio transport.
Examples
Basic code execution, saving and running a file, and installing a Python package are demonstrated through simple workflows.
Running with Docker
Build and run a Docker container for the MCP server. You can also run the FastAPI variant in a separate container.
Available tools
RunPythonCode
Execute Python code in a safe environment and return print output or error messages.
save_to_file_and_run
Save Python code to a file and execute it, returning a specified variable value.
pip_install_package
Install Python packages using pip.
run_python_file
Run an existing Python file and optionally return a variable value from its execution.