Integrations
Allows interaction with Python environments, execution of Python code, management of packages, and Python-related file operations including reading, writing, and debugging Python files.
MCP Pythonインタープリタ
LLM が Python 環境と対話し、ファイルを読み書きし、Python コードを実行し、開発ワークフローを管理できるようにするモデル コンテキスト プロトコル (MCP) サーバー。
特徴
- 環境管理: さまざまな Python 環境 (システムと conda) を一覧表示して使用する
- コード実行: 利用可能な環境で Python コードまたはスクリプトを実行します。
- パッケージ管理: インストール済みのパッケージを一覧表示し、新しいパッケージをインストールする
- ファイル操作:
- あらゆるタイプのファイル(テキスト、ソースコード、バイナリ)を読み取る
- テキストファイルとバイナリファイルの書き込み
- Python プロンプト: 関数の作成やデバッグなどの一般的な Python タスクのテンプレート
インストール
pip を使用して MCP Python インタープリターをインストールできます。
またはUVの場合:
Claude Desktopでの使用
- Claude Desktopをインストールする
- Claude Desktopを開き、メニューをクリックして設定をクリックします
- 開発タブに移動し、「構成の編集」をクリックします。
claude_desktop_config.json
に以下を追加します。
Windowsの場合:
- Claudeデスクトップを再起動します
- チャットインターフェースにMCPツールアイコンが表示されるはずです。
--dir
パラメータは必須で、すべてのファイルの保存場所と実行場所を指定します。これにより、MCP サーバーを特定のディレクトリに分離し、セキュリティを維持できます。
前提条件
uv
がインストールされていることを確認してください。インストールされていない場合は、以下のコマンドでインストールしてください。Copy- Windowsの場合:Copy
利用可能なツール
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環境とファイルシステムにアクセスできます。主なセキュリティ機能は次のとおりです。
- 分離された作業ディレクトリ
- ファイルサイズの制限
- 作業ディレクトリ外への書き込みを防止
- 明示的な上書き保護
完全に理解していないコードやファイル操作を実行するときは常に注意してください。
ライセンス
マサチューセッツ工科大学
You must be authenticated.
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
LLM が Python 環境と対話し、コードを実行し、指定された作業ディレクトリ内のファイルを管理できるようにするモデル コンテキスト プロトコル サーバー。
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server that allows LLMs to execute shell commands and receive their output in a controlled manner.Last updated -Python
- AsecurityAlicenseAqualityA Model Context Protocol server that gives LLMs the ability to interact with Ethereum networks, manage wallets, query blockchain data, and execute smart contract operations through a standardized interface.Last updated -313232TypeScriptMIT License
- -securityAlicense-qualityA Model Context Protocol server that extracts and analyzes Python code structures, focusing on import/export relationships between files to help LLMs understand code context.Last updated -2PythonMIT License
- -securityFlicense-qualityA Model Context Protocol server that connects LLMs to the Compiler Explorer API, enabling them to compile code, explore compiler features, and analyze optimizations across different compilers and languages.Last updated -Python
Appeared in Searches
- Information about playwrights or Playwright software
- Troubleshooting 'fetch 中stdio启用失败' Error
- Resources and guidance for coding, developing, and training AI models
- Developing AI-Powered Mobile and Web Applications by Combining and Transferring Knowledge from Open Source AI Models
- A server for local file operations on Windows that integrates with Ollama