mcp-pyodide
mcp-피오다이드
모델 컨텍스트 프로토콜(MCP)을 위한 Pyodide 서버 구현입니다. 이 서버는 대규모 언어 모델(LLM)이 MCP 인터페이스를 통해 Python 코드를 실행할 수 있도록 지원합니다.
특징
Pyodide를 사용한 LLM을 위한 Python 코드 실행 기능
MCP 호환 서버 구현
stdio 및 SSE 전송 모드 모두 지원
TypeScript로 작성된 강력한 구현
명령줄 도구로 사용 가능
Related MCP server: Sandbox MCP
설치
지엑스피1
용법
서버로서
import { runServer } from "mcp-pyodide";
// Start the server
runServer().catch((error: unknown) => {
console.error("Error starting server:", error);
process.exit(1);
});명령줄 도구로
stdio 모드로 시작(기본값):
mcp-pyodideSSE 모드에서 시작:
mcp-pyodide --sseSSE 모드
SSE 모드에서 실행할 때 서버는 다음과 같은 엔드포인트를 제공합니다.
SSE 연결:
http://localhost:3020/sse메시지 핸들러:
http://localhost:3020/messages
클라이언트 연결 예:
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 런타임 환경 (^0.27.1)arktype: 유형 검증 라이브러리 (^2.0.1)express: SSE 지원을 위한 웹 프레임워크cors: SSE 지원을 위한 CORS 미들웨어
개발
요구 사항
Node.js 18 이상
npm 9 이상
설정
# Clone the repository
git clone <repository-url>
# Install dependencies
npm install
# Build
npm run build스크립트
npm run build: TypeScript를 컴파일하고 실행 권한을 설정합니다.npm start: stdio 모드로 서버 실행npm run start:sse: SSE 모드로 서버를 실행합니다.
환경 변수
PYODIDE_CACHE_DIR: Pyodide 캐시 디렉토리(기본값: "./cache")PYODIDE_DATA_DIR: 마운트된 데이터의 디렉토리(기본값: "./data")PORT: SSE 서버용 포트(기본값: 3020)
특허
MIT
기여하다
저장소를 포크하세요
기능 브랜치를 생성합니다(
git checkout -b feature/amazing-feature)변경 사항을 커밋합니다(
git commit -am 'Add some amazing feature')브랜치에 푸시(
git push origin feature/amazing-feature)풀 리퀘스트 만들기
중요 참고 사항
이 프로젝트는 개발 중이며 API가 변경될 수 있습니다.
생산에 사용하기 전에 철저히 테스트하세요
보안상의 이유로 신뢰할 수 없는 코드를 실행할 때는 주의하십시오.
SSE 모드를 사용할 때 필요한 경우 적절한 CORS 구성을 확인하세요.
지원하다
문제와 질문이 있으면 이슈 추적기를 이용하세요.
Available Tools
5 toolspyodide_executeA
Execute Python code using Pyodide with output capture. When generating images, they will be automatically saved to the output directory instead of being displayed. Images can be accessed from the saved file paths that will be included in the output.
Inputs: code (required), timeout.
pyodide_get-mount-pointsB
List mounted directories
Inputs: no named parameters.
pyodide_install-packagesC
Install Python packages using Pyodide. Multiple packages can be specified using space-separated format.
Inputs: package (required).
pyodide_list-mounted-directoryB
List contents of a mounted directory
Inputs: mountName (required).
pyodide_read-imageC
Read an image from a mounted directory
Inputs: mountName (required), imagePath (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Most tools have distinct purposes: execute code, list mount points, install packages, list directory contents, and read images. However, pyodide_get-mount-points and pyodide_list-mounted-directory could cause minor confusion as both relate to directory listing, but their scopes differ (mount points vs. specific directory contents).
All tools follow a consistent pyodide_verb-noun naming pattern with hyphens for multi-word verbs or nouns. This uniformity makes the tool set predictable and easy to understand, with no mixing of conventions.
With 5 tools, the count is reasonable for a Pyodide execution server, covering core operations like code execution, package management, and file handling. It might benefit from additional tools for writing files or managing environments, but it's well-scoped for basic functionality.
The tools cover key areas such as code execution, package installation, and file reading/listing, but there are notable gaps. For example, there's no tool for writing or saving files (beyond automatic image saving), deleting files, or managing Python environments more comprehensively, which could limit agent workflows.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- AlicenseAqualityBmaintenanceA Model Context Protocol server that allows LLMs to interact with Python environments, execute code, and manage files within a specified working directory.10495 PyPI104MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that enables LLMs to run ANY code safely in isolated Docker containers.125MIT
- AlicenseBqualityDmaintenanceA secure Model Context Protocol server that allows AI assistants and LLM applications to safely execute Python and JavaScript code snippets in containerized environments.2205MIT
- AlicenseAqualityDmaintenanceA production-grade MCP server providing a persistent Python REPL with multi-session support, sandboxing, and timeout protection, enabling LLM agents to execute Python code across multiple turns with variables that persist between calls.1231 PyPI1MIT