mcp-pyodide
A Pyodide server implementation for the Model Context Protocol (MCP). This server enables Large Language Models (LLMs) to execute Python code through the MCP interface.
Features
- Python code execution capability for LLMs using Pyodide
- MCP compliant server implementation
- Support for both stdio and SSE transport modes
- Robust implementation written in TypeScript
- Available as a command-line tool
Installation
Usage
As a Server
As a Command-line Tool
Start in stdio mode (default):
Start in SSE mode:
SSE Mode
When running in SSE mode, the server provides the following endpoints:
- SSE Connection:
http://localhost:3020/sse
- Message Handler:
http://localhost:3020/messages
Example client connection:
Project Structure
Dependencies
@modelcontextprotocol/sdk
: MCP SDK (^1.4.0)pyodide
: Python runtime environment (^0.27.1)arktype
: Type validation library (^2.0.1)express
: Web framework for SSE supportcors
: CORS middleware for SSE support
Development
Requirements
- Node.js 18 or higher
- npm 9 or higher
Setup
Scripts
npm run build
: Compile TypeScript and set execution permissionsnpm start
: Run server in stdio modenpm run start:sse
: Run server in SSE mode
Environment Variables
PYODIDE_CACHE_DIR
: Directory for Pyodide cache (default: "./cache")PYODIDE_DATA_DIR
: Directory for mounted data (default: "./data")PORT
: Port for SSE server (default: 3020)
License
MIT
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -am 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Create a Pull Request
Important Notes
- This project is under development, and the API may change
- Thoroughly test before using in production
- Exercise caution when executing untrusted code for security reasons
- When using SSE mode, ensure proper CORS configuration if needed
Support
Please use the Issue tracker for problems and questions.
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
モデル コンテキスト プロトコル (MCP) を介して大規模言語モデル (LLM) によって Python コードを実行するための Pyodide サーバー。
Related Resources
Related MCP Servers
- -securityAlicense-qualityA Python-based MCP server that allows Claude and other LLMs to execute arbitrary Python code directly through your desktop Claude app, enabling data scientists to connect LLMs to APIs and executable code.Last updated -26MIT License
- AsecurityAlicenseAqualityA Model Context Protocol (MCP) server implementation for the Didlogic API. This server allows Large Language Models (LLMs) to interact with Didlogic services through a standardized interface.Last updated -221PythonMIT License
- AsecurityFlicenseAqualityA Model Context Protocol server that allows LLMs to interact with Python environments, execute code, and manage files within a specified working directory.Last updated -958Python
- -securityAlicense-qualityA Python implementation of the Model Context Protocol that allows applications to provide standardized context for LLMs, enabling creation of servers that expose data and functionality to LLM applications through resources, tools, and prompts.Last updated -PythonMIT License