- Home
- MCP servers
- Pyodide
Pyodide
- typescript
18
GitHub Stars
typescript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
The mcp-pyodide server lets you run Python code from Large Language Models through the Model Context Protocol (MCP). It brings Python execution into the MCP workflow by hosting Pyodide behind a compliant MCP interface, and supports both streaming (SSE) and standard I/O transports for integration with your LLM client pipelines.
How to use
You run the Pyodide MCP server and connect your MCP client to its endpoints to execute Python code from your LLM. You can start the server in stdio mode for local, inline usage or in SSE mode to stream responses to a client that supports Server-Sent Events.
How to install
Prerequisites: Node.js 18 or higher and npm 9 or higher. You will install the MCP server package, then build and run it.
# Install the MCP Pyodide server package
npm install mcp-pyodide
# Optional: build if you pull sources that require it (if using a source repo)
npm run build
# Run in stdio mode (default)
mcp-pyodide
# Run in SSE mode
mcp-pyodide --sse
Additional configuration and usage notes
In SSE mode, you can connect to the following endpoints after starting the server locally: the SSE connection at http://localhost:3020/sse and the message handler at http://localhost:3020/messages. Keep in mind you may need to configure CORS if you are calling these endpoints from a web page hosted on a different origin.
Environment variables control where Pyodide caches and where data is mounted, and you can adjust the port for SSE connections.
Server commands and endpoints
The server can be started programmatically or via the CLI. Use the following forms to run the server depending on your integration method.
import { runServer } from "mcp-pyodide";
// Start the server programmatically
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
Troubleshooting
If the server fails to start, check that Node.js and npm meet the minimum versions, verify that the required environment variables are set, and review any error messages for missing dependencies. If you are using SSE mode, ensure your client can access the SSE endpoint and that CORS is configured appropriately for cross-origin requests.
Notes on security and stability
Executing code from an LLM can pose security risks. Exercise caution when running untrusted code and consider sandboxing strategies or input validation before feeding code to Pyodide. This server is under active development, so verify stability in a staging environment before production use.
Available tools
runServer
Starts the Pyodide MCP server from code by calling the exported runServer function.
CLI start
Starts the server using the mcp-pyodide CLI in stdio mode or with the --sse flag in SSE mode.