Skip to main content
Glama
Ishika-Gadhwal

Snake MCP

🐍 Snake MCP App

A fully playable Snake game, built as an MCP App — play it directly inside ChatGPT, Claude, or any MCP-compatible chat client, no separate browser tab required.

Live server: https://snake-mcp.onrender.com/mcp

⚠️ Hosted on Render's free tier — the first request after ~15 minutes of inactivity can take 30–60 seconds while the instance wakes up. After that, it's instant.


What this is

This project demonstrates how a real game can be embedded directly inside any MCP-compatible client — ChatGPT, Claude, or anything else that speaks the protocol — turning a chat interface into a place you can actually play, not just talk.

Most MCP tool calls round-trip to the host for every single action, which makes anything real-time (like a game) feel laggy if implemented naively. This project avoids that by exposing just one MCP tool (start_game) that opens a self-contained, client-side HTML/JS app inside the host's UI. Once launched, the game runs entirely in the browser — movement, collisions, scoring — with zero network calls per frame, so it plays smoothly regardless of which MCP client it's running in.

Related MCP server: 魂斗罗 MCP Demo

Features

  • Classic Snake gameplay — arrow keys or WASD, Space to pause

  • Walls or No Walls (wrap-through) modes

  • Speed control — Slow / Medium / Fast, adjustable live mid-game

  • Pause / Resume

  • Bonus food — a pulsing ⭐ worth +50 points, appears randomly and disappears after 5 seconds if not eaten

  • Emoji food (🍎🍌🍇🍊🍓🍒🍉🍍) instead of plain shapes

  • Rounded, animated snake with a directional face

How to play

  1. Connect the MCP server URL above in your client (ChatGPT Developer Mode / custom app, Claude, or any MCP-compatible host).

  2. Ask it to start the game — e.g. "Start the snake game".

  3. Play using arrow keys, WASD, or the on-screen controls.

Architecture

ChatGPT / Claude / any MCP host
            │
            ▼
   start_game (MCP tool)
            │
            ▼
   ui://snake/game (MCP App resource)
            │
            ▼
  Self-contained HTML/CSS/JS
  (game logic runs entirely
   client-side after launch)
  • server.py — Python MCP server (mcp SDK v2) wrapped in a small Starlette app. Exposes the single start_game MCP tool (mounted under /mcp), plus a /health endpoint and a / info endpoint.

  • ui/ — Vite-built frontend. game.js contains the full Snake game logic (movement, collisions, scoring, bonus food) — nothing here calls back to the server during gameplay.

  • build_ui.py — inlines Vite's built CSS/JS into a single self-contained dist/mcp_app.html, since MCP App resources work best as one file with no external asset requests.

  • Dockerfile — two-stage build: Node stage builds the UI, Python stage runs the server. Used for deployment on Render.

Running locally

npm install
npm run build              # builds ui/ -> dist/mcp_app.html
python -m venv .venv
.venv\Scripts\activate      # Windows; use source .venv/bin/activate on macOS/Linux
pip install -r requirements.txt
python server.py            # runs on http://127.0.0.1:8000/mcp

Test it with MCP Inspector (Streamable HTTP, connect to http://127.0.0.1:8000/mcp) before connecting a live host.

Deployment

Deployed on Render as a Docker-based Web Service, built directly from this repo's Dockerfile. Any push to main triggers a new deploy.

Tech stack

  • MCP Python SDK v2 — server + Apps extension

  • Vite — frontend build

  • Vanilla JS/HTML5 Canvas — no frontend framework, kept intentionally lightweight

  • Render — hosting

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides a fully playable Flappy Bird game that runs inline within AI chat clients. It enables users to launch the game, submit scores, and track session high scores using Model Context Protocol tools.
    1
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables creating a Contra-style game session that can be played inline in MCP-compatible clients or via a browser fallback URL.
    5
    -
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables AI-driven interactions with Minecraft through a WebSocket-based server and MCP protocol, allowing external MCP clients and in-game chat to trigger AI tools.
    4
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A browser automation MCP server that lets your IDE control your real browser (Chrome/Brave) through natural language commands, handling side quests like messaging, form filling, and navigation without context switching.
    -