loading…
Search for a command to run...
loading…
An MCP server for the Genius Invokation TCG simulator that allows AI models to interact with the game through a structured interface. It provides comprehensive
An MCP server for the Genius Invokation TCG simulator that allows AI models to interact with the game through a structured interface. It provides comprehensive tools for querying game states, accessing indexed card data, and executing gameplay actions like elemental tuning and character selection.
为七圣召唤模拟器提供的 MCP (Model Context Protocol) 实现,使 AI 能够通过 MCP 接口与游戏交互并实现自动打牌功能。
本项目采用分层发布,降低对模拟器深度魔改的维护成本:
core:MCP 协议、工具、序列化、索引能力(本包的 src/)adapter:最小注入点(将 AI IO / state listener 接到模拟器)patch:对上游模拟器的显式补丁文件(patches/*.patch)这样可以在公开 MCP 与 Skills 的同时,把对客户端改动保持为可审计、可回放、可替换。
COMPATIBILITY.mdPATCHING.mdCONTRIBUTING.mdpatches/README.md../../../.opencode/skills/README.mddocs/ASSET_POLICY.mdMCPGTCG/
├── src/
│ ├── mcp/
│ │ ├── MCPProtocol.ts # MCP 协议常量和消息构建器
│ │ ├── MCPServer.ts # MCP 服务器实现
│ │ └── MCPToolHandler.ts # MCP 工具处理器
│ ├── AIClientPlayerIO.ts # AI 玩家 IO 实现
│ ├── GameStateListener.ts # 游戏状态监听器
│ ├── GameStateSerializer.ts # 游戏状态序列化器
│ ├── card-index/ # 卡牌索引构建与查询
│ └── index.ts # 主入口文件
├── examples/
│ └── integration.ts # 集成示例
├── package.json
├── tsconfig.json
└── tsup.config.ts
定义了 MCP 协议的常量、接口和消息构建函数,支持 JSON-RPC 2.0 通信。
MCP 服务器的核心实现,使用标准输入/输出进行通信,处理来自客户端的请求。
定义并处理所有可用的 MCP 工具,包括:
get_game_state, get_screen_state, get_available_commandsget_character_info, get_card_infochoose_action, elemental_tuning, choose_active, reroll_dice, switch_hands, select_card实现了 CancellablePlayerIO 接口,用于与游戏进行交互,缓存通知和等待 RPC 请求响应。
监听游戏状态变化,在游戏暂停时捕获当前状态和突变。
将游戏状态序列化为可通过 MCP 传输的格式。
从 @gi-tcg/data 源码注释构建卡牌索引(definitionId/name/description/contentHash),
并提供检索、解析、映射校验能力,降低 AI 在 ID 与卡牌效果之间错配的概率。
仓库默认不包含卡图二进制文件(packages/standalone/public/card_images/)。
docs/ASSET_POLICY.mdscripts/download-card-images.sh、scripts/download-card-images.ps1cd MCPGTCG
bun install
bun run build
bun run check
bun run build:card-index
索引输出到 packages/mcp/.cache/card_index.latest.json。
建议优先采用“补丁集成”方式(见 PATCHING.md),而不是长期维护完整 Fork。
示例命令:
bash packages/mcp/scripts/apply-standalone-patch.sh packages/mcp/patches/<patch-file>.patch
import { setupMCPGame, startMCPServerAndGame } from "@gi-tcg/mcp";
import { Version } from "@gi-tcg/core";
// 设置游戏
const { game, cleanup } = await setupMCPGame(
deck0Code, // 玩家0的牌组代码
deck1Code, // 玩家1的牌组代码
Version.V6_3_0, // 游戏版本
0 // AI 玩家位置
);
// 或者同时启动 MCP 服务器和游戏
await startMCPServerAndGame(
deck0Code,
deck1Code,
Version.V6_3_0,
0
);
get_game_state - 获取完整的游戏状态get_screen_state - 获取轻量级的屏幕状态(推荐用于大多数场景)get_available_commands - 获取当前状态下可用的命令列表get_character_info - 获取角色详细信息get_card_info - 获取卡牌详细信息list_cards - 分页列出索引中的卡牌/角色(可按 type/tags/nameLike 过滤)get_card_by_id - 按 definitionId 获取标准名称、效果文本和 contentHashresolve_card - 按名称/ID/效果文本模糊解析并返回候选及分数validate_card_mapping - 批量校验 definitionId 与名称映射是否一致choose_action - 选择要执行的动作elemental_tuning - 显式执行元素调和(按条件匹配调和动作,可自动使用 auto_selected_dice)choose_active - 选择首发角色reroll_dice - 选择要重掷的骰子switch_hands - 选择要换的初始手牌select_card - 从候选卡牌中选择本项目参考了 MCPTheSpire 项目的架构,并针对七圣召唤的特点进行了适配。
AGPL-3.0
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mcpgtcg": {
"command": "npx",
"args": []
}
}
}Web content fetching and conversion for efficient LLM usage.
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also