MCP server

Dungeon Master MCP

A text adventure that runs as an MCP server on the 2026-07-28 spec and TypeScript SDK v2. It puts the protocol's advanced features to work: elicitation, sampling, progress and cancellation, resource subscriptions and tools that change with the game. The AI tells the story; the server owns the rules.

MCPTypeScriptZodElicitationSampling

How it runs

  1. Trigger

    Play by chatting with the AI

    VS Code chat / MCP Inspector

    The player talks to an AI client. The AI narrates and calls the server’s tools, and every tool is annotated as read-only, destructive or closed-world so the client knows what it is about to do.

  2. Tool

    Ask the player, never the model

    Elicitation

    search_place has no input for the player’s choice. The server opens a popup and asks the player directly, then validates the answer against the current room, so the AI cannot guess on the player’s behalf.

  3. AI model

    Let the client's model describe the room

    Sampling

    look_around asks the client’s own model to write the room description. The key’s hiding place never goes into the prompt, the resources, the logs or any tool result.

  4. Tool

    Keep the numbers on the server

    Structured output

    HP, gold and keys are computed on the server and returned as structured content with an output schema. The AI can only narrate the result; it cannot change the score.

  5. Tool

    Change the tools as the game changes

    List changed + progress

    Tools turn on and off with the game state, and a hint prompt appears after three failures. Moving between rooms reports progress in three steps, and cancelling leaves the player where they were.

  6. Data store

    Save every change

    Resources + subscriptions

    The character sheet is a subscribed resource that updates when HP, gold or keys change. Clues unlock only after the player finds them, and the game is saved on every change so a server restart loses nothing.

The whole run

Six steps, from VS Code chat / MCP Inspector to Resources + subscriptions, drawn end to end.