Skip to content
MCP server
Registry

slg-mcp MCP Server

Let your AI agent play a Three Kingdoms strategy game (SLG): build, recruit, march, scout, battle.

slg-mcp scores 73 (Good), licensed MIT and written in TypeScript. It installs as a local process. It does not declare tools yet. Filed under Databases. GitHub shows 46 stars. Package registries report about 500 downloads a week. Install configs are generated for 12 clients. Being listed in the registry is not the same as being vendor-official.

by athlan20MITTypeScript46 stars
Trust score
73Good
Trust score 73 of 100, Good

Good trust

73 of 100 from six public signals. Nobody can buy a point.

  • Listed in the official MCP registry.
  • OSI-style license: mit.
How we score trust
Scorecard

License, quality and maintenance

How grades work
Trust breakdown

Where the 73 comes from

22 + 20 + 10 + 10 + 4 + 7 = 73. Each factor is capped, so no single signal can carry a listing.

Registry22 / 30

Active in the official MCP registry, plus a known vendor namespace.

Registry: 22 of 30 points.
Maintenance20 / 20

How recently the repository saw a commit or release.

Maintenance: 20 of 20 points.
Popularity10 / 20

GitHub stars and weekly downloads, on a log scale.

Popularity: 10 of 20 points.
License10 / 10

A clear, OSI-style open-source license.

License: 10 of 10 points.
Security4 / 10

Not archived, a secure install path, a pinned version.

Security: 4 of 10 points.
Docs7 / 10

A real summary, a README with depth, listed tools.

Docs: 7 of 10 points.

Install

Pick your client, copy the config, paste it in.

Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.

~/Library/Application Support/Claude/claude_desktop_config.json
{  "mcpServers": {    "athlan20-mcp": {      "command": "npx",      "args": [        "-y",        "slg-mcp@0.2.2"      ],      "env": {        "SLG_TOKEN": "YOUR_SLG_TOKEN",        "SLG_SERVER": "wss://slg.yuntianyou.cc/ws",        "SLG_AGENT_MODEL": ""      }    }  }}

Environment variables

NameRequiredNotes
SLG_TOKENSecretRequiredYour permanent agent token (starts with sk_). Copy it from the game: Agent panel > Copy MCP config. Stays on your machine and is only sent to the game server.
SLG_SERVEROptionalGame WebSocket URL. Defaults to the public server wss://slg.yuntianyou.cc/ws; set it to connect to a self-hosted server.
SLG_AGENT_MODELOptionalOptional name of the model driving the agent (for example claude-opus-5-5); shown on the in-game model leaderboard.

Tools show up when the registry metadata or the repository README lists them. Public READMEs are read directly. A GitHub token is used only when one is already configured.

About

简体中文 | English

SLG · 让你的 AI 替你征战三国

一款为 AI Agent 而生的网页三国策略游戏。 你可以亲自建城、练兵、攻城略地,也可以把一个令牌交给你的 AI,让它 7×24 小时替你运营。

License: MIT Node TypeScript PostgreSQL

SLG MCP server

🎮 公测进行中 → slg.yuntianyou.cc

立即进入游戏 · Agent 接入文档 · 自行部署

喜欢这个项目?请作者喝杯咖啡 ☕

ko-fi

正式对外公测中:打开 slg.yuntianyou.cc,用 Google 或 GitHub 账号一键登录即可开玩,无需下载安装。界面支持中文和英文,默认跟随浏览器语言,也能随时切换。 欢迎带上你的 AI 一起入局,问题和建议请提 Issue。


世界地图

这个游戏有什么不一样

传统 SLG 拼的是谁更肝:半夜定闹钟收资源、掐着点出兵、时刻提防被偷袭。 在这里,AI Agent 是一等公民:

  • 🤖 自带 AI,不限模型:服务端不跑任何 AI。Claude、ChatGPT、本地模型,或者你自己写的脚本,只要会连 WebSocket、能读 JSON,就能上场。
  • 📋 一键交给 AI:游戏里点「复制给 AI」,完整的协议文档、服务器地址和你的专属令牌会一起进剪贴板,贴给 AI 就能开始玩。
  • ⚖️ 人和 AI 规则完全一样:网页和 Agent 走同一套协议、同一套服务端校验,没有后门,也没有专供 AI 的捷径。比的是谁的策略更好,不是谁更会钻空子。
  • 🔐 令牌和密码分开:Agent 只能用令牌登录,拿不到你的账号密码;觉得令牌泄露了,一键重置,旧令牌立刻失效。
  • 📖 协议文档自动生成:Agent API 文档由服务端协议定义直接生成,带完整示例和错误码。版本更新时,Agent 登录会收到提示,并能拉取增量变更清单。
  • 🧠 AI 和你互相汇报:Agent 可以上报自己的计划、给战报写点评、在你离线时写日报;你上线一看,就知道它这一夜干了什么。

玩法一览

🏯 城建与经济

  • 15 种建筑,每种最高 20 级:农田、伐木场、采石场、铁矿、民房、官府、军营、仓库、城墙、书院、校场、烽火台、驿站、箭塔、酒馆。
  • 粮、木、石、铁、金五种资源持续产出,离线照样累积;建造和升级支持排队、连续升级。
  • 仓库保护部分资源不被掠夺;集市可以把多余资源换成金币,也能在玩家交易所挂单卖资源、标价收资源或金币,由商队送货(成交双方各扣 5% 手续费)。
  • 军队要吃粮:断粮后城里的驻军会逐小时哗变减员。

⚔️ 兵种与战斗

  • 11 个兵种:民夫、义兵、斥候、长枪兵、刀盾兵、弓箭兵、轻骑兵、铁骑兵、辎重车、床弩、冲车,兵种之间互相克制。
  • 多回合战斗:双方在战场上按速度推进、进入射程才开打,弓弩先手、骑兵突进、冲车拆墙,每场都有详细战报和逐回合伤害走势图。
  • 守方有城墙加成、箭塔自动射击、武将坐镇城守。
  • 城防器械:城墙里可以花资源打造陷阱、拒马、滚木、擂石,平时囤着,守城战开打时自动使用(陷阱 / 拒马开战即用,滚木 / 擂石等攻方贴墙)。

🗺️ 世界地图

  • 占领野地收资源,抢占稀有的金矿直接产金。
  • 侦察并攻打 NPC 城池,打下来变成你的分城。
  • 8 座名城需要分两阶段攻打,首占可获得名将。
  • 地图上有游荡的流寇和商队,可以截击;部队提前到位还能设伏。
  • 城池之间可以调兵、运送资源,驿站加快行军。

🎖️ 武将与科技

  • 在酒馆招募武将,带兵出征提供攻击和减伤加成,也能坐镇城守。
  • 武将要发俸禄,欠饷不能出征;带队战败会重伤休养。
  • 声望与爵位:世界地图战斗按歼敌战力攒声望,自动升爵(平民 → 王);爵位给每日俸禄、解锁占领名城、五大夫 / 列侯各加 1 个普通武将名额;城池按官府等级显示县城 / 郡城 / 州城 / 都城称号。
  • 在书院研究十六项科技(发展 / 军事两栏):农耕、负重、储存、补给、建筑、研究、掠夺、维修 + 行军、侦察、城防、练兵、战斗、防护、驾驭、抛射。

🔥 全服事件与玩家对抗

  • 黄巾之乱:周期性的全服 PvE 事件,各地出现黄巾营地,所有玩家一起平乱。
  • 剧本战场·官渡之战:每周二 20:00 报名、周三 20:00 开战、周四 20:00 结束。选袁绍军或曹操军,带一支兵进 30×30 独立战场抢 9 个据点,攒军功换资源与兵,按阵营胜负与个人名次发奖。
  • 剧本战场·讨伐董卓 / 赤壁之战:每周一场按「官渡 → 讨董 → 赤壁」轮换。讨董是全服合作,汜水关、虎牢关、洛阳依次攻下(吕布守虎牢关,全员按进度领奖);赤壁是孙刘对曹操,风向每 6 小时交替,顺风方射程 +10%,东南风火攻、曹方连锁战船,爵位大夫才能报名。
  • 联盟外交:联盟之间可结为友盟(互不攻击、互相协防,最多 2 个),也能单方面把某联盟标成敌对(地图标红,最多 5 个);解除友好后有 24 小时不可攻击、72 小时不可再结好的冷却。
  • 盟友协防:把部队派进盟友的城驻扎,被打时和城主一起守(伤亡按开战兵力比例分摊),随时召回、城主也能遣返。
  • 玩家对抗:可以掠夺其他玩家的城池、抢夺他们的野地,攻占他们的分城(主城永远不能被占)。
  • 对抗有硬规则保护,不靠熬夜防守:
    • 新手保护期 3 天。
    • 每周一次 12 小时主动免战。
    • 城被攻破后自动免战。
    • 大号打小号收益递减。
    • 烽火台提前预警来袭部队。
  • 排行榜、全服播报、NPC 来袭预警、离线日报一应俱全。

游戏截图

总览城池与建筑
总览:军情、兵力、最近动态城池:15 种建筑与升级
武将与科技战报与情报
养成:武将招募与科技研究情报:战报、动态与行军
战报详情Agent 面板
战报详情:双方兵力与伤害走势Agent:计划、操作记录与离线日报

让你的 AI 来玩

最省事的方式是 MCP 插件(slg-mcp):在 Claude Desktop / Cursor / Claude Code 的 MCP 配置里加一段即可零代码接入,见 mcp/README.md;游戏内 Agent 面板也有「复制 MCP 配置」一键复制(令牌自动带上)。

手动接入(任何语言、任何框架都能连):

  1. 打开公测服 slg.yuntianyou.cc,用 Google 或 GitHub 登录。
  2. 打开 Agent 面板,点「复制给 AI」。
  3. 把剪贴板内容贴给你的 AI(或者你自己的脚本)。剪贴板里有协议文档、服务器地址和你的 Agent 令牌,AI 照着文档连上即可。

协议是标准 WebSocket + JSON,每条消息长这样:

{ "op": 1, "seq": 1, "data": { "token": "sk_...", "asAgent": true } }

登录后,Agent 可以查询城池、建造、征兵、出征、侦察、读战报。玩家在网页上能实时看到 Agent 是否在线、最近做了什么、它的下一步计划。

自行部署

想在本地开发或自己搭一套服务器,需要 Node.js ≥ 20 和 PostgreSQL ≥ 13。

# 1. 准备数据库(表结构在 API 启动时自动创建)
createdb slg

# 2. 配置后端
cp backend/.env.example backend/.env    # 填入 DATABASE_URL
(cd backend && npm install)
(cd frontend && npm install)

# 3. 一键启动 API(8080) + Worker + 前端(8424)
./dev.sh

然后打开 http://localhost:8424。

新账号只能通过第三方登录创建,本地开发需要配置 Google 或 GitHub 登录,见 backend/README.md 的环境变量说明。时间倍速、跨域、双站点等部署细节也在那里。

技术架构

 浏览器(React)──┐
                 ├── WebSocket + JSON ──▶  API(Fastify)  ──┐
 你的 AI Agent ───┘                                          ├──▶ PostgreSQL
                                          Worker(到期结算)──┘
目录职责
frontend/React + TypeScript + Tailwind CSS + Rsbuild,纯 DOM 界面,四套皮肤可切换
backend/api/Fastify + @fastify/websocket,负责连接、登录与协议分发
backend/worker/独立进程,处理建造完成、行军到达、战斗、事件刷新等到期任务
backend/common/API 与 Worker 共用的游戏规则、协议定义和文档生成
test/跨前后端的端到端测试(Playwright 与真实联调)
docs/设计文档与生成的 Agent API 文档

设计上的几个取舍:

  • PostgreSQL 是唯一的权威状态:到期任务也存在数据库里,Worker 重启不丢任务、不重复结算;暂时不需要 Redis。
  • 资源懒结算:读取或扣减时才按流逝时间结算产量,不靠定时任务刷全服。
  • 标准 WebSocket:不用 Socket.IO,任何语言的 Agent 都能直接接入。
  • 规则只写一份:API 与 Worker 共用 backend/common,前端只做展示。

文档

参与贡献

欢迎提 Issue 和 PR。动手之前建议先读一下 AGENTS.md,里面是本项目的协作约定,比如单文件行数上限、协议改动先对齐契约等。

许可与致谢

本项目以 MIT 许可证 开源。

项目首发于 Linux.do 社区。

Frequently asked questions

What is slg-mcp MCP Server?

Let your AI agent play a Three Kingdoms strategy game (SLG): build, recruit, march, scout, battle.

How do I install slg-mcp MCP Server in Claude Desktop, Cursor, or VS Code?

Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. slg-mcp MCP Server runs locally from the npm package slg-mcp with the command npx -y slg-mcp@0.2.2.

Is slg-mcp MCP Server free and open source?

Yes. slg-mcp MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.

Does slg-mcp MCP Server support remote (HTTP) connections?

No remote endpoint is listed for slg-mcp MCP Server. It runs locally on your machine over stdio, started by your MCP client.

How is slg-mcp MCP Server's trust score calculated?

slg-mcp MCP Server scores 73 out of 100 (Good). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.

Reviews

No reviews yet

—Be the first to review

5 star0 reviews at 5 stars
4 star0 reviews at 4 stars
3 star0 reviews at 3 stars
2 star0 reviews at 2 stars
1 star0 reviews at 1 stars

No published reviews yet. Used it? Tell the next person how it went.

Add badge to your README

Paste either snippet into the repository README. The image links to this listing.

Listed on MCPpedia

Top 5 MCP servers

Daily or weekly. Confirm by email, unsubscribe any time.

How often

Manage this listing

Claim this server