yonaka/mcp-pyodide
Built by Metorial, the integration platform for agentic AI.
yonaka/mcp-pyodide
Server Summary
Execute Python code
MCP compliant server implementation
Support for stdio and SSE transport modes
Available as a command-line tool
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.
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);
});
Start in stdio mode (default):
mcp-pyodide
Start in SSE mode:
mcp-pyodide --sse
When running in SSE mode, the server provides the following endpoints:
http://localhost:3020/sse
http://localhost:3020/messages
Example client connection:
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 runtime environment (^0.27.1)arktype
: Type validation library (^2.0.1)express
: Web framework for SSE supportcors
: CORS middleware for SSE support# Clone the repository
git clone
# Install dependencies
npm install
# Build
npm run build
npm run build
: Compile TypeScript and set execution permissionsnpm start
: Run server in stdio modenpm run start:sse
: Run server in SSE modePYODIDE_CACHE_DIR
: Directory for Pyodide cache (default: "./cache")PYODIDE_DATA_DIR
: Directory for mounted data (default: "./data")PORT
: Port for SSE server (default: 3020)MIT
git checkout -b feature/amazing-feature
)git commit -am 'Add some amazing feature'
)git push origin feature/amazing-feature
)Please use the Issue tracker for problems and questions.