number-guessing-game-mcp-server

portal-labs-infrastructure/number-guessing-game-mcp-server

3.3

If you are the rightful owner of number-guessing-game-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Number Guessing Game MCP Server is a demonstration server implemented in TypeScript, showcasing a dynamic, session-based architecture for a simple number guessing game.

The Number Guessing Game MCP Server is a practical example of a Model Context Protocol (MCP) server designed to demonstrate dynamic, multi-user applications. Built using TypeScript, this server provides a scalable and clean architecture where each user session is isolated and managed independently. The server hosts a simple number guessing game, where users can start a game, make guesses, and give up if needed. The architecture leverages a single global McpServer to handle all connections, while an Express.js controller manages the lifecycle of each user session. The server is integrated with Firestore to persist game state and high scores, ensuring that the server remains stateless and scalable. This project serves as a learning resource for developers interested in building dynamic MCP applications.

Features

  • True Multi-User Sessions: Each user gets their own isolated game state and set of MCP entities.
  • Dynamic MCP Tools: Tools are enabled or disabled based on the user's game state.
  • Dynamic MCP Resources: Game state resources are created and destroyed per user session.
  • Scalable Architecture: A single global McpServer handles all connections with session-scoped entities.
  • TypeScript Implementation: Fully typed for better maintainability and developer experience.

Usages

usage with local development

{
  "mcpServers": {
    "number-guessing-game": {
      "command": "node",
      "args": ["index.js"]
    }
  }
}

usage with remote deployment

yaml
paths:
  /mcp:
    post:
      x-ms-agentic-protocol: mcp-streamable-1.0

usage with platform integration

{
  "command": "docker",
  "args": ["run", "-e", "GCP_PROJECT_ID", "-p", "8083:8083", "number-guessing-game-mcp-server"]
}

Tools

  1. start_game

    Initiates a new game session for the user.

  2. guess_number

    Allows the user to make a guess in the number guessing game.

  3. give_up

    Enables the user to give up on the current game session.