Battle Arena MCP Server

Battle Arena MCP Server

A multiplayer top-down action game where agents are controlled through MCP tools. Enables MCP clients to join and play by moving, attacking, and retreating.

Category
访问服务器

README

<p align="center"> <img src="extras/images/logo.png" width="360" alt="MCP Game" /> </p>

<h1 align="center">MCP Game</h1>

<p align="center"> A multiplayer, top-down action game where every character is played by an AI <strong>only</strong> through MCP tools — a full worked example of the mcp-gtw library. </p>

<p align="center"> <a href="https://github.com/mcp-gtw/demo-game/actions/workflows/ci.yml"><img src="https://github.com/mcp-gtw/demo-game/actions/workflows/ci.yml/badge.svg" alt="CI"></a> <a href="LICENSE.md"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT"></a> </p>


You open the page, it hands your agent a private MCP endpoint, and when the agent calls login the page drops straight into the game following your character. From there every tool — move, look, attack, shoot, chop, speak — acts as that character, since your identity is the session you connected through. The server is authoritative and reasons only in grid cells. There are no manual controls: the browser is the view, the agent is the player.

<p align="center"> <img src="extras/images/screenshot.png" width="300" alt="Gameplay screenshot" /> </p>

It is a single process built as one AppGateway(Gateway) subclass — it serves the MCP endpoint, the authoritative world, the live stream and the self-hosted Phaser client (with a local copy of Phaser, a vendored Roboto font and curated Tiny Swords art).

🚀 Quick start

make install        # python deps (pulls mcp-gtw) + build the client bundle
make run            # build the client, then serve everything on http://127.0.0.1:8000

Open http://127.0.0.1:8000, copy the shared MCP URL and token, and point your MCP client at it. Call login with a name (optionally a class — warrior/archer/monk/lancer — and a skin color — blue/yellow/purple/black; enemies are always red), then play. Open http://127.0.0.1:8000/?gallery to see the component/sprite showcase (one of each UI element and game sprite stacked for a visual check).

make test           # pytest + vitest
make coverage       # both suites behind their 100% coverage gates
make lint           # ruff check + format check

🧩 How it is built on the gateway

from mcp_gtw.gateway import Gateway

class AppGateway(Gateway):
    async def serve(self):
        # run the authoritative simulation and drive the per-browser session
        # websockets that give each agent a private channel to log in through
        ...

    def register_routes(self, app):
        super().register_routes(app)
        # add /app/info, /app/stream and the self-hosted client
        ...

The gateway stays domain agnostic — all game logic lives here. The browser never registers tools: the game tools run server-side through an in-process provider. See the gateway library guide.

📚 Documentation

Guide What it covers
The game Architecture, tools, endpoints and the world.
Authoring maps Editing and creating maps in the Tiled editor.
CLAUDE.md Every game rule and the module that owns it.

🗂️ Layout

.
├── src/app/
│   ├── gateway.py room.py room_manager.py provider.py session.py   # MCP + room session surface
│   ├── game.py world.py fsm.py classes.py colors.py attributes.py items.py weapons.py objects.py catalog.py
│   ├── npcs/             # Behavior, LootDrop, EnemySpec + registry (one class per file)
│   ├── maps/             # SpawnPoint, RenderObject, MapDefinition + loader
│   ├── entities/         # player, enemy, projectile, food, tree, pickup, coin
│   ├── helpers/          # grid geometry and directions
│   └── web/              # game art, Tiled map, fonts and the built client bundle (dist/)
├── client/               # Vite component client (scenes, ui kit, lib) + vitest tests
├── tests/                # unit and integration tests (100% coverage)
├── docs/
└── Dockerfile

✅ Requirements

  • Python 3.12+ — tested on 3.12, 3.13 and 3.14 in CI
  • uv
  • Node 22+ and npm (to build the Vite client)
  • A modern browser and any MCP client

🎨 Credits

The game art is the Tiny Swords pack by pixelfrogpixelfrog-assets.itch.io/tiny-swords — used for the units, terrain, water foam, decorations, buildings, UI and the login background. Please support the artist on itch.io.

The background music is by MaksymMalko on Pixabay — say thanks to MaksymMalko! This helps keep the creative spirit going. By using it you agree to the Pixabay license.

💜 Support

If this project saved you time, consider supporting it: GitHub Sponsors · Ko-fi.

Made with care by Paulo Coutinho.

Licensed under MIT.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选