mcp-pyodide logo

mcp-pyodide

by yonaka15

mcp-pyodide is a Pyodide server implementation for the Model Context Protocol (MCP). It enables Large Language Models (LLMs) to execute Python code through the MCP interface.

View on GitHub

Last updated: N/A

What is mcp-pyodide?

mcp-pyodide is a server that allows Large Language Models (LLMs) to execute Python code using Pyodide through the Model Context Protocol (MCP). It provides a secure and controlled environment for LLMs to interact with Python.

How to use mcp-pyodide?

The server can be used as a command-line tool or integrated into a TypeScript project. To use it as a server, import the runServer function. As a command-line tool, use the mcp-pyodide command, optionally with the --sse flag for SSE mode. Configure environment variables like PYODIDE_CACHE_DIR, PYODIDE_DATA_DIR, and PORT as needed.

Key features of mcp-pyodide

  • Python code execution for LLMs using Pyodide

  • MCP compliant server implementation

  • Support for stdio and SSE transport modes

  • Robust implementation written in TypeScript

  • Available as a command-line tool

Use cases of mcp-pyodide

  • Enabling LLMs to perform complex calculations

  • Allowing LLMs to interact with external data sources

  • Providing a sandboxed environment for LLMs to execute Python code

  • Integrating Python-based tools and libraries into LLM workflows

FAQ from mcp-pyodide

What is MCP?

MCP stands for Model Context Protocol, a standard for communication between LLMs and external tools.

What is Pyodide?

Pyodide is a Python distribution for the browser and Node.js based on WebAssembly.

How do I run the server in SSE mode?

Use the command mcp-pyodide --sse.

What are the endpoints in SSE mode?

The SSE endpoints are /sse for the SSE connection and /messages for the message handler.

What are the security considerations?

Exercise caution when executing untrusted code. Thoroughly test before using in production.