MCPSERV.CLUB
yonaka15

Mcp Pyodide Server

MCP Server

Run Python code in LLMs via the Model Context Protocol

Active(70)
14stars
3views
Updated Sep 8, 2025

About

A TypeScript‑based MCP server that lets large language models execute Python code using Pyodide. It supports stdio and SSE transports, works as a CLI tool or server module.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

mcp-pyodide MCP server

Mcp Pyodide is a lightweight, MCP‑compliant server that bridges Large Language Models (LLMs) with the full power of Python, all running inside a browser‑compatible WebAssembly runtime. By exposing Pyodide over the Model Context Protocol, it allows an LLM to send arbitrary Python code snippets and receive structured results without leaving the MCP ecosystem. This solves a common pain point for developers building AI‑driven applications: executing rich, stateful Python logic in a secure, sandboxed environment while maintaining the streamlined request/response flow of MCP.

The server’s core value lies in its dual‑mode transport support. In stdio mode, the MCP client and server communicate over standard input/output streams, making it trivial to embed in existing CLI workflows or lightweight Docker containers. SSE mode opens a persistent HTTP connection, enabling real‑time streaming of execution output and intermediate states—ideal for interactive notebooks or dashboards where users benefit from live feedback. Both modes are backed by a robust TypeScript implementation that guarantees type safety and graceful error handling.

Key capabilities include:

  • Python code execution: Any valid Python script can be run in the Pyodide sandbox, with access to a curated set of packages.
  • Structured result handling: Outputs are serialized through the MCP SDK, ensuring consistency across clients and languages.
  • Extensible tooling: The project exposes utility hooks (formatters, handlers) that developers can extend to add custom data transformations or security checks.
  • CORS and environment configuration: For SSE deployments, CORS middleware can be tuned via environment variables, while cache and data directories are configurable to optimize performance.

Real‑world scenarios that benefit from Mcp Pyodide include:

  • Data science assistants: A chatbot can run statistical analyses, generate plots, or manipulate pandas DataFrames on demand.
  • Educational platforms: Interactive coding tutors can evaluate student submissions in a controlled environment, returning immediate feedback.
  • Prototyping pipelines: Rapidly iterate on Python algorithms (e.g., image processing, NLP) without setting up a full backend service.

Integrating Mcp Pyodide into an AI workflow is straightforward: the LLM sends a tool invocation through MCP, the server executes the code in Pyodide, and the result is streamed back via stdio or SSE. This seamless loop removes boilerplate around spawning Python processes, managing dependencies, and handling sandboxing—allowing developers to focus on business logic rather than infrastructure.