🎮 hoppinai-mcp-red95
基于循环工程驱动的红警智能体 🚀
环境要求
JDK17+
🎥 演示视频
https://www.bilibili.com/video/BV1v8Kr6xEjv/
📋 环境要求
git、dotnet6.0、JDK17+
🚀 开始使用
代码拉取 💻
- 1️⃣ 从git上拉取红警源代码: https://gitee.com/hoppin/OpenRA.git
- 2️⃣ 切换到code_gen_test分支
游戏构建 🏗️
根据源代码构建即可,windows示例:(在OpenRA文件夹内执行指令)
textdotnet restore --source https://nuget.cdn.azure.cn/v3/index.json dotnet build
💡 提示:C#运行环境dotnet建议可以安装Visual Studio的C#相关内容
运行游戏 🎯
执行指令即可运行游戏:
text.\launch-game.cmd Game.Mod=copilot
或者在源代码的CmdTools文件夹内将OPENRA_PATH替换为OpenRA文件夹的绝对路径:
java@Service public class CmdTools { private static final String OPENRA_PATH="D:\\myProject\\github\\OpenRA"; @Tool(name = "start_game",description = "开启游戏,仅当用户要求开启游戏时,才会使用该工具,注意:开启完游戏后,不要执行任何工具!!!") public String startGame(){ try { String cmd = "cmd /c cd "+OPENRA_PATH +"&& .\\launch-game.cmd Game.Mod=copilot"; Runtime runtime = Runtime.getRuntime(); runtime.exec(cmd); } catch (Exception e) { e.printStackTrace(); } return "ok"; } }
启动mcpServer(即本工程),系统会打印端口号。
MCP配置 ⚙️
在任意智能体内,设置mcp.json(看你是stdio还是sse,这里默认是stdio):
json{ "mcpServers": { "红警95_stdio": { "enabled": true, "command": "java", "args": [ "-Dfile.encoding=UTF-8", "-Dsun.stdout.encoding=UTF-8", "-jar", "D:\\mcp\\mcp-demo-red95-1.0.jar" ] }, "红警95_sse": { "enabled": false, "url": "http://localhost:9002/sse" } } }
设置完成后,即可开始对话交互!




