Python REPL MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Python REPL MCP Server calculate the average of these numbers: [85, 92, 78, 88, 95]"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Python REPL MCP Server
This MCP server provides a Python REPL (Read-Eval-Print Loop) as a tool. It allows execution of Python code through the MCP protocol with a persistent session.
Setup
No setup needed! The project uses uv for dependency management.
Related MCP server: Python REPL MCP Server
Running the Server
Simply run:
uv run src/python_repl/server.pyUsage with Claude Desktop
Add this configuration to your Claude Desktop config file:
{
"mcpServers": {
"python-repl": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/python-repl-server",
"run",
"mcp_python"
]
}
}
}The server provides three tools:
execute_python: Execute Python code with persistent variablescode: The Python code to executereset: Optional boolean to reset the session
list_variables: Show all variables in the current sessioninstall_package: Install a package from pypi
Examples
Set a variable:
a = 42Use the variable:
print(f"The value is {a}")List all variables:
# Use the list_variables toolReset the session:
# Use execute_python with reset=trueContributing
Contributions are welcome! Please feel free to submit a Pull Request. Here are some ways you can contribute:
Report bugs
Suggest new features
Improve documentation
Add test cases
Submit code improvements
Before submitting a PR, please ensure:
Your code follows the existing style
You've updated documentation as needed
Maybe write some tests?
For major changes, please open an issue first to discuss what you would like to change.
Available Tools
3 toolsexecute_pythonB
Execute Python code and return the output. Variables persist between executions.
Inputs: code (required), reset.
install_packageB
Install a Python package using uv
Inputs: package (required).
list_variablesB
List all variables in the current session
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose with no overlap: execute_python runs code, install_package manages dependencies, and list_variables inspects the session state. An agent can easily tell them apart as they target different aspects of the Python REPL workflow.
All tools follow a consistent verb_noun pattern (execute_python, install_package, list_variables) with clear, descriptive names. The naming convention is uniform throughout the set, making it predictable and easy to understand.
With only 3 tools, the set feels thin for a Python REPL server, as it lacks operations like uninstalling packages, clearing variables, or handling errors. While the core functions are covered, the count is borderline low for the domain's typical scope.
The tools cover basic execution, package installation, and variable listing, but there are notable gaps: no way to update or remove packages, delete variables, or manage session state beyond listing. This could cause agent failures in more complex workflows.
Maintenance
Related MCP Connectors
A simple MCP server built with FastMCP and python
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
Related MCP Servers
- FlicenseBqualityDmaintenanceA Python-based MCP server implementation that can be easily installed via pip or directly from GitHub, providing a simple way to deploy and run MCP server functionality.1-
- AlicenseNot gradedqualityDmaintenanceProvides a persistent Python REPL session as a tool for executing code, managing files, installing packages, and initializing projects via the MCP protocol.1MIT
- AlicenseAqualityDmaintenanceA production-grade MCP server providing a persistent Python REPL with multi-session support, sandboxing, and timeout protection, enabling LLM agents to execute Python code across multiple turns with variables that persist between calls.1231 PyPI1MIT
- AlicenseNot gradedqualityDmaintenanceAsync Python REPL + Shell execution for MCP. Provides persistent state, background jobs, interactive input() bridging, and crash isolation in a single server.1Apache 2.0