YGOPro Duel MCP
by 301zrg
README.md
# YGOPro Duel MCP
用你已有的 AI 客户端,把 AI 带进 YGOPro 普通房对战。首版支持 706 / OCG 1103(2011 年 3 月禁限、大师规则 2),包括单局、BO3 和局间换副。
## Windows 开始使用
1. 下载 `ygopro-duel-mcp-0.1.0-win-x64.zip`,解压到一个固定目录。包里有 Node.js,无需另外安装。
2. 双击 `generate-mcp-config.cmd`。Codex 用户把生成的 `codex-config.toml` 内容追加到 `%USERPROFILE%\.codex\config.toml`。支持 `mcpServers` 的客户端,把 `mcp-config.json` 中的 `ygopro-duel` 条目加入各自的 MCP 配置。Claude Code 的项目配置可用 `.mcp.json`,Gemini CLI 可用用户目录下的 `.gemini/settings.json`。已有配置时合并相应条目,保留原来的内容。重新打开客户端,允许加载你刚添加的 MCP 服务。
3. 用 706 客户端进入 `121.4.34.71:7911`,建一个普通房。把实际房名填进下面这句话发给 AI。两边准备好后,由玩家按开始。
> 用 ygopro-duel 加入我建好的普通房「我的房名」,昵称用「[AI] 对手」。每次按工具给的合法选项自己判断,打到决斗结束后再复盘。
首次启动会从 [OCG 1103 Nexus](https://ocg1103nexus.com/) 下载并校验卡库、提示文本和禁限表,缓存到 `%LOCALAPPDATA%\ygopro-duel-mcp`。默认使用植物同调示例牌组。要换自己的卡组,在 MCP 配置的 `args` 末尾加上 `"--deck", "卡组的绝对路径.ydk"`,或开打前让 AI 通过 `get_deck` 和 `set_deck` 查看、调整。使用其他语言可加 `--lang en-US`、`ja-JP` 或 `ko-KR`。
本机对战时,先用 706 客户端创建局域网房,再把 `127.0.0.1`、房间端口及房名(如有)告诉 AI。同一台电脑上要由两个 AI 控制两席时,启动两个独立的 MCP 会话。服务只默认加入指定的普通房,`TT` 等匹配入口不可用于默认社区服务器。
## 源码与打包
需要 Node.js 24。运行 `npm ci`、`npm test`。MCP 客户端的启动命令为 `node`,参数为 `dist/src/mcp.js` 的绝对路径。已有 1103 资源时可以加 `--env <资源目录>`,并用 `--deck <牌组.ydk>` 指定卡组。
Windows 打包运行 `npm run pack:win -- -OutputDirectory <空输出目录>`。脚本校验并打包官方 Node.js x64 运行时,只安装锁定的运行时依赖。工具协议见 [局面与操作](docs/observation.md),实测组合见 [兼容性记录](docs/compatibility.md),独立 706 回环房主见 [构建说明](scripts/build-loopback/README.md)。
也可手动接 OpenAI 兼容接口或本地模型。以下示例使用玩家自己的本地模型。使用需要 API Key 的接口时,可加 `--api-key-env OPENAI_API_KEY` 从环境变量读取。
```text
node dist/src/autoplay.js --deck my.ydk --env <资源目录> --port <本机房间端口> --endpoint http://127.0.0.1:11434/v1 --model qwen3:8b
```
## License
[GPL-2.0-only](LICENSE). The loopback patch targets [mycard/ygopro](https://github.com/mycard/ygopro/tree/5e63f18). The portable ZIP includes Node.js under its own license. The starter deck and card data come from the OCG 1103 Nexus project. Yu-Gi-Oh! is a trademark of its respective rights holder.
## English quick start
Extract the Windows x64 ZIP, run `generate-mcp-config.cmd`, and add the generated MCP entry to your AI client. For Codex, copy the generated TOML section into `%USERPROFILE%\.codex\config.toml`. For JSON-based clients, merge the entry under `mcpServers`. Restart the client, create a named ordinary room on `121.4.34.71:7911` in the 706 client, and ask your AI to join that exact room using `ygopro-duel`. The first launch downloads and checks the card data. A starter deck is included. Pass `--lang en-US` to use English card text.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues