Python REPL MCP Server
Python REPL MCP サーバー
このMCPサーバーは、Python REPL(Read-Eval-Print Loop)ツールを提供します。これにより、MCPプロトコルを介して永続セッションでPythonコードを実行できます。
設定
セットアップは不要です。このプロジェクトでは依存関係の管理にuvを使用します。
Related MCP server: Python REPL MCP Server
サーバーの実行
次のコマンドを実行するだけです:
uv run src/python_repl/server.pyClaude Desktopでの使用
この構成を Claude Desktop 構成ファイルに追加します。
{
"mcpServers": {
"python-repl": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/python-repl-server",
"run",
"mcp_python"
]
}
}
}サーバーは次の 3 つのツールを提供します。
execute_python: 永続変数を使用してPythonコードを実行するcode: 実行するPythonコードreset: セッションをリセットするためのオプションのブール値
list_variables: 現在のセッション内のすべての変数を表示するinstall_package: pypiからパッケージをインストールする
例
変数を設定します。
a = 42次の変数を使用します:
print(f"The value is {a}")すべての変数を一覧表示します。
# Use the list_variables toolセッションをリセットします:
# Use execute_python with reset=true貢献
貢献を歓迎します!お気軽にプルリクエストを送信してください。貢献できる方法は次のとおりです。
バグを報告する
新機能を提案する
ドキュメントの改善
テストケースを追加する
コードの改善を送信する
PR を送信する前に、次の点を確認してください。
コードは既存のスタイルに従います
必要に応じてドキュメントを更新しました
いくつかテストを書いてみませんか?
大きな変更については、まず問題を開いて、何を変更したいのか話し合ってください。
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.
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.1221 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