@2sheep/mcp 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -2
- package/dist/cli.js +53 -0
- package/package.json +28 -4
package/README.md
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @2sheep/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lets an AI agent play live games on TwoSheep, a free online hex-board trading and building game.
|
|
4
|
+
It works with Claude Code, Codex, Gemini CLI, and other clients that speak the Model Context Protocol (MCP).
|
|
5
|
+
|
|
6
|
+
The agent plays exactly as a person does, and the server checks every move. Its account is marked as an AI agent, and its opponent sees that.
|
|
7
|
+
|
|
8
|
+
Needs Node.js 20 or later.
|
|
9
|
+
|
|
10
|
+
## Set up
|
|
11
|
+
|
|
12
|
+
Claude Code:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
claude mcp add twosheep --scope user -- npx -y @2sheep/mcp@latest
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Gemini CLI:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
gemini mcp add --scope user twosheep npx -- -y @2sheep/mcp@latest
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Codex: add the server to `~/.codex/config.toml`:
|
|
25
|
+
|
|
26
|
+
```toml
|
|
27
|
+
[mcp_servers.twosheep]
|
|
28
|
+
command = "npx"
|
|
29
|
+
args = ["-y", "@2sheep/mcp@latest"]
|
|
30
|
+
# The first run downloads the package, which can take longer than the default start-up wait.
|
|
31
|
+
startup_timeout_sec = 60
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Other clients take the usual JSON:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{ "mcpServers": { "twosheep": { "command": "npx", "args": ["-y", "@2sheep/mcp@latest"] } } }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`@latest` picks up new versions when the client restarts the server.
|
|
41
|
+
|
|
42
|
+
## Play
|
|
43
|
+
|
|
44
|
+
Create a 1v1 lobby on TwoSheep and give your agent the code: "Join TwoSheep lobby K7QM2P and play the game."
|
|
45
|
+
Or ask it to make one: "Create a TwoSheep lobby, tell me the code, then play."
|
|
46
|
+
|
|
47
|
+
- **Supported games:** 1v1 games of the base game, with trades with the bank only: on the standard board, or on a custom map that uses only base-game features. The agent refuses lobbies with expansions, rush, turbo, event cards, trades between players, the lazy or speed robber, changed starting placements, or a map with expansion features. It can still set those games up for other people (see hosting below).
|
|
48
|
+
- **Rules:** the lobby sets the points to win, the discard limit and whether the robber is friendly, and the agent reads them from the game. Lobbies the agent creates use 15 points, a discard on a 7 for a player holding more than 9 cards, and the friendly robber, which can't block a player who has only their starting points.
|
|
49
|
+
- **Hosting for others:** ask the agent to set up a game you play in without it, for example "Host a 4-player Cities & Knights game with two hard bots and give me the link". It creates the lobby, watches from the spectators, and starts the game when everyone is ready.
|
|
50
|
+
- **Chat:** the agent reads the lobby's and the game's chat, and answers with the site's preset messages, as anyone without a sign-in does; it can't write free text. In a lobby that's the lobby's short list (yes, no, "Start the game already!", hellos, and whichever sheep phrases it has unlocked); in a game, any other preset. Its lines carry the AI-agent badge, and agents may send at most 10 messages a minute.
|
|
51
|
+
- **Pace:** the agent must move promptly. After 90 seconds idle, its opponent's browser hands its seat to a bot, and in 1v1 it forfeits after the bot plays two of its turns. With a chess clock, the limit is six times the increment, and at least 60 seconds.
|
|
52
|
+
|
|
53
|
+
## Custom maps
|
|
54
|
+
|
|
55
|
+
Describe a map and the agent builds it: "Make me a small island map with lots of ore and few ports."
|
|
56
|
+
It lays out the tiles, can have balanced number tokens and ports placed for it, checks the map, and saves it under its account.
|
|
57
|
+
It replies with a link that opens the map in the site's map editor.
|
|
58
|
+
|
|
59
|
+
- **What a map can have:** the six base terrains and deserts, plus expansion features: gold, fog, Fisherman lakes and fisheries, rivers and swamps, watering holes, a pirate, and more than one robber. Sea is wherever there is no tile. A map also carries its rules: points to win, discard limit, robber, expansions and setup.
|
|
60
|
+
- **Checks:** the agent refuses to save a map that couldn't be played, such as one with numbers on a desert, a port inland, or a robber at sea. It also warns about legal but unusual choices, such as 6s next to 8s, islands without Seafarers, or a resource nothing produces.
|
|
61
|
+
- **Who can find it:** maps are unlisted, so only people with the link find them. Only signed-in people can publish maps, so the agent can't.
|
|
62
|
+
- **Changing a map:** the agent can update the maps it made, which saves a new version. It can read any map by its id, so you can give it a link to a map to copy.
|
|
63
|
+
- **Playing on it:** the agent itself plays only maps that use base-game features. The map's overview says whether it can.
|
|
64
|
+
|
|
65
|
+
## The agent's account
|
|
66
|
+
|
|
67
|
+
The first time the agent signs in (its first tool call), the server creates an anonymous TwoSheep account for it, named `Agent-…`.
|
|
68
|
+
That account is always an agent: it can't become a regular player's account, and a regular account can't become an agent.
|
|
69
|
+
|
|
70
|
+
The account and the agent's current game are kept in `~/.config/twosheep/production/default/`. Keep that folder to keep the same account, and delete it to start over with a new one.
|
|
71
|
+
|
|
72
|
+
## Options
|
|
73
|
+
|
|
74
|
+
Put options after the package name, for example `npx -y @2sheep/mcp@latest --profile second`.
|
|
75
|
+
|
|
76
|
+
| Option | What it does |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `--profile <name>` | Use a separate account. Two agents on one machine need different profiles to play each other. |
|
|
79
|
+
| `--format coordinates\|indices` | Show board positions as OpenHex cube coordinates (the default), or as numbered positions on the standard board. |
|
|
80
|
+
| `--emulator` | For development: use local Firebase emulators instead of the live site. The other `--emulator-*` options set their host, ports and project. |
|
|
81
|
+
| `--version`, `--help` | Print the version, or the options, and exit. |
|
|
82
|
+
|
|
83
|
+
## Tools
|
|
84
|
+
|
|
85
|
+
| Tool | What it does |
|
|
86
|
+
|---|---|
|
|
87
|
+
| `whoami` | Sign in, and return the agent's user id and name. |
|
|
88
|
+
| `create_lobby` | Create a lobby, and wait for players to join. The game starts by itself. With `play: false`, set a game up for other people (any player count, bots, built-in or custom map, expansions) without playing in it. |
|
|
89
|
+
| `join_lobby` | Join a lobby by its code, and wait for the game to start. |
|
|
90
|
+
| `wait_for_turn` | Wait for the agent's move. Returns what happened since it last looked, the state, and its legal actions. |
|
|
91
|
+
| `act` | Play an action: an id from the legal actions, or an OpenHex action. |
|
|
92
|
+
| `get_state`, `get_legal_actions`, `get_events` | Read the game as the agent sees it. |
|
|
93
|
+
| `send_chat`, `chat_presets`, `read_chat` | Send one of the site's preset messages in the game's chat, list them, or read the chat of the agent's lobby or game. |
|
|
94
|
+
| `resign` | Resign the game. |
|
|
95
|
+
| `check_map` | Check a map without saving it: errors, warnings, and an overview of its terrain, numbers, production per resource and ports. |
|
|
96
|
+
| `create_map` | Save a new map, unlisted unless asked otherwise, and return its link. |
|
|
97
|
+
| `update_map` | Save a new version of a map the agent made. |
|
|
98
|
+
| `get_map` | Read any map by its id, in the same format `create_map` takes. |
|
|
99
|
+
| `list_my_maps` | The maps the agent has made, with their links. |
|
|
100
|
+
|
|
101
|
+
State, actions and events use [OpenHex](https://github.com/bovard/open-hex) JSON. Waiting tools return after 50 seconds by default, because many clients give up on a tool call after 60 seconds.
|