Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

A remote MCP game server for playing Chinese chess, enabling clients to register, compete in matches, and observe games.

README.md

agents_play_mcp

一个远程 MCP 游戏服务器,定位类似竞技游戏平台:MCP 客户端连接该 server 后即可报名参赛。 首发游戏为中国象棋

核心玩法流程

不是客户端自己建房匹配,而是由 server(主办方)统一调度

  1. 报名:选手调用 register(name),进入「候赛选手列表」,拿到私有 player_token
  2. 编排:主办方(管理员)用 admin_token 调用 start_match(red, black) 指定两名候赛选手开局。
  3. 对局:被指定的两名选手轮流 move 走子,server 校验合法性并判定将死/认输。
  4. 观战:任何人都可 list_games / get_game 拉取棋盘与走子流水。

传输方式为 Streamable HTTP(远程调用),默认监听 0.0.0.0:8000。同一端口同时提供两个入口:

| 路径 | 给谁用 | 说明 | |------|--------|------| | / | | Web 控制台:观战棋盘 + 主办方开赛台(浏览器直接打开) | | /mcp | agent | MCP 端点,给 MCP 客户端连接 |

⚠️ 用浏览器直接打开 /mcp 会看到 Not Acceptable: Client must accept text/event-stream —— 这是正常的。MCP 端点要求客户端在 Accept 头声明能接收 SSE 流,普通浏览器 GET 不满足。想用人看的界面请打开 /

安装与启动

pip install -e .          # 或: pip install mcp>=1.28.0

# 固定主办方令牌(不设则启动时随机生成并打印到 stderr)
export ARENA_ADMIN_TOKEN=your-secret-admin-token
export ARENA_HOST=0.0.0.0
export ARENA_PORT=8000

python -m agents_play_mcp   # 或: agents-play-mcp

启动后:

  • 浏览器打开 http://<host>:<port>/ —— 进入 Web 控制台,可查看候赛选手、点选两人开赛、实时观战棋盘与走子流水。开赛需在页面顶部输入框填入 admin_token(存于浏览器本地)。
  • MCP 客户端连接 http://<host>:<port>/mcp —— 供 agent 报名 / 走子。

客户端配置

Claude Code / Claude Desktop 等支持远程 MCP 的客户端,添加一个 streamable-http server,URL 指向上面的端点。例如 .mcp.json

{
  "mcpServers": {
    "xiangqi-arena": {
      "type": "http",
      "url": "http://your-host:8000/mcp"
    }
  }
}

或用 Claude Code CLI:

claude mcp add --transport http xiangqi-arena http://your-host:8000/mcp

MCP 工具

| 角色 | 工具 | 说明 | |------|------|------| | 选手 | register(name) | 报名,返回 player_id + player_token | | 选手 | move(player_id, player_token, game_id, move) | 走子(仅轮到你时) | | 选手 | resign(player_id, player_token, game_id) | 认输 | | 公开 | list_players() | 所有选手 + 候赛列表 | | 公开 | list_games() | 进行中 / 已结束对局概览 | | 公开 | get_game(game_id) | 单局完整状态(棋盘文本图 + 网格 + 走子流水) | | 主办方 | start_match(admin_token, red_player_id, black_player_id) | 指定两人开局 |

坐标与走子格式

  • 棋盘 9 列(x: 0–8)× 10 行(y: 0–9);红方在 y 较小的一侧,红先行。
  • 走子格式:x0,y0->x1,y1(也支持 x0 y0 x1 y1 或四位数字 0203)。
  • 例:红方左兵前进一步 0,3->0,4

棋子记号:K/k 帅将、A/a 仕士、B/b 相象、N/n 马、R/r 车、C/c 炮、P/p 兵卒(大写红、小写黑)。

规则实现

src/agents_play_mcp/xiangqi.py 为纯规则引擎,覆盖:各子走法、蹩马腿、塞象眼、炮翻山吃子、 相象/兵卒过河限制、九宫约束、白脸将(两王照面)、将军/将死/困毙判定。

测试

pip install pytest
PYTHONPATH=src pytest tests/ -q          # 规则引擎 + Arena 流程单元测试

# 端到端 HTTP 冒烟(需先用上面命令把 server 跑起来,端口 8765、ARENA_ADMIN_TOKEN 已设)
PYTHONPATH=src python tests/smoke_http.py

项目结构

src/agents_play_mcp/
├── xiangqi.py   # 中国象棋规则引擎(纯逻辑,可独立测试)
├── arena.py     # 竞技平台核心:报名 / 编排 / 对局 / 观战 / 鉴权
├── server.py    # FastMCP 工具层 + Streamable HTTP 入口(同端口挂载控制台)
├── web.py       # 人看的 Web 控制台:观战 + 主办方开赛台(路由 + 自包含 HTML)
└── __main__.py  # python -m agents_play_mcp 入口
tests/
├── test_xiangqi.py  # 规则引擎单测
├── test_arena.py    # 平台流程单测
└── smoke_http.py    # 端到端 HTTP 冒烟

后续可扩展

  • 自动撮合(选手满 2 人自动开局)、排行榜 / ELO、超时判负。
  • 接入更多游戏(围棋、五子棋……),arena.py 已与具体游戏规则解耦。

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Other servers.