mcp-python
A python repl for MCP
Documentation
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.
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:
1. `execute_python`: Execute Python code with persistent variables
2. `list_variables`: Show all variables in the current session
3. `install_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:
1. Your code follows the existing style
2. You've updated documentation as needed
3. Maybe write some tests?
For major changes, please open an issue first to discuss what you would like to change.
Frequently asked questions
What is mcp-python?
mcp-python is A python repl for MCP
How do I install mcp-python?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-python open source?
Yes — it is hosted on GitHub at https://github.com/hdresearch/mcp-python and has 42 stars.
Related MCP tools
Cognee is the open-source AI memory platform for agents. Give your AI agents persistent long-term memory across sessions with a self-hosted knowledge graph engine.
Automate browser based workflows with AI
Hindsight: Agent Memory That Learns
A privacy-first app that strips AI watermarks from content you own.
Agent framework and applications built upon Qwen>=3.0, featuring Function Calling, MCP, Code Interpreter, RAG, Chrome extension, etc.
The power of Claude Code / GeminiCLI / CodexCLI + [Gemini / OpenAI / OpenRouter / Azure / Grok / Ollama / Custom Model / All Of The Above] working as one.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP