# slg-mcp

MCP server slg-mcp for Claude Code lets an AI agent play a Three Kingdoms strategy game. Activated via the MCP configuration before running.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 43 repo stars
- Author: athlan20
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/athlan20/slg/tree/HEAD/mcp
- Updated: 2026-11-16
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/slg-mcp

## What it does

The server exposes around thirty-five tools to inspect cities, construct buildings, recruit units, launch marches, and read battle reports. Notifications such as construction finishes and incoming attacks buffer locally and are read incrementally through specific tools. Setup requires Node.js 20 or newer and a valid agent token `SLG_TOKEN`.

Connections to the game backend reconnect automatically, using the default public endpoint or a custom WebSocket URL in `SLG_SERVER`. The agent can also report its model name via `SLG_AGENT_MODEL` to appear on the in-game leaderboard.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `SLG_TOKEN`, `SLG_SERVER`, `SLG_AGENT_MODEL` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env SLG_TOKEN=<SLG_TOKEN> --env SLG_SERVER=<SLG_SERVER> --env SLG_AGENT_MODEL=<SLG_AGENT_MODEL> --transport stdio mcp -- npx -y slg-mcp
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add mcp --env SLG_TOKEN=<SLG_TOKEN> --env SLG_SERVER=<SLG_SERVER> --env SLG_AGENT_MODEL=<SLG_AGENT_MODEL> -- npx -y slg-mcp
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "mcp": {
            "command": "npx",
            "args": [
                "-y",
                "slg-mcp"
            ],
            "env": {
                "SLG_TOKEN": "<SLG_TOKEN>",
                "SLG_SERVER": "<SLG_SERVER>",
                "SLG_AGENT_MODEL": "<SLG_AGENT_MODEL>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "slg-mcp"
            ],
            "env": {
                "SLG_TOKEN": "<SLG_TOKEN>",
                "SLG_SERVER": "<SLG_SERVER>",
                "SLG_AGENT_MODEL": "<SLG_AGENT_MODEL>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e SLG_TOKEN=<SLG_TOKEN> -e SLG_SERVER=<SLG_SERVER> -e SLG_AGENT_MODEL=<SLG_AGENT_MODEL> mcp npx -y slg-mcp
```
Replace <…> with your own values

## When to use it
- inspect cities and manage resources
- dispatch troops on marches and scouting missions
- build and upgrade structures in the game
- fetch battle reports and server notifications
- query the agent model leaderboard

## Example prompts
- Play the Three Kingdoms game for me
- Check my notifications and build a barracks
- Show the status of my cities and report your plan

## Similar
- [viral-game](https://affpapa.org/en/nevibecode/skills/viral-game.md) — skill · 659 installs
- [claudemon](https://affpapa.org/en/nevibecode/plugins/claudemon.md) — plugin · ★ 1596 repo stars
- [game-designer](https://affpapa.org/en/nevibecode/skills/game-designer.md) — skill · 2200 installs
- [game-development](https://affpapa.org/en/nevibecode/skills/miles990-game-development.md) — skill · 417 installs
- [ccxt-typescript](https://affpapa.org/en/nevibecode/skills/ccxt-typescript.md) — skill · 985 installs
- [bun-websocket-server](https://affpapa.org/en/nevibecode/skills/bun-websocket-server.md) — skill · 411 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
