MCP Python Interpreter
MCP Pythonインタープリタ
LLM が Python 環境と対話し、ファイルを読み書きし、Python コードを実行し、開発ワークフローを管理できるようにするモデル コンテキスト プロトコル (MCP) サーバー。
特徴
環境管理: さまざまな Python 環境 (システムと conda) を一覧表示して使用する
コード実行: 利用可能な環境で Python コードまたはスクリプトを実行します。
パッケージ管理: インストール済みのパッケージを一覧表示し、新しいパッケージをインストールする
ファイル操作:
あらゆるタイプのファイル(テキスト、ソースコード、バイナリ)を読み取る
テキストファイルとバイナリファイルの書き込み
Python プロンプト: 関数の作成やデバッグなどの一般的な Python タスクのテンプレート
Related MCP server: MCP Python Toolbox
インストール
pip を使用して MCP Python インタープリターをインストールできます。
pip install mcp-python-interpreterまたはUVの場合:
uv install mcp-python-interpreterClaude Desktopでの使用
Claude Desktopをインストールする
Claude Desktopを開き、メニューをクリックして設定をクリックします
開発タブに移動し、「構成の編集」をクリックします。
claude_desktop_config.jsonに以下を追加します。
{
"mcpServers": {
"mcp-python-interpreter": {
"command": "uvx",
"args": [
"mcp-python-interpreter",
"--dir",
"/path/to/your/work/dir",
"--python-path",
"/path/to/your/python"
],
"env": {
"MCP_ALLOW_SYSTEM_ACCESS": 0
},
}
}
}Windowsの場合:
{
"mcpServers": {
"python-interpreter": {
"command": "uvx",
"args": [
"mcp-python-interpreter",
"--dir",
"C:\\path\\to\\your\\working\\directory",
"--python-path",
"/path/to/your/python"
],
"env": {
"MCP_ALLOW_SYSTEM_ACCESS": 0
},
}
}
}Claudeデスクトップを再起動します
チャットインターフェースにMCPツールアイコンが表示されるはずです。
--dirパラメータは必須で、すべてのファイルの保存場所と実行場所を指定します。これにより、MCP サーバーを特定のディレクトリに分離し、セキュリティを維持できます。
前提条件
uvがインストールされていることを確認してください。インストールされていない場合は、以下のコマンドでインストールしてください。curl -LsSf https://astral.sh/uv/install.sh | shWindowsの場合:
powershell -ExecutionPolicy Bypass -Command "iwr -useb https://astral.sh/uv/install.ps1 | iex"
利用可能なツール
Python インタープリタは次のツールを提供します。
環境とパッケージ管理
list_python_environments : 利用可能なすべての Python 環境 (システムと conda) を一覧表示します。
list_installed_packages : 特定の環境にインストールされているパッケージを一覧表示する
install_package : 特定の環境に Python パッケージをインストールする
コード実行
run_python_code : 特定の環境でPythonコードを実行する
run_python_file : 特定の環境でPythonファイルを実行する
ファイル操作
read_file : サイズと安全制限付きで、あらゆるファイルタイプの内容を読み取ります
構文強調表示付きのテキストファイルをサポート
バイナリファイルの16進表現を表示します
write_file : テキストまたはバイナリコンテンツでファイルを作成または上書きします
write_python_file : Pythonファイルを作成または上書きする
list_directory : ディレクトリ内の Python ファイルを一覧表示する
利用可能なリソース
python://environments : 利用可能なすべての Python 環境を一覧表示します
python://packages/{env_name} : 特定の環境にインストールされているパッケージを一覧表示します
python://file/{file_path} : Pythonファイルの内容を取得する
python://directory/{directory_path} : ディレクトリ内のすべての Python ファイルを一覧表示します。
プロンプト
python_function_template : Python関数のテンプレートを生成する
refactor_python_code : Python コードのリファクタリングを支援
debug_python_error : Pythonエラーのデバッグを支援する
使用例
この MCP サーバーで Claude に依頼できる操作の例をいくつか示します。
「システム上で利用可能なすべての Python 環境を表示」
「この Python コードを conda-base 環境で実行します: print('Hello, world!')」
「hello.py」という新しいPythonファイルを作成し、helloという関数を追加します。
「data.jsonファイルの内容を読み取ります」
「これらの設定で新しい構成ファイルを作成します...」
「システムの Python 環境にインストールされているすべてのパッケージを一覧表示する」
「システムの Python 環境にリクエスト パッケージをインストールする」
「次の引数を指定して data_analysis.py を実行します: --input=data.csv --output=results.csv」
ファイル処理機能
MCP Python インタープリタは包括的なファイル操作をサポートするようになりました。
最大1MBのテキストファイルとバイナリファイルを読み取る
テキストファイルとバイナリファイルの書き込み
ソースコードファイルの構文強調表示
バイナリファイルの16進表現
厳密なファイルパスセキュリティ(作業ディレクトリ内のみ)
セキュリティに関する考慮事項
このMCPサーバーは、Python環境とファイルシステムにアクセスできます。主なセキュリティ機能は次のとおりです。
分離された作業ディレクトリ
ファイルサイズの制限
作業ディレクトリ外への書き込みを防止
明示的な上書き保護
完全に理解していないコードやファイル操作を実行するときは常に注意してください。
ライセンス
マサチューセッツ工科大学
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceA Model Context Protocol server that allows LLMs to execute shell commands and receive their output in a controlled manner.6MIT
- Alicense-qualityCmaintenanceA Model Context Protocol server that enables AI assistants like Claude to perform Python development tasks through file operations, code analysis, project management, and safe code execution.9MIT
- Alicense-qualityDmaintenanceA Model Context Protocol (MCP) server that allows AI models to safely access and interact with local file systems, enabling reading file contents, listing directories, and retrieving file metadata.1010MIT
- -licenseAquality-maintenanceA Model Context Protocol server that allows LLMs to interact with Python environments, enabling code execution, file operations, package management, and development workflows.9
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/yzfly/mcp-python-interpreter'
If you have feedback or need assistance with the MCP directory API, please join our Discord server