Skip to main content
Glama

emptysock-mcp

Model Context Protocol-Server für die EmptySock-Spiel-Engine. Stellt die Engine-Systeme — NavMesh, Physics, Scene, Save und Actor — als MCP-Tools bereit, die von Claude Desktop, KI-Agenten und der Claude-API genutzt werden können.


Voraussetzungen

  • Node.js 20+

  • npm 9+


Related MCP server: Hayba

Installation

git clone https://github.com/eleferrets/emptysock-mcp.git
cd emptysock-mcp
npm install
npm run build

Konfiguration

Kopiere die Beispiel-Umgebungsdatei und fülle alle benötigten Werte aus:

cp .env.example .env

Variable

Erforderlich

Beschreibung

EMPTYSOCK_API_TOKEN

Nein

Bearer-Token für authentifizierte Engine-API-Aufrufe

MCP_AUTH_TOKEN

Nein

Erforderliches Bearer-Token für SSE-Transportanfragen. Leer lassen, um die Authentifizierung zu deaktiveren.

SAVE_BASE_DIR

Nein

Absoluter Pfad, den die Speicher-Tools lesen/schreiben dürfen. Standardmäßig das Arbeitsverzeichnis des Prozesses. In der Produktion explizit festlegen.

Commite .env niemals — es ist in der .gitignore enthalten. Speichere Geheimnisse in deinem CI/CD-Secret-Manager auf, nicht im Repository.


Den Server starten

stdio (empfohlen für die lokale Verwendung und Claude Desktop)

npm run dev          # development — tsx, no build step
# or after building:
node dist/server.js

Der Server kommuniziert über stdin/stdout. Es gibt keinen Netzwerkport und keine Authentisierungsschnittstelle.

Claude Desktop

Füge den Server zu deiner Claude-Desktop-Konfiguration hinzu (~/Library/Application Support/Claude/claude_desktop_config.json unter macOS):

{
  "mcpServers": {
    "emptysock": {
      "command": "node",
      "args": ["/absolute/path/to/emptysock-mcp/dist/server.js"],
      "env": {
        "SAVE_BASE_DIR": "/absolute/path/to/your/saves"
      }
    }
  }
}

Starte Claude Desktop neu. Die EmptySock-Tools erscheinen dann in der Tool-Auswahl.


Verfügbare Tools

NavMesh

Tool

Beschreibung

navmesh_find_path

A*-Pfad zwischen zwei 2D-Weltpunkten auf einem geladenen NavMesh. Gibt geordnete Wegpunkte oder [] zurück, wenn kein Pfad existiert.

navmesh_nearest_node

Nächstgelegener begehbaer NavMesh-Knoten zu einem gegebenen Weltpunkt.

Beispiel — Pfad finden:

{
  "from": { "x": 0, "y": 0 },
  "to":   { "x": 100, "y": 50 },
  "mapId": "level1"
}

Physics

Tool

Beschreibung

physics_raycast_2d

Wirft einen Strahl im 2D-Physikraum; gibt die erste getrofene Entität, den Treffpunkt und die Normale zurück.

physics_raycast_3d

Wirft einen Strahl im 3D-Physikraum (Rapier3D); gibt den ersten Treffer zurück.

physics_overlap_circle

Alle Entitäts-IDs, deren 2D-Collider einen Kreis überlappen.

physics_body_state

Aktuelle Position, Geschwindigkeit und Winkelgeschwindigkeit eines Physik-Körpers anhand der Entitäts-ID.

Beispiel — Kreisüberlappung:

{
  "center": { "x": 50, "y": 50 },
  "radius": 20,
  "layerMask": 3
}

Scene

Tool

Beschreibung

scene_list_entities

Alle in einer Szene aktiven Entitäts-IDs.

scene_entity_info

Tag, Aktivzustand und Komponentenliste für eine bestimmte Entität.

scene_get_component

Serialsierter Zustand einer bestimmten Komponente auf einer Entität.

Beispiel — Komponente abrufen:

{
  "sceneId": "gameplay",
  "entityId": "player-001",
  "componentType": "Transform"
}

Save

Alle Speicher-Tools sind per Sandbox auf SAVE_BASE_DIR beschränkt. Pfad-Traversal (.., absolute Pfade) wird bereits auf Schema-Ebene und erneut beim Auflösen abgelehnt.

Tool

Beschreibung

save_read

Liest einen Speicherstand von der Festplatte und gibt seine JSON-Daten zurück.

save_write

Schreibt ein JSON-Objekt in einen benannten Speicherstand.

save_delete

Löscht einen Speicherstand.

save_list

Listet alle verfügbaren Speicherstände auf.

Beispiel — Schreiben:

{
  "slot": "autosave",
  "data": { "level": 3, "score": 4200, "checkpoint": "bridge" }
}

Slotnamen dürfen nur alphanumerische Zeichen, Bindestriche und Unterstriche enthalten (z. B. slot1, autosave, new-game-plus).


Actor

Tool

Beschreibung

actor_send_message

Stellt eine Nachricht in den Posteingang eines bestimmten Actors. Wird beim nächsten ActorSystem-Flush verarbeitet.

actor_broadcast

Sendet eine Nachricht per Broadcast an alle registrierten Actors.

actor_inbox_size

Anzahl der ausstehenden Nachrichten im Posteingang eines Actors.

Beispiel — Nachricht senden:

{
  "actorId": "enemy-spawner",
  "message": { "type": "SPAWN_WAVE", "payload": { "wave": 3 } }
}

Hinweis zur Reihenfolge: ActorSystem leert den Posteingang jedes Actors, bevor update() aufgerufen wird. Nachrichten, die während Frame N gesendet werden, werden vollständig verarbeitet, bevor die Update-Logik von Frame N ausgeführt wird.


Entwicklung

npm run lint        # TypeScript type-check (no emit)
npm test            # run Vitest suite
npm run test:watch  # watch mode

Die Tests befinden sich in src/tests/. Sie decken Eingabevalidierung, Tool-Dispatch und Sicherheitsinvarianen ab (Pfad-Traversal, Shell-Metazeichen-Injektion, unbekannte Toolnamen).


Ein Tool hinzufügen

  1. Erstelle src/tools/<domain>.ts — exportiere einen toolDef-Array-Eintrag und eine handler- Funktion.

  2. Registriere beide in src/tools/index.ts über den register()- Aufruf in buildRegistry().

  3. Füge einen Eintrag zu api-reference.json in emptysock-engine hinzu.

  4. Füge eine Skill-Datei zu eleferrets/emptysock-ai-skills hinzu.

Verwende die gemeinsamen Helfer in src/lib/:

  • parse(schema, raw) — Zod-Parse, der bei einem Fehler McpError(InvalidParams) wirft

  • SafeRelPath, SafeId, Vec2, Vec3, GameNum — wiederverwendbare Zod-Schemas

  • textResponse(data) — erstellt die standardmäßige MCP-Textinhalts-Antwort

  • wrapError(err) — protokolliert auf stderr und wirft ihn als McpError(InternalError) erneut


Sicherheitsmodell

Risiko

Gegenmaßnahme

Fehlerhafte Argumente

Zod-safeParse für jede Eingabe; bei Fehlern wird McpError(InvalidParams) zurückgegeben

Pfad-Traversal

Schema SafeRelPath + Eingrenzungsprüfung über path.resolve im Speicher-Handler

Shell-Injektion

Kein exec() mit Template-Strings; execFile mit argv-Arrays, wenn Subprozesse benötigt werden

Leakage von Zugangsdaten

Geheimnisse nur aus process.env; Stacktraces werden nach stderr protokolliert, nie an den Client

Übergroße Eingaben

Stringlängen sind auf jedem Schema-Feld begrenzt

Unbekannte Tools

McpError(MethodNotFound) — kein Durchreichen an unbeabschtigte Handler

Available Tools

21 tools
actor_broadcastB

Broadcast a message to all registered actors in the current ActorSystem.

Inputs: message (required).

actor_inbox_sizeB

Return the number of pending messages in an actor's inbox.

Inputs: actorId (required).

actor_send_messageA

Enqueue a message in a specific actor's inbox. The actor processes it on the next flush pass.

Inputs: actorId (required), message (required).

emptysock_layer_infoA

Return reference documentation for the EmptySock LayerSystem API: defineLayer, addToLayer, setVisible, setParallax, and RenderSystem integration.

Inputs: no named parameters.

gms2_inspect_projectA

Read a GameMaker Studio 2 .yyp project file and return a JSON summary: project name, asset counts by type, and lists of object and script names. Read-only — does not modify any files.

Inputs: yypPath (required).

particle_emitter_configA

Get or set a ParticleSystem emitter configuration by emitter ID. Omit config to read; provide config to write.

Inputs: emitterId (required), config.

physics_body_stateA

Return the current position, velocity, and angular velocity of a physics body by entity ID.

Inputs: entityId (required).

physics_overlap_circleB

Return all entity IDs whose 2D colliders overlap a circle.

Inputs: center (required), radius (required), layerMask.

physics_raycast_2dB

Cast a ray in 2D physics space and return the first hit entity, hit point, and normal.

Inputs: origin (required), direction (required), maxDistance (required), layerMask.

physics_raycast_3dC

Cast a ray in 3D physics space (Rapier3D) and return the first hit.

Inputs: origin (required), direction (required), maxDistance (required), layerMask.

save_deleteA

Delete a save slot from disk.

Inputs: slot (required).

save_listA

List all available save slots.

Inputs: subdir.

save_readA

Read a save slot from disk and return its JSON data.

Inputs: slot (required).

save_writeA

Write JSON data to a save slot on disk.

Inputs: data (required), slot (required).

scene_create_entityC

Add a new entity to a scene. Returns the new entity's ID.

Inputs: sceneId (required), tag, components.

scene_entity_infoC

Return the tag, active state, and component list for a specific entity.

Inputs: sceneId (required), entityId (required).

scene_get_componentB

Retrieve the serialised state of a specific component on an entity.

Inputs: sceneId (required), entityId (required), componentType (required).

scene_list_entitiesB

List all entity IDs currently active in a scene.

Inputs: sceneId (required).

story_graph_exportA

Export the Story Graph (VNSystem) for a named scene as a JSON object containing nodes and edges.

Inputs: sceneId (required), graphId.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 21 tools

    Disambiguation5/5

    Tools are clearly separated by domain (navmesh, physics, scene, save, actor, etc.) and each tool targets a distinct action or query. Even within physics, 2D and 3D raycasts are explicitly differentiated. No two tools appear to do the same thing.

    Naming Consistency5/5

    All tools follow a consistent domain_verb_noun pattern (e.g., scene_create_entity, save_list, actor_send_message). Suffixes like _2d and _3d are uniform, and the one odd name (emptysock_layer_info) still adheres to the same style. Naming is predictable and coherent.

    Tool Count3/5

    With 21 tools, the count falls in the 16-25 range, which is borderline heavy. However, the server covers many distinct subsystems, so each tool arguably earns its place, but the overall number feels slightly excessive for a single MCP server.

    Completeness3/5

    The set covers core read/query operations across multiple domains, but there are notable gaps: scene entities can be created and inspected but not updated or deleted, physics only offers queries (no manipulation), and particle control is limited to configuration. This leaves some lifecycle operations incomplete.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables LLM-driven text game state management by exposing MCP tools for managing players, locations, items, entities, and abstract concepts.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server enabling AI agents to author Unreal Engine 5 scenes directly, with tools for spawning actors, building PCG graphs, validating physics, generating terrain, and more through a single MCP connection.
      13
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects Claude Code to the Unity Editor via MCP, enabling AI-driven control of scenes, assets, components, UI, animations, and more through 91 tools.
      2
      MIT
    • A
      license
      C
      quality
      C
      maintenance
      Enables AI-driven game development by providing MCP tools to interact with the Godot editor, including scene editing, node manipulation, script attachment, and scene execution.
      28
      14 npm
      MIT