Skip to main content
Glama

Gym MCP - AI Gaming Platform

A Model Context Protocol (MCP) server that exposes games as tools for AI agents to discover and play.

🚀 Quick Start

Requirements

  • Python 3.10+

  • MCP-compatible client (Claude Desktop, etc.)

Installation

Using pip:

git clone <this-repo>
cd gym-mcp
pip install -e .

Or using uv (recommended by Dedalus Labs):

git clone <this-repo>
cd gym-mcp
uv sync

Run the Server

# With pip
python main.py

# With uv
uv run main

Test the Server

python test_fastmcp.py

Related MCP server: game-mcp

🎮 Available Games

  • Tic-Tac-Toe: Classic 3x3 grid game with X and O

🛠️ Available Tools

Core Game Tools

  • list_games - Discover available games and active instances

  • start_game - Initialize a new game with players

  • make_move - Execute game actions

  • get_game_state - View current game state

  • reset_game - Reset game to initial state

Game-Specific Tools

  • tic_tac_toe_place_mark - Place X or O on the board

📋 Claude Desktop Integration

Add to your Claude Desktop claude_desktop_config.json:

{
  "mcpServers": {
    "gym-mcp": {
      "command": "python",
      "args": ["main.py"],
      "cwd": "/path/to/gym-mcp"
    }
  }
}

🎯 Example Usage

# Discover available games
list_games()

# Start a tic-tac-toe game
start_game(game_type="tic-tac-toe", players=["Alice", "Bob"])

# Make moves using generic tool
make_move(game_id="uuid", action_type="place_mark", payload={"row": 1, "col": 1}, player="Alice")

# Or use game-specific tool
tic_tac_toe_place_mark(game_id="uuid", row=0, col=0, player="Bob")

# Check current state
get_game_state(game_id="uuid")

🏗️ Architecture

Core Components

  • FastMCP: Simple, decorator-based MCP server

  • Game Registry: Manages available game types and active instances

  • Game Interface: Abstract base class defining game contract

  • Dynamic Tools: Each game registers custom MCP tools

Per-Game Tools

Each game can define its own specific tools:

  • Tic-Tac-Toe: tic_tac_toe_place_mark(game_id, row, col, player)

  • Future games: Chess could have chess_castle, chess_en_passant, etc.

Stateless Design

  • Games stored in memory per server session

  • No authentication required

  • Clean separation between game logic and MCP protocol

🔧 Adding New Games

  1. Create game class inheriting from Game:

    class Chess(Game):
        def start(self, players): ...
        def make_move(self, action): ...
        def get_state(self): ...
        # etc.
  2. Define game-specific tools:

    @classmethod
    def get_tool_definitions(cls):
        return [GameToolDefinition(
            name="chess_castle",
            description="Perform castling move",
            input_schema={...}
        )]
  3. Register in the registry:

    registry.register_game_type(Chess)
  4. Add FastMCP tool handlers in server.py

🌟 Future Plans

  • OpenAI Gym Integration: Wrap Gymnasium environments

  • PettingZoo Support: Multi-agent games (Chess, Poker, etc.)

  • Real-time Games: WebSocket support for faster interactions

  • Tournament Mode: AI vs AI competitions

  • Spectator Tools: Watch games in progress

🏛️ Architecture Benefits

For AI Researchers

  • Standardized game testing environments

  • Consistent APIs across all games

  • Easy benchmarking and evaluation

For Developers

  • Simple game integration (just implement the interface)

  • Automatic MCP tool generation

  • Built-in state management

For AI Agents

  • Unified discovery mechanism (list_games)

  • Consistent interaction patterns

  • Game-specific optimization opportunities


Built with FastMCP following Dedalus Labs MCP Guidelines

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

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/IshanTiwari0112/gym-mcp'

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