mcp-pyodide
mcp-ピオジド
モデルコンテキストプロトコル(MCP)用のPyodideサーバー実装。このサーバーにより、大規模言語モデル(LLM)がMCPインターフェースを介してPythonコードを実行できるようになります。
特徴
Pyodide を使用した LLM 向け Python コード実行機能
MCP準拠のサーバー実装
stdio と SSE トランスポートモードの両方をサポート
TypeScriptで書かれた堅牢な実装
コマンドラインツールとして利用可能
Related MCP server: Sandbox MCP
インストール
npm install mcp-pyodide使用法
サーバーとして
import { runServer } from "mcp-pyodide";
// Start the server
runServer().catch((error: unknown) => {
console.error("Error starting server:", error);
process.exit(1);
});コマンドラインツールとして
stdio モードで起動します (デフォルト):
mcp-pyodideSSE モードで起動します。
mcp-pyodide --sseSSEモード
SSE モードで実行している場合、サーバーは次のエンドポイントを提供します。
SSE 接続:
http://localhost:3020/sseメッセージハンドラー:
http://localhost:3020/messages
クライアント接続の例:
const eventSource = new EventSource("http://localhost:3020/sse");
eventSource.onmessage = (event) => {
console.log("Received:", JSON.parse(event.data));
};プロジェクト構造
mcp-pyodide/
├── src/
│ ├── formatters/ # Data formatting handlers
│ ├── handlers/ # Request handlers
│ ├── lib/ # Library code
│ ├── tools/ # Utility tools
│ ├── utils/ # Utility functions
│ └── index.ts # Main entry point
├── build/ # Build artifacts
├── pyodide-packages/ # Pyodide-related packages
└── package.json依存関係
@modelcontextprotocol/sdk: MCP SDK (^1.4.0)pyodide: Python ランタイム環境 (^0.27.1)arktype: 型検証ライブラリ (^2.0.1)express: SSE サポート用の Web フレームワークcors: SSE サポート用の CORS ミドルウェア
発達
要件
Node.js 18以上
npm 9以上
設定
# Clone the repository
git clone <repository-url>
# Install dependencies
npm install
# Build
npm run buildスクリプト
npm run build: TypeScript をコンパイルし、実行権限を設定するnpm start: stdioモードでサーバーを実行するnpm run start:sse: SSEモードでサーバーを実行する
環境変数
PYODIDE_CACHE_DIR: Pyodide キャッシュのディレクトリ (デフォルト: "./cache")PYODIDE_DATA_DIR: マウントされたデータのディレクトリ(デフォルト: "./data")PORT: SSEサーバーのポート(デフォルト: 3020)
ライセンス
マサチューセッツ工科大学
貢献
リポジトリをフォークする
機能ブランチを作成する (
git checkout -b feature/amazing-feature)変更をコミットします (
git commit -am 'Add some amazing feature')ブランチにプッシュする (
git push origin feature/amazing-feature)プルリクエストを作成する
重要な注意事項
このプロジェクトは開発中であり、APIは変更される可能性があります。
実稼働で使用する前に徹底的にテストする
セキュリティ上の理由から、信頼できないコードを実行するときは注意してください
SSEモードを使用する場合は、必要に応じて適切なCORS構成を確認してください。
サポート
問題や質問については、問題追跡システムをご利用ください。
Available Tools
5 toolspyodide_executeA
Execute Python code using Pyodide with output capture. When generating images, they will be automatically saved to the output directory instead of being displayed. Images can be accessed from the saved file paths that will be included in the output.
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python code to execute | |
| timeout | No | Execution timeout in milliseconds (default: 5000) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: output capture, automatic image saving to an output directory, and inclusion of file paths in output. It also implies a sandboxed execution environment (Pyodide). However, it doesn't cover potential side effects like memory usage, error handling, or security restrictions, leaving some gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is highly concise and well-structured in two sentences. The first sentence states the core functionality, and the second adds important behavioral context about image handling. Every word earns its place with no redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (executing arbitrary Python code), no annotations, and no output schema, the description does a good job covering essential aspects: execution method, output capture, and image handling. However, it doesn't explain the return format or error behavior, which would be helpful for an AI agent. The absence of an output schema increases the need for more completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, providing clear documentation for both parameters (code and timeout). The description doesn't add any parameter-specific information beyond what's in the schema, such as code syntax examples or timeout implications. According to the rules, with high schema coverage, the baseline is 3 even without param info in the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Execute Python code using Pyodide with output capture.' It specifies the action (execute), resource (Python code), and key capability (output capture). However, it doesn't explicitly differentiate from sibling tools like pyodide_install-packages or pyodide_read-image, which prevents a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides implied usage guidance by mentioning that 'When generating images, they will be automatically saved to the output directory instead of being displayed.' This suggests a specific use case for image handling. However, it lacks explicit guidance on when to use this tool versus alternatives like pyodide_get-mount-points or pyodide_list-mounted-directory, and doesn't mention prerequisites or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
pyodide_get-mount-pointsB
List mounted directories
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists mounted directories but doesn't describe what 'mounted' means in this context, the format of the output, whether it's a read-only operation, or any performance or error-handling traits. This leaves significant gaps for a tool that might interact with a filesystem.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description 'List mounted directories' is a single, efficient sentence that front-loads the core purpose with zero waste. It's appropriately sized for a simple tool with no parameters.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'mounted' entails in this Pyodide context, the return format (e.g., list of paths, JSON structure), or how it differs from 'pyodide_list-mounted-directory'. For a tool that might involve filesystem operations, more context is needed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0 parameters with 100% coverage, so the schema fully documents the absence of inputs. The description doesn't add parameter-specific information, but since there are no parameters, a baseline score of 4 is appropriate as no compensation is needed for missing details.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'List mounted directories' clearly states the verb ('List') and resource ('mounted directories'), making the tool's purpose immediately understandable. However, it doesn't differentiate from the sibling tool 'pyodide_list-mounted-directory', which appears to have a similar function, so it doesn't achieve full sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'pyodide_list-mounted-directory'. There's no mention of prerequisites, context, or exclusions, leaving the agent with no usage instructions beyond the basic purpose.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
pyodide_install-packagesC
Install Python packages using Pyodide. Multiple packages can be specified using space-separated format.
| Name | Required | Description | Default |
|---|---|---|---|
| package | Yes | Python package(s) to install. For multiple packages, use space-separated format (e.g., 'numpy matplotlib pandas'). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the installation action but fails to describe critical traits: whether this requires specific permissions, if it's idempotent (re-installing existing packages), potential side effects (e.g., overwriting dependencies), error handling, or performance implications (e.g., network delays). For a mutation tool with zero annotation coverage, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise—two sentences that directly address the core functionality and parameter format without any fluff. It's front-loaded with the primary purpose and efficiently communicates the key usage note. Every word earns its place, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (a mutation operation installing packages), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what happens after installation (e.g., success/failure indicators, installed package details, or error messages), nor does it cover behavioral aspects like idempotency or dependencies. For a tool that modifies the environment, more context is needed for safe and effective use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, fully documenting the single 'package' parameter with format examples. The description adds value by reinforcing the space-separated format for multiple packages, but doesn't provide additional semantics beyond what the schema already covers (e.g., package name validation, version pinning, or dependency resolution). This meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Install') and resource ('Python packages using Pyodide'), making the purpose immediately understandable. It distinguishes itself from sibling tools like pyodide_execute or pyodide_read-image by focusing on package installation rather than code execution or file operations. However, it doesn't explicitly differentiate from potential non-sibling alternatives (like other package installation methods), keeping it from a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides minimal guidance on when to use this tool, mentioning only that multiple packages can be installed. It lacks explicit context on when to choose this over alternatives (e.g., vs. manual installation or other package managers), prerequisites (e.g., Pyodide environment setup), or exclusions (e.g., packages not supported by Pyodide). This leaves the agent with insufficient decision-making information.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
pyodide_list-mounted-directoryB
List contents of a mounted directory
| Name | Required | Description | Default |
|---|---|---|---|
| mountName | Yes | Name of the mount point |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. While 'List contents' implies a read-only operation, it doesn't specify what format the listing returns (e.g., file names, metadata, recursive structure), whether there are permission constraints, error conditions, or any rate limits. The description provides minimal behavioral context beyond the basic operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly concise at 5 words - 'List contents of a mounted directory'. Every word earns its place, with no redundant information. It's front-loaded with the core action and resource.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple read operation with 1 parameter and 100% schema coverage, the description is minimally adequate. However, with no output schema and no annotations, it should ideally provide more context about what the listing returns (e.g., file names, types, sizes) and any behavioral constraints. The description covers the basic operation but leaves important contextual gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has 100% description coverage, with the single parameter 'mountName' clearly documented as 'Name of the mount point'. The description doesn't add any additional parameter semantics beyond what the schema already provides, so it meets the baseline score of 3 for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose as 'List contents of a mounted directory' - a specific verb ('List') and resource ('contents of a mounted directory'). It distinguishes from siblings like 'pyodide_execute' (execution) and 'pyodide_read-image' (reading specific files), though it doesn't explicitly differentiate from 'pyodide_get-mount-points' which lists mounts rather than directory contents.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (like needing a mounted directory first), when not to use it, or how it relates to sibling tools like 'pyodide_get-mount-points' (which lists mount points rather than directory contents).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
pyodide_read-imageC
Read an image from a mounted directory
| Name | Required | Description | Default |
|---|---|---|---|
| mountName | Yes | Name of the mount point | |
| imagePath | Yes | Path of the image file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It states the action ('Read') but doesn't disclose behavioral traits like what happens if the image is invalid, if it requires specific permissions, or what the output format is. This is inadequate for a tool with no annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with no wasted words. It's appropriately sized and front-loaded, making it easy to understand quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., image data, metadata, or an error) or handle potential issues like invalid paths. For a tool with 2 parameters and no structured support, it should provide more context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, so the schema already documents both parameters (mountName and imagePath) with descriptions. The description doesn't add any meaning beyond this, such as examples or constraints, but meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Read') and resource ('an image from a mounted directory'), making the purpose understandable. It doesn't explicitly differentiate from sibling tools like pyodide_list-mounted-directory, which might also involve mounted directories, so it's not a perfect 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, such as how it differs from pyodide_list-mounted-directory or when to prefer it over other image-handling methods. It lacks explicit context or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Most tools have distinct purposes: execute code, list mount points, install packages, list directory contents, and read images. However, pyodide_get-mount-points and pyodide_list-mounted-directory could cause minor confusion as both relate to directory listing, but their scopes differ (mount points vs. specific directory contents).
All tools follow a consistent pyodide_verb-noun naming pattern with hyphens for multi-word verbs or nouns. This uniformity makes the tool set predictable and easy to understand, with no mixing of conventions.
With 5 tools, the count is reasonable for a Pyodide execution server, covering core operations like code execution, package management, and file handling. It might benefit from additional tools for writing files or managing environments, but it's well-scoped for basic functionality.
The tools cover key areas such as code execution, package installation, and file reading/listing, but there are notable gaps. For example, there's no tool for writing or saving files (beyond automatic image saving), deleting files, or managing Python environments more comprehensively, which could limit agent workflows.
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 Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- FlicenseAqualityCmaintenanceA Model Context Protocol server that allows LLMs to interact with Python environments, execute code, and manage files within a specified working directory.10102-
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that enables LLMs to run ANY code safely in isolated Docker containers.121MIT
- AlicenseBqualityDmaintenanceA secure Model Context Protocol server that allows AI assistants and LLM applications to safely execute Python and JavaScript code snippets in containerized environments.2203MIT
- 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.121MIT
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/yonaka15/mcp-pyodide'
If you have feedback or need assistance with the MCP directory API, please join our Discord server