Skip to main content
Glama

mcp-pyodide

by yonaka15

mcp-pyodid

Eine Pyodide-Serverimplementierung für das Model Context Protocol (MCP). Dieser Server ermöglicht Large Language Models (LLMs) die Ausführung von Python-Code über die MCP-Schnittstelle.

Merkmale

  • Python-Codeausführungsfunktion für LLMs mit Pyodide
  • MCP-kompatible Serverimplementierung
  • Unterstützung für die Transportmodi stdio und SSE
  • Robuste Implementierung, geschrieben in TypeScript
  • Verfügbar als Befehlszeilentool

Installation

npm install mcp-pyodide

Verwendung

Als Server

import { runServer } from "mcp-pyodide"; // Start the server runServer().catch((error: unknown) => { console.error("Error starting server:", error); process.exit(1); });

Als Befehlszeilentool

Im Standardmodus starten (Standard):

mcp-pyodide

Start im SSE-Modus:

mcp-pyodide --sse

SSE-Modus

Beim Ausführen im SSE-Modus stellt der Server die folgenden Endpunkte bereit:

  • SSE-Verbindung: http://localhost:3020/sse
  • Nachrichtenhandler: http://localhost:3020/messages

Beispiel einer Clientverbindung:

const eventSource = new EventSource("http://localhost:3020/sse"); eventSource.onmessage = (event) => { console.log("Received:", JSON.parse(event.data)); };

Projektstruktur

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

Abhängigkeiten

  • @modelcontextprotocol/sdk : MCP SDK (^1.4.0)
  • pyodide : Python-Laufzeitumgebung (^0.27.1)
  • arktype : Bibliothek zur Typvalidierung (^2.0.1)
  • express : Webframework für SSE-Unterstützung
  • cors : CORS-Middleware für SSE-Unterstützung

Entwicklung

Anforderungen

  • Node.js 18 oder höher
  • npm 9 oder höher

Aufstellen

# Clone the repository git clone <repository-url> # Install dependencies npm install # Build npm run build

Skripte

  • npm run build : TypeScript kompilieren und Ausführungsberechtigungen festlegen
  • npm start : Server im Standardmodus ausführen
  • npm run start:sse : Server im SSE-Modus ausführen

Umgebungsvariablen

  • PYODIDE_CACHE_DIR : Verzeichnis für den Pyodide-Cache (Standard: "./cache")
  • PYODIDE_DATA_DIR : Verzeichnis für gemountete Daten (Standard: "./data")
  • PORT : Port für SSE-Server (Standard: 3020)

Lizenz

MIT

Beitragen

  1. Forken Sie das Repository
  2. Erstellen Sie einen Feature-Zweig ( git checkout -b feature/amazing-feature )
  3. Übernehmen Sie Ihre Änderungen ( git commit -am 'Add some amazing feature' )
  4. Pushen zum Zweig ( git push origin feature/amazing-feature )
  5. Erstellen einer Pull-Anforderung

Wichtige Hinweise

  • Dieses Projekt befindet sich in der Entwicklung und die API kann sich ändern
  • Vor dem Einsatz in der Produktion gründlich testen
  • Seien Sie aus Sicherheitsgründen vorsichtig, wenn Sie nicht vertrauenswürdigen Code ausführen
  • Stellen Sie bei Verwendung des SSE-Modus bei Bedarf eine ordnungsgemäße CORS-Konfiguration sicher

Unterstützung

Bei Problemen und Fragen nutzen Sie bitte den Issue Tracker.

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

Ein Pyodide-Server zum Ausführen von Python-Code durch Large Language Models (LLMs) über das Model Context Protocol (MCP).

  1. Merkmale
    1. Installation
      1. Verwendung
        1. Als Server
        2. Als Befehlszeilentool
        3. SSE-Modus
      2. Projektstruktur
        1. Abhängigkeiten
          1. Entwicklung
            1. Anforderungen
            2. Aufstellen
            3. Skripte
          2. Umgebungsvariablen
            1. Lizenz
              1. Beitragen
                1. Wichtige Hinweise
                  1. Unterstützung

                    Related MCP Servers

                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol server that extracts and analyzes Python code structures, focusing on import/export relationships between files to help LLMs understand code context.
                      Last updated -
                      4
                      Python
                      MIT License
                    • A
                      security
                      F
                      license
                      A
                      quality
                      A Python server implementing the Model Context Protocol to provide customizable prompt templates, resources, and tools that enhance LLM interactions in the continue.dev environment.
                      Last updated -
                      2
                      Python
                    • -
                      security
                      A
                      license
                      -
                      quality
                      Model Context Protocol server to run Python code in a sandbox.
                      Last updated -
                      1,462
                      9,909
                      Python
                      MIT License
                    • A
                      security
                      F
                      license
                      A
                      quality
                      A Model Context Protocol server that allows LLMs to interact with Python environments, execute code, and manage files within a specified working directory.
                      Last updated -
                      9
                      37
                      Python
                      • Linux
                      • Apple

                    View all related MCP servers

                    MCP directory API

                    We provide all the information about MCP servers via our MCP API.

                    curl -X GET 'https://glama.ai/api/mcp/v1/servers/yonaka15/mcp-pyodide'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server