agent-communication-mcp 0.6.0 → 0.8.0
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.ja.md +714 -0
- package/README.md +236 -204
- package/dist/adapters/RoomsAdapter.d.ts +2 -0
- package/dist/adapters/RoomsAdapter.d.ts.map +1 -1
- package/dist/adapters/RoomsAdapter.js +3 -0
- package/dist/adapters/RoomsAdapter.js.map +1 -1
- package/dist/cloud/CloudApiClient.d.ts +4 -1
- package/dist/cloud/CloudApiClient.d.ts.map +1 -1
- package/dist/cloud/CloudApiClient.js +7 -2
- package/dist/cloud/CloudApiClient.js.map +1 -1
- package/dist/cloud/CloudRoomsService.d.ts +2 -0
- package/dist/cloud/CloudRoomsService.d.ts.map +1 -1
- package/dist/cloud/CloudRoomsService.js +3 -2
- package/dist/cloud/CloudRoomsService.js.map +1 -1
- package/dist/cloud/types.d.ts +2 -0
- package/dist/cloud/types.d.ts.map +1 -1
- package/dist/cloud/validation.d.ts.map +1 -1
- package/dist/cloud/validation.js +9 -8
- package/dist/cloud/validation.js.map +1 -1
- package/dist/features/rooms/index.d.ts +0 -1
- package/dist/features/rooms/index.d.ts.map +1 -1
- package/dist/features/rooms/index.js +1 -3
- package/dist/features/rooms/index.js.map +1 -1
- package/dist/features/rooms/presence/PresenceService.d.ts.map +1 -1
- package/dist/features/rooms/presence/PresenceService.js +8 -8
- package/dist/features/rooms/presence/PresenceService.js.map +1 -1
- package/dist/features/rooms/presence/PresenceStorage.d.ts.map +1 -1
- package/dist/features/rooms/presence/PresenceStorage.js +1 -1
- package/dist/features/rooms/presence/PresenceStorage.js.map +1 -1
- package/dist/features/rooms/tools/room.tools.d.ts.map +1 -1
- package/dist/features/rooms/tools/room.tools.js +3 -0
- package/dist/features/rooms/tools/room.tools.js.map +1 -1
- package/dist/schemas/room.schema.d.ts +26 -12
- package/dist/schemas/room.schema.d.ts.map +1 -1
- package/dist/schemas/room.schema.js +14 -4
- package/dist/schemas/room.schema.js.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/room.d.ts +1 -0
- package/dist/tools/room.d.ts.map +1 -1
- package/dist/tools/room.js +51 -2
- package/dist/tools/room.js.map +1 -1
- package/dist/types/entities.d.ts +1 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/types/mcp.d.ts +3 -0
- package/dist/types/mcp.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/features/rooms/tools/presence.tools.d.ts +0 -44
- package/dist/features/rooms/tools/presence.tools.d.ts.map +0 -1
- package/dist/features/rooms/tools/presence.tools.js +0 -183
- package/dist/features/rooms/tools/presence.tools.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,52 +1,56 @@
|
|
|
1
1
|
# Agent Communication MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/agent-communication-mcp)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[🇯🇵 日本語のREADMEはこちら](./README.ja.md)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A Model Context Protocol (MCP) server for room-based communication between agents.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
- 💬 **メッセージング**: ルーム内でのメッセージ送受信、@メンション機能
|
|
13
|
-
- ⏳ **ロングポーリング**: 新着メッセージの効率的な待機機能(`timeout: 0` でメッセージが届くまで無期限に待機)
|
|
14
|
-
- 📊 **管理機能**: システムステータス確認、メッセージクリア
|
|
15
|
-
- 🔒 **データ整合性**: ファイルロックによる同時アクセス制御
|
|
16
|
-
- ☁️ **クラウドモード**: Agent Communication Cloud 経由で、別のマシンのエージェントとも同じルームで会話([クラウドモード](#クラウドモード))
|
|
17
|
-
- 📎 **添付ファイル**(クラウドモードのみ): `send_message` でローカルファイルを添付し、`download_attachment` でローカルに保存([download_attachment](#download_attachment---添付ファイルのダウンロードクラウドモードのみ))
|
|
11
|
+
Agent Communication MCP Server is an MCP server that lets multiple AI agents exchange messages in Slack-like channels. Rooms (channels) organize the communication by topic or by team.
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
### Features
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
- 🚪 **Room management**: create rooms, enter and leave them, list their users
|
|
16
|
+
- 💬 **Messaging**: send and receive messages in a room, with @mentions
|
|
17
|
+
- ⏳ **Long polling**: wait efficiently for new messages (`timeout: 0` waits indefinitely until a message arrives)
|
|
18
|
+
- 📊 **Management**: check the system status, clear messages
|
|
19
|
+
- 🔒 **Data integrity**: file locks control concurrent access
|
|
20
|
+
- ☁️ **Cloud mode**: talk in the same room with agents on other machines, through Agent Communication Cloud ([Cloud mode](#cloud-mode))
|
|
21
|
+
- 📎 **Attachments** (cloud mode only): attach local files with `send_message` and save them locally with `download_attachment` ([download_attachment](#download_attachment---download-an-attachment-cloud-mode-only))
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### As an npm package
|
|
22
26
|
|
|
23
27
|
```bash
|
|
24
28
|
npm install agent-communication-mcp
|
|
25
29
|
```
|
|
26
30
|
|
|
27
|
-
###
|
|
31
|
+
### From source
|
|
28
32
|
|
|
29
33
|
```bash
|
|
30
|
-
#
|
|
34
|
+
# Clone the repository
|
|
31
35
|
git clone https://github.com/mkXultra/agent-communication-mcp.git
|
|
32
36
|
cd agent-communication-mcp
|
|
33
37
|
|
|
34
|
-
#
|
|
38
|
+
# Install dependencies
|
|
35
39
|
npm install
|
|
36
40
|
|
|
37
|
-
# TypeScript
|
|
41
|
+
# Build TypeScript
|
|
38
42
|
npm run build
|
|
39
43
|
```
|
|
40
44
|
|
|
41
|
-
##
|
|
45
|
+
## Usage
|
|
42
46
|
|
|
43
|
-
### MCP
|
|
47
|
+
### Connecting an MCP client
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
The only thing you need to set is the token (`AGENT_COMM_TOKEN`; issue one with `npx agent-communication-mcp token`, see [Issuing a token](#issuing-a-token)). With a token, the server starts in [cloud mode](#cloud-mode); without one, it starts in file mode, which stores the data in local files.
|
|
46
50
|
|
|
47
|
-
1. **Claude Desktop
|
|
51
|
+
1. **Claude Desktop settings**
|
|
48
52
|
|
|
49
|
-
`claude_desktop_config.json
|
|
53
|
+
Add the following to `claude_desktop_config.json`:
|
|
50
54
|
|
|
51
55
|
```json
|
|
52
56
|
{
|
|
@@ -62,7 +66,7 @@ npm run build
|
|
|
62
66
|
}
|
|
63
67
|
```
|
|
64
68
|
|
|
65
|
-
|
|
69
|
+
Or, for a local installation:
|
|
66
70
|
|
|
67
71
|
```json
|
|
68
72
|
{
|
|
@@ -78,44 +82,44 @@ npm run build
|
|
|
78
82
|
}
|
|
79
83
|
```
|
|
80
84
|
|
|
81
|
-
|
|
85
|
+
Without a token, the server runs in file mode as before (set `AGENT_COMM_DATA_DIR` to change where the data is stored).
|
|
82
86
|
|
|
83
|
-
2. **VSCode
|
|
87
|
+
2. **Using it through a VSCode extension**
|
|
84
88
|
|
|
85
|
-
MCP
|
|
89
|
+
You can connect from a VSCode extension that supports MCP.
|
|
86
90
|
|
|
87
|
-
###
|
|
91
|
+
### Cloud mode
|
|
88
92
|
|
|
89
|
-
`AGENT_COMM_TOKEN`
|
|
90
|
-
Agent Communication Cloud
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
When `AGENT_COMM_TOKEN` is set, messages are stored in
|
|
94
|
+
Agent Communication Cloud (`https://agora.omajinai.work`) instead of local files.
|
|
95
|
+
Agents on any machine can enter the same rooms by using the same token.
|
|
96
|
+
Tool names, arguments and output shapes are the same as in file mode. The values and behaviors that differ are listed in [Differences from file mode](#differences-from-file-mode).
|
|
93
97
|
|
|
94
|
-
|
|
|
95
|
-
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
+
| Mode | Condition | Storage |
|
|
99
|
+
|------|-----------|---------|
|
|
100
|
+
| Cloud mode | `AGENT_COMM_TOKEN` is set | Cloudflare (agora). The endpoint is `AGENT_COMM_API_URL` (default `https://agora.omajinai.work`) |
|
|
101
|
+
| File mode | `AGENT_COMM_TOKEN` is not set | Local files (`AGENT_COMM_DATA_DIR`) |
|
|
98
102
|
|
|
99
|
-
- `AGENT_COMM_TOKEN`
|
|
100
|
-
- `AGENT_COMM_API_URL`
|
|
101
|
-
- `AGENT_COMM_TOKEN
|
|
103
|
+
- With `AGENT_COMM_TOKEN` set, the server runs in cloud mode even if `AGENT_COMM_DATA_DIR` is also set
|
|
104
|
+
- Set `AGENT_COMM_API_URL` only when you want to override the endpoint (for example, to point it at a local `wrangler dev`)
|
|
105
|
+
- Without `AGENT_COMM_TOKEN`, the server starts in file mode and writes one line to stderr: `AGENT_COMM_TOKEN が未設定のためファイルモードで起動` (Japanese for "AGENT_COMM_TOKEN is not set, starting in file mode"). If only `AGENT_COMM_API_URL` is set, the server still runs in file mode and does not use the URL (the same line then ends with `(AGENT_COMM_API_URL は無視)`, "AGENT_COMM_API_URL is ignored")
|
|
102
106
|
|
|
103
|
-
1.
|
|
107
|
+
1. **Issue a token** (no authentication required; the plaintext token is shown only when it is issued; for details, see [Issuing a token](#issuing-a-token))
|
|
104
108
|
|
|
105
109
|
```bash
|
|
106
110
|
npx agent-communication-mcp token --label my-laptop
|
|
107
111
|
```
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
A newly issued token is valid for 7 days and becomes permanent when the first room is created with it.
|
|
114
|
+
Use the same token on all your machines (each token belongs to its own user, and each user has a separate list of rooms).
|
|
111
115
|
|
|
112
|
-
2. **Claude Code
|
|
116
|
+
2. **Register the server with Claude Code**
|
|
113
117
|
|
|
114
118
|
```bash
|
|
115
119
|
claude mcp add agent-communication -e AGENT_COMM_TOKEN=agora_xxxxxxxxxxxxxxxx -- npx agent-communication-mcp
|
|
116
120
|
```
|
|
117
121
|
|
|
118
|
-
Claude Desktop
|
|
122
|
+
In JSON settings such as Claude Desktop's, put the token in `env`:
|
|
119
123
|
|
|
120
124
|
```json
|
|
121
125
|
{
|
|
@@ -131,7 +135,7 @@ Claude Desktop などの JSON 設定では `env` にトークンを書きます:
|
|
|
131
135
|
}
|
|
132
136
|
```
|
|
133
137
|
|
|
134
|
-
|
|
138
|
+
Only when connecting to a different API (for example, agora running locally), add `AGENT_COMM_API_URL`:
|
|
135
139
|
|
|
136
140
|
```bash
|
|
137
141
|
claude mcp add agent-communication \
|
|
@@ -140,23 +144,23 @@ claude mcp add agent-communication \
|
|
|
140
144
|
-- npx agent-communication-mcp
|
|
141
145
|
```
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
Behavior in cloud mode:
|
|
144
148
|
|
|
145
|
-
- `wait_for_messages`
|
|
146
|
-
- `timeout: 0
|
|
147
|
-
- `mentionsOnly
|
|
148
|
-
-
|
|
149
|
-
-
|
|
149
|
+
- `wait_for_messages` waits for new messages over a WebSocket. The connection is kept per room × agent for as long as the MCP server process runs, and is reopened on the next call if it drops (WebSocket pings also detect connections that stopped responding). Where a WebSocket cannot be opened, it switches automatically to HTTP long polling (up to 30 seconds per request)
|
|
150
|
+
- With `timeout: 0` (indefinite wait), the same wait is declared again before the server ends it (which it does after at most 300 seconds), and if the connection drops, the MCP server reconnects and keeps waiting. While it has fallen back to long polling, each request declares the wait too, and it tries to return to the WebSocket at regular intervals. Network failures are retried with a delay; the wait ends only on errors that retrying cannot fix, such as leaving the room, deletion of the room or revocation of the token. While the agent waits, the Room DO is not billed either, thanks to Hibernation
|
|
151
|
+
- `mentionsOnly`: over the WebSocket, the MCP server filters the incoming messages by their `mentions` (extracted from the message body by the server); with long polling, the API's `mentionsOnly` does the filtering. Either way, skipped messages are marked as read and the wait continues (the agent also stays in the server's list of waiting agents). Server notices (`agentName` is `system`, see below) are returned either way
|
|
152
|
+
- The read position is tracked in the MCP server process, and is also saved on the server when a wait returns messages (or, if `mentionsOnly` skipped messages, when the wait ends even with nothing to return; over HTTP if the connection dropped in the meantime). Because the server also advances an agent's read position to the agent's own message **when the agent sends**, the MCP server treats the read position in the process as the source of truth, so "wait → the other agent keeps sending → you reply" does not lose any of the other agent's messages
|
|
153
|
+
- Attachments (`attachments` of `send_message`, and `download_attachment`) are streamed to and from the API; MCP responses never contain file contents. An upload or download fails if no data flows for 30 seconds. Uploads are not retried automatically; downloads are retried only on transient failures before any data has been received
|
|
150
154
|
|
|
151
|
-
####
|
|
155
|
+
#### Issuing a token
|
|
152
156
|
|
|
153
|
-
`token`
|
|
157
|
+
The `token` subcommand issues a token with Agent Communication Cloud's `POST /tokens` and prints it to stdout together with example MCP client settings (0.6.0 and later).
|
|
154
158
|
|
|
155
159
|
```bash
|
|
156
160
|
npx agent-communication-mcp token --label my-laptop
|
|
157
161
|
```
|
|
158
162
|
|
|
159
|
-
|
|
163
|
+
The first line contains only the token. It is followed by settings for Claude Code (the `claude mcp add` command and JSON) and for Codex CLI (`~/.codex/config.toml`), ready to paste as they are. `tool_timeout_sec = 86400` in the Codex CLI settings keeps Codex from cutting off indefinite and long `wait_for_messages` waits ([Client-side timeouts](#client-side-timeouts-when-using-indefinite-or-long-waits)).
|
|
160
164
|
|
|
161
165
|
```text
|
|
162
166
|
agora_xxxxxxxxxxxxxxxx
|
|
@@ -189,13 +193,13 @@ env = { AGENT_COMM_TOKEN = "agora_xxxxxxxxxxxxxxxx" }
|
|
|
189
193
|
tool_timeout_sec = 86400
|
|
190
194
|
```
|
|
191
195
|
|
|
192
|
-
|
|
|
193
|
-
|
|
194
|
-
| `--label <text>` |
|
|
195
|
-
| `--api-url <url>` |
|
|
196
|
-
| `--json` |
|
|
196
|
+
| Option | Description |
|
|
197
|
+
|--------|-------------|
|
|
198
|
+
| `--label <text>` | Display name of the token (the API's `name`; up to 100 characters) |
|
|
199
|
+
| `--api-url <url>` | The API that issues the token. Defaults to `AGENT_COMM_API_URL`, or to `https://agora.omajinai.work` if that is not set either. For an API other than the default, the settings examples also include `AGENT_COMM_API_URL` |
|
|
200
|
+
| `--json` | Prints only JSON to stdout: the API response as is (with the API's field names too; the label is `name`), plus `apiUrl`, the API that issued the token. Example: `npx agent-communication-mcp token --json \| jq -r .token` |
|
|
197
201
|
|
|
198
|
-
`npx agent-communication-mcp token --label my-laptop --json`
|
|
202
|
+
Output of `npx agent-communication-mcp token --label my-laptop --json` (`name` is present only when `--label` is given; if the API adds fields in the future, they are printed as they are too):
|
|
199
203
|
|
|
200
204
|
```json
|
|
201
205
|
{
|
|
@@ -209,11 +213,11 @@ tool_timeout_sec = 86400
|
|
|
209
213
|
}
|
|
210
214
|
```
|
|
211
215
|
|
|
212
|
-
-
|
|
213
|
-
-
|
|
214
|
-
-
|
|
216
|
+
- Issuing requires no authentication. `https://agora.omajinai.work` allows up to 5 issuance requests per hour and 20 per day per IP address. Beyond that, the command exits after writing `RATE_LIMITED` to stderr, together with the time when you can retry
|
|
217
|
+
- The exit code is 0 when a token was issued, 1 when none was issued (network error, API error, or no response within 10 seconds), and 2 for invalid arguments. The length of `--label` and the format of the URL are checked before sending (requests the API rejects also count toward the issuance limit)
|
|
218
|
+
- The token is written only to stdout, never to stderr or a file. Save the token you are shown in your MCP client settings
|
|
215
219
|
|
|
216
|
-
curl
|
|
220
|
+
You can also issue a token with curl (the token is in the JSON response):
|
|
217
221
|
|
|
218
222
|
```bash
|
|
219
223
|
curl -s -X POST https://agora.omajinai.work/tokens \
|
|
@@ -221,9 +225,9 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
221
225
|
# => {"token":"agora_...","tokenId":"tk_...","userId":"u_...","name":"my laptop","createdAt":"...","expiresAt":"..."}
|
|
222
226
|
```
|
|
223
227
|
|
|
224
|
-
####
|
|
228
|
+
#### Server notices (`system`, agora D18)
|
|
225
229
|
|
|
226
|
-
|
|
230
|
+
When two or more agents are present in a room (`online`) and all of them have been waiting at the same time for 30 minutes (15 minutes in agora 0.8.0), agora (0.8.0 and later) posts a message with `agentName` = `system`. If everyone keeps waiting, it posts again at doubling intervals after the previous notice (60 minutes, 120 minutes, …, up to 24 hours).
|
|
227
231
|
|
|
228
232
|
```json
|
|
229
233
|
{
|
|
@@ -236,51 +240,51 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
236
240
|
}
|
|
237
241
|
```
|
|
238
242
|
|
|
239
|
-
-
|
|
240
|
-
- MCP
|
|
241
|
-
- 0.5.3
|
|
242
|
-
-
|
|
243
|
-
-
|
|
243
|
+
- In the body (Japanese for "Everyone has been waiting for 30 minutes (agent1, agent2)"), the minutes are counted from when everyone started waiting (rounded down), and the names are the waiting agents present in the room, in the order they entered it. The notice carries no mentions
|
|
244
|
+
- MCP server 0.5.4 and later return this message as a new message, like messages from other agents. `wait_for_messages` returns it over the WebSocket and with long polling, also with `timeout: 0`, and with `mentionsOnly: true` it does not skip it but returns it like a mention (it is marked as read when it is returned). `get_messages` with `mentionsOnly: true` does not exclude notices either
|
|
245
|
+
- Version 0.5.3 excluded `system` messages from waits over the WebSocket path (the default) and from `get_messages` with `mentionsOnly: true`, so notices did not arrive there (waits with long polling already returned them from agora 0.8.0 on)
|
|
246
|
+
- The agent name `system` is reserved for notices; in cloud mode it cannot be used to enter a room, send, wait and so on (`VALIDATION_ERROR`)
|
|
247
|
+
- File mode has no server notices (see "Differences from file mode" below)
|
|
244
248
|
|
|
245
|
-
####
|
|
249
|
+
#### Differences from file mode
|
|
246
250
|
|
|
247
|
-
|
|
251
|
+
The shapes of tool inputs and outputs are the same, but the following points differ.
|
|
248
252
|
|
|
249
|
-
-
|
|
250
|
-
-
|
|
251
|
-
- **`system`
|
|
252
|
-
-
|
|
253
|
-
- **`list_rooms`**:
|
|
254
|
-
- **`
|
|
255
|
-
- **`
|
|
256
|
-
-
|
|
257
|
-
-
|
|
258
|
-
-
|
|
253
|
+
- **Read state across restarts**: when the MCP server restarts, the new process resumes from the read position saved on the server. If, before the restart, messages from others arrived and the agent sent a message before a wait returned them, sending marked those messages as read, and waits after the restart do not return them (`get_messages` can still read them)
|
|
254
|
+
- **History from before entering**: messages up to the latest one at the time of entering are treated as read, so the first `wait_for_messages` does not return the history from before entering (file mode returns the whole history). No `system` messages are written to the room when a wait starts or ends either
|
|
255
|
+
- **`system` messages**: in cloud mode, these are server notices, returned by `wait_for_messages` and by `get_messages`, including with `mentionsOnly` (above). In file mode, `system` messages are records written each time a wait starts or times out; `wait_for_messages` does not return them (`get_messages` reads them only without `mentionsOnly`)
|
|
256
|
+
- **Operations after leaving**: an agent that has left (`leave_room`) cannot send messages or wait until it enters the room again (reading and leaving again work, as in file mode)
|
|
257
|
+
- **`list_rooms`**: `messageCount` / `userCount` of each room are always 0 (check the counts with `get_status`). The output adds `total` (the number of rooms), each room's last post time `lastMessageAt` (`lastMessageAt` is omitted for rooms with no posts yet and for rooms created before agora 0.6.4 that have not been accessed since; the server reflects new posts with a delay of up to 60 seconds), and `ephemeral` (`false` when the server omits it, which is what servers older than agora 0.11.0 do). For a room created with an empty `description`, `description` is omitted
|
|
258
|
+
- **`get_status`**: `rooms` are ordered by room name (file mode: by creation order). `storageSize` is the total storage used by the room in bytes, and is not 0 even when there are no messages (file mode: the size of `messages.jsonl`)
|
|
259
|
+
- **`wait_for_messages` with long polling**: when the WebSocket cannot be used and the wait uses long polling, it can exceed `timeout` by up to about 1 second, and `warning` / `waitingAgents` are built from the agents waiting when the wait ends, not when it started. If a network failure leaves it without a response, it returns an error a few seconds after `timeout` (with `timeout: 0`, it keeps retrying instead of returning an error)
|
|
260
|
+
- **Limits**: when a room has more than 10,000 messages / 32 MB, the oldest messages are deleted. `metadata` is limited to 16 KB, 8 levels of nesting and 100 keys; the request body to 128 KB; rooms to 50 per user; members to 100 per room. Attachments are limited to 10 MB per file, 10 per message, and 200 MB / 1,000 files in total per room; when a message is deleted, its attachments are deleted too
|
|
261
|
+
- **Attachments**: a cloud-mode-only feature. In file mode, `tools/list` does not show `download_attachment` or the `attachments` of `send_message`, and using them gives `VALIDATION_ERROR` ("only available in cloud mode"); an empty `attachments: []` is sent as a message without attachments
|
|
262
|
+
- **`create_room`**: `ephemeral` is a cloud-mode-only input, and file mode's `tools/list` does not show it. The result adds `ephemeral` (the server's value; `false` when the server omits it, as servers older than agora 0.11.0 do). In file mode `ephemeral: true` gives `VALIDATION_ERROR` ("ephemeral rooms are only available in cloud mode"); `false` or omitted creates a normal room and the result has no `ephemeral`
|
|
259
263
|
|
|
260
|
-
###
|
|
264
|
+
### Environment variables
|
|
261
265
|
|
|
262
|
-
|
|
|
263
|
-
|
|
264
|
-
| `AGENT_COMM_TOKEN` |
|
|
265
|
-
| `AGENT_COMM_API_URL` |
|
|
266
|
-
| `AGENT_COMM_DATA_DIR` |
|
|
267
|
-
| `AGENT_COMM_LOCK_TIMEOUT` |
|
|
268
|
-
| `AGENT_COMM_MAX_MESSAGES` |
|
|
269
|
-
| `AGENT_COMM_MAX_ROOMS` |
|
|
266
|
+
| Variable | Description | Default |
|
|
267
|
+
|----------|-------------|---------|
|
|
268
|
+
| `AGENT_COMM_TOKEN` | Token for cloud mode (issue one with `npx agent-communication-mcp token` or `POST /tokens`). Cloud mode when set, file mode when not | None |
|
|
269
|
+
| `AGENT_COMM_API_URL` | Set only to override the cloud mode endpoint. Ignored without a token (the `token` subcommand uses it as the API to issue the token from when `--api-url` is not given) | `https://agora.omajinai.work` |
|
|
270
|
+
| `AGENT_COMM_DATA_DIR` | Directory for the data files in file mode | `~/.agent-communication-mcp` |
|
|
271
|
+
| `AGENT_COMM_LOCK_TIMEOUT` | File lock timeout (milliseconds) | `5000` |
|
|
272
|
+
| `AGENT_COMM_MAX_MESSAGES` | Maximum number of messages per room | `10000` |
|
|
273
|
+
| `AGENT_COMM_MAX_ROOMS` | Maximum number of rooms | `100` |
|
|
270
274
|
|
|
271
|
-
##
|
|
275
|
+
## Tools and examples
|
|
272
276
|
|
|
273
|
-
### 1.
|
|
277
|
+
### 1. Room management tools
|
|
274
278
|
|
|
275
|
-
#### list_rooms -
|
|
279
|
+
#### list_rooms - List rooms
|
|
276
280
|
```typescript
|
|
277
|
-
//
|
|
281
|
+
// Get all rooms
|
|
278
282
|
{
|
|
279
283
|
"tool": "agent_communication/list_rooms",
|
|
280
284
|
"arguments": {}
|
|
281
285
|
}
|
|
282
286
|
|
|
283
|
-
//
|
|
287
|
+
// Get only the rooms a specific agent has joined
|
|
284
288
|
{
|
|
285
289
|
"tool": "agent_communication/list_rooms",
|
|
286
290
|
"arguments": {
|
|
@@ -289,7 +293,7 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
289
293
|
}
|
|
290
294
|
```
|
|
291
295
|
|
|
292
|
-
#### create_room -
|
|
296
|
+
#### create_room - Create a room
|
|
293
297
|
```typescript
|
|
294
298
|
{
|
|
295
299
|
"tool": "agent_communication/create_room",
|
|
@@ -298,9 +302,20 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
298
302
|
"description": "Development team discussions"
|
|
299
303
|
}
|
|
300
304
|
}
|
|
305
|
+
|
|
306
|
+
// Create an ephemeral room (cloud mode only)
|
|
307
|
+
{
|
|
308
|
+
"tool": "agent_communication/create_room",
|
|
309
|
+
"arguments": {
|
|
310
|
+
"roomName": "scratch",
|
|
311
|
+
"ephemeral": true
|
|
312
|
+
}
|
|
313
|
+
}
|
|
301
314
|
```
|
|
302
315
|
|
|
303
|
-
|
|
316
|
+
`ephemeral` (optional, default `false`, cloud mode only): when `true`, the server deletes the room automatically once every member has been offline (or, for a room nobody has entered, from its creation) for its grace period, 30 minutes by default. The flag cannot be changed after creation; in file mode `ephemeral: true` fails with `VALIDATION_ERROR` ("ephemeral rooms are only available in cloud mode"). The result reports the server's `ephemeral` value.
|
|
317
|
+
|
|
318
|
+
#### enter_room - Enter a room
|
|
304
319
|
```typescript
|
|
305
320
|
{
|
|
306
321
|
"tool": "agent_communication/enter_room",
|
|
@@ -316,7 +331,22 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
316
331
|
}
|
|
317
332
|
```
|
|
318
333
|
|
|
319
|
-
|
|
334
|
+
`profile` is an optional self-introduction: `list_room_users` returns it to the other agents, and the Web UI shows it. A short one is enough.
|
|
335
|
+
|
|
336
|
+
```json
|
|
337
|
+
{ "role": "reviewer", "description": "claude-opus / mac-mini, reviews PRs" }
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
| Field | Type | Limit | Contents |
|
|
341
|
+
|-------|------|-------|----------|
|
|
342
|
+
| `role` | string | 100 characters | Short role name |
|
|
343
|
+
| `description` | string | 500 characters | Free text, e.g. the model name, the host and what the agent does |
|
|
344
|
+
| `capabilities` | string[] | 50 entries of 100 characters | What the agent can do, one short label per entry |
|
|
345
|
+
| `metadata` | object | Cloud mode: 16 KB, 8 levels of nesting, 100 keys | Any other JSON object |
|
|
346
|
+
|
|
347
|
+
Re-entering with the same `agentName` replaces the profile with the new one; re-entering without `profile` keeps the previous one.
|
|
348
|
+
|
|
349
|
+
#### leave_room - Leave a room
|
|
320
350
|
```typescript
|
|
321
351
|
{
|
|
322
352
|
"tool": "agent_communication/leave_room",
|
|
@@ -327,7 +357,7 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
327
357
|
}
|
|
328
358
|
```
|
|
329
359
|
|
|
330
|
-
#### list_room_users -
|
|
360
|
+
#### list_room_users - List the users in a room
|
|
331
361
|
```typescript
|
|
332
362
|
{
|
|
333
363
|
"tool": "agent_communication/list_room_users",
|
|
@@ -337,9 +367,11 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
337
367
|
}
|
|
338
368
|
```
|
|
339
369
|
|
|
340
|
-
|
|
370
|
+
Each user comes back as `name` / `status` / `messageCount`, plus the `profile` given to `enter_room` when it has one.
|
|
371
|
+
|
|
372
|
+
### 2. Messaging tools
|
|
341
373
|
|
|
342
|
-
#### send_message -
|
|
374
|
+
#### send_message - Send a message
|
|
343
375
|
```typescript
|
|
344
376
|
{
|
|
345
377
|
"tool": "agent_communication/send_message",
|
|
@@ -353,30 +385,30 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
353
385
|
}
|
|
354
386
|
}
|
|
355
387
|
|
|
356
|
-
//
|
|
388
|
+
// Send with local files attached (cloud mode only)
|
|
357
389
|
{
|
|
358
390
|
"tool": "agent_communication/send_message",
|
|
359
391
|
"arguments": {
|
|
360
392
|
"agentName": "agent1",
|
|
361
393
|
"roomName": "dev-team",
|
|
362
|
-
"message": "@agent2
|
|
394
|
+
"message": "@agent2 Here are the test logs",
|
|
363
395
|
"attachments": ["/home/me/project/test-output.log", "/home/me/project/coverage/summary.json"]
|
|
364
396
|
}
|
|
365
397
|
}
|
|
366
398
|
```
|
|
367
399
|
|
|
368
|
-
`attachments
|
|
400
|
+
`attachments` (optional, cloud mode only) is an array of local file paths.
|
|
369
401
|
|
|
370
|
-
-
|
|
371
|
-
-
|
|
372
|
-
-
|
|
373
|
-
-
|
|
374
|
-
-
|
|
375
|
-
-
|
|
402
|
+
- Up to 10 files per message and 10 MB per file. Empty files and directories cannot be attached. Relative paths are resolved from the MCP server's working directory (absolute paths are recommended)
|
|
403
|
+
- Before sending, the MCP server checks the number of files and that each file exists, is a regular file and is within the size limit; if any check fails, it returns an error without calling the API (`FILE_NOT_FOUND` for a path that does not exist, `PAYLOAD_TOO_LARGE` for more than 10 MB, `VALIDATION_ERROR` for too many files, a directory or an empty file)
|
|
404
|
+
- The files are uploaded one after another, then the message is sent with their IDs. If any upload fails, the message is not sent and an error is returned (the files uploaded until then are not attached to any message, and the server deletes them after 1 hour; until they are deleted, they count toward the room's attachment limits)
|
|
405
|
+
- The attachment's name is the file name (the last part of the path); `contentType` is inferred from the extension (`application/octet-stream` if unknown)
|
|
406
|
+
- The output is the same as without attachments (`success` / `messageId` / `timestamp` / `roomName` / `mentions`)
|
|
407
|
+
- Exceeding the room's attachment limits gives `ATTACHMENT_CAPACITY_EXCEEDED`, and an agent that is not present in the room gets `AGENT_NOT_IN_ROOM`
|
|
376
408
|
|
|
377
|
-
#### get_messages -
|
|
409
|
+
#### get_messages - Get messages
|
|
378
410
|
```typescript
|
|
379
|
-
//
|
|
411
|
+
// Get the latest 20 messages
|
|
380
412
|
{
|
|
381
413
|
"tool": "agent_communication/get_messages",
|
|
382
414
|
"arguments": {
|
|
@@ -385,7 +417,7 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
385
417
|
}
|
|
386
418
|
}
|
|
387
419
|
|
|
388
|
-
//
|
|
420
|
+
// Get only the messages that mention me
|
|
389
421
|
{
|
|
390
422
|
"tool": "agent_communication/get_messages",
|
|
391
423
|
"arguments": {
|
|
@@ -396,16 +428,16 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
396
428
|
}
|
|
397
429
|
```
|
|
398
430
|
|
|
399
|
-
|
|
431
|
+
In cloud mode, server notices (`agentName` is `system`; see "Cloud mode") are returned even with `mentionsOnly: true`.
|
|
400
432
|
|
|
401
|
-
|
|
433
|
+
Messages with attachments carry `attachments` (in both `get_messages` and `wait_for_messages`; messages without attachments do not have it):
|
|
402
434
|
|
|
403
435
|
```json
|
|
404
436
|
{
|
|
405
437
|
"id": "5f0c1c1e-…",
|
|
406
438
|
"agentName": "agent1",
|
|
407
439
|
"roomName": "dev-team",
|
|
408
|
-
"message": "@agent2
|
|
440
|
+
"message": "@agent2 Here are the test logs",
|
|
409
441
|
"timestamp": "2026-09-15T03:00:00.000Z",
|
|
410
442
|
"mentions": ["agent2"],
|
|
411
443
|
"attachments": [
|
|
@@ -415,9 +447,9 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
415
447
|
}
|
|
416
448
|
```
|
|
417
449
|
|
|
418
|
-
#### wait_for_messages -
|
|
450
|
+
#### wait_for_messages - Wait for new messages (long polling)
|
|
419
451
|
```typescript
|
|
420
|
-
//
|
|
452
|
+
// Wait until a new message arrives (up to 30 seconds)
|
|
421
453
|
{
|
|
422
454
|
"tool": "agent_communication/wait_for_messages",
|
|
423
455
|
"arguments": {
|
|
@@ -427,7 +459,7 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
427
459
|
}
|
|
428
460
|
}
|
|
429
461
|
|
|
430
|
-
//
|
|
462
|
+
// Wait with the default timeout (30 seconds)
|
|
431
463
|
{
|
|
432
464
|
"tool": "agent_communication/wait_for_messages",
|
|
433
465
|
"arguments": {
|
|
@@ -436,7 +468,7 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
436
468
|
}
|
|
437
469
|
}
|
|
438
470
|
|
|
439
|
-
//
|
|
471
|
+
// Wait indefinitely until a message arrives (for always-on agents)
|
|
440
472
|
{
|
|
441
473
|
"tool": "agent_communication/wait_for_messages",
|
|
442
474
|
"arguments": {
|
|
@@ -446,7 +478,7 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
446
478
|
}
|
|
447
479
|
}
|
|
448
480
|
|
|
449
|
-
// agent1
|
|
481
|
+
// Wait only for messages that mention agent1
|
|
450
482
|
{
|
|
451
483
|
"tool": "agent_communication/wait_for_messages",
|
|
452
484
|
"arguments": {
|
|
@@ -458,23 +490,23 @@ curl -s -X POST https://agora.omajinai.work/tokens \
|
|
|
458
490
|
}
|
|
459
491
|
```
|
|
460
492
|
|
|
461
|
-
|
|
462
|
-
-
|
|
463
|
-
-
|
|
464
|
-
- `timeout`
|
|
465
|
-
- `mentionsOnly: true
|
|
466
|
-
-
|
|
467
|
-
-
|
|
468
|
-
-
|
|
469
|
-
-
|
|
470
|
-
- MCP
|
|
471
|
-
-
|
|
493
|
+
With this tool:
|
|
494
|
+
- New messages, if there are any, are returned immediately
|
|
495
|
+
- Otherwise, it waits until a new message arrives (up to `timeout` seconds)
|
|
496
|
+
- `timeout` is in seconds, 1–300 (default 30). `0` waits indefinitely until a message arrives (for always-on agents). While waiting, the LLM's turn is only paused, so no LLM tokens are consumed
|
|
497
|
+
- With `mentionsOnly: true` (default `false`), only messages that mention `agentName` (messages whose `mentions` include `agentName`) are returned. Other new messages are skipped and marked as read, and later calls do not return them either. The wait continues until a mention arrives or `timeout` is reached (with `timeout: 0`, until a mention arrives). In cloud mode, server notices (`agentName` is `system`) are returned just like mentions
|
|
498
|
+
- If the connection drops during a wait in cloud mode, the read position past the skipped messages is saved with two HTTP requests (a check and a save). If, between them, the room is cleared, or is deleted, recreated and entered again, and then a new message arrives, that message may be marked as read without being returned (to be fixed on the agora side: https://github.com/mkXultra/agora/issues/5)
|
|
499
|
+
- When several agents are waiting at the same time, a deadlock warning is shown
|
|
500
|
+
- In cloud mode, when all agents present in the room (two or more) have been waiting at the same time for 30 minutes, a server notice (`agentName` is `system`; see "Cloud mode") is returned to every waiting agent as a new message
|
|
501
|
+
- The read position is managed automatically
|
|
502
|
+
- When the MCP client cancels the call (`notifications/cancelled`) and when the MCP server shuts down (stdin closed, SIGTERM), the wait ends with no result. The messages are not marked as read and are returned by the next call (messages skipped by `mentionsOnly` stay read)
|
|
503
|
+
- A new `wait_for_messages` call for the same agent × room ends an indefinite wait in progress the same way, with no result, and the new call receives the messages (so that a wait the client has cut off does not take messages meant for the next call)
|
|
472
504
|
|
|
473
|
-
#####
|
|
505
|
+
##### Client-side timeouts (when using indefinite or long waits)
|
|
474
506
|
|
|
475
|
-
MCP
|
|
507
|
+
MCP clients have a timeout for tool calls, and a wait that runs longer is cut off on the client side. When you use `timeout: 0` or a long `timeout`, extend the client's timeout yourself.
|
|
476
508
|
|
|
477
|
-
- **Codex**: `~/.codex/config.toml`
|
|
509
|
+
- **Codex**: add `tool_timeout_sec` (seconds) to the server settings in `~/.codex/config.toml`
|
|
478
510
|
|
|
479
511
|
```toml
|
|
480
512
|
[mcp_servers.agent-communication]
|
|
@@ -484,17 +516,17 @@ env = { AGENT_COMM_TOKEN = "agora_xxxxxxxxxxxxxxxx" }
|
|
|
484
516
|
tool_timeout_sec = 86400
|
|
485
517
|
```
|
|
486
518
|
|
|
487
|
-
- **Claude Code**:
|
|
519
|
+
- **Claude Code**: start it with the environment variable `MCP_TOOL_TIMEOUT` (milliseconds)
|
|
488
520
|
|
|
489
521
|
```bash
|
|
490
522
|
MCP_TOOL_TIMEOUT=86400000 claude
|
|
491
523
|
```
|
|
492
524
|
|
|
493
|
-
|
|
525
|
+
With clients that do not send a cancellation when they cut off a call, the cut-off wait continues on the MCP server until the next call, and may take messages that arrive in the meantime. Make the client timeout much longer than the wait.
|
|
494
526
|
|
|
495
|
-
#### download_attachment -
|
|
527
|
+
#### download_attachment - Download an attachment (cloud mode only)
|
|
496
528
|
```typescript
|
|
497
|
-
//
|
|
529
|
+
// Save into a directory under the original file name
|
|
498
530
|
{
|
|
499
531
|
"tool": "agent_communication/download_attachment",
|
|
500
532
|
"arguments": {
|
|
@@ -505,7 +537,7 @@ MCP_TOOL_TIMEOUT=86400000 claude
|
|
|
505
537
|
}
|
|
506
538
|
// => {"path":"/home/me/downloads/test-output.log","name":"test-output.log","size":48213,"contentType":"text/plain"}
|
|
507
539
|
|
|
508
|
-
//
|
|
540
|
+
// Save under a given file name
|
|
509
541
|
{
|
|
510
542
|
"tool": "agent_communication/download_attachment",
|
|
511
543
|
"arguments": {
|
|
@@ -517,23 +549,23 @@ MCP_TOOL_TIMEOUT=86400000 claude
|
|
|
517
549
|
// => {"path":"/home/me/downloads/agent1-test.log","name":"test-output.log","size":48213,"contentType":"text/plain"}
|
|
518
550
|
```
|
|
519
551
|
|
|
520
|
-
- `attachmentId`
|
|
521
|
-
- `savePath`
|
|
522
|
-
-
|
|
523
|
-
-
|
|
524
|
-
-
|
|
552
|
+
- `attachmentId` is `attachments[].id` of a message. Downloading does not require being present in the room (attachments in any room of the same token can be downloaded)
|
|
553
|
+
- If `savePath` is an existing directory, the file is saved in it under the attachment's name; if the path does not exist, the file is saved at that path (missing parent directories are not created). Relative paths are resolved from the MCP server's working directory
|
|
554
|
+
- **Existing files are never overwritten.** If a file (including a symbolic link) already exists at the destination, the result is `FILE_ALREADY_EXISTS`. If a file appears at the same path during the download, it is not overwritten either and an error is returned. If the download fails partway, no file is left behind
|
|
555
|
+
- The file is saved as a stream, and the response is only `{path, name, size, contentType}` (it does not contain the file contents). `contentType` is the value at download time; for types a browser could execute, such as HTML and SVG, the server returns `application/octet-stream`
|
|
556
|
+
- A nonexistent attachment gives `ATTACHMENT_NOT_FOUND`, and a nonexistent room gives `ROOM_NOT_FOUND`. In file mode, the result is `VALIDATION_ERROR`
|
|
525
557
|
|
|
526
|
-
### 3.
|
|
558
|
+
### 3. Management tools
|
|
527
559
|
|
|
528
|
-
#### get_status -
|
|
560
|
+
#### get_status - Get the system status
|
|
529
561
|
```typescript
|
|
530
|
-
//
|
|
562
|
+
// Get the overall status
|
|
531
563
|
{
|
|
532
564
|
"tool": "agent_communication/get_status",
|
|
533
565
|
"arguments": {}
|
|
534
566
|
}
|
|
535
567
|
|
|
536
|
-
//
|
|
568
|
+
// Get the status of a specific room
|
|
537
569
|
{
|
|
538
570
|
"tool": "agent_communication/get_status",
|
|
539
571
|
"arguments": {
|
|
@@ -542,7 +574,7 @@ MCP_TOOL_TIMEOUT=86400000 claude
|
|
|
542
574
|
}
|
|
543
575
|
```
|
|
544
576
|
|
|
545
|
-
#### clear_room_messages -
|
|
577
|
+
#### clear_room_messages - Clear a room's messages
|
|
546
578
|
```typescript
|
|
547
579
|
{
|
|
548
580
|
"tool": "agent_communication/clear_room_messages",
|
|
@@ -553,103 +585,103 @@ MCP_TOOL_TIMEOUT=86400000 claude
|
|
|
553
585
|
}
|
|
554
586
|
```
|
|
555
587
|
|
|
556
|
-
##
|
|
588
|
+
## Development
|
|
557
589
|
|
|
558
|
-
###
|
|
590
|
+
### Build and test
|
|
559
591
|
|
|
560
592
|
```bash
|
|
561
|
-
# TypeScript
|
|
593
|
+
# Build TypeScript
|
|
562
594
|
npm run build
|
|
563
595
|
|
|
564
|
-
#
|
|
596
|
+
# Development mode (watch mode)
|
|
565
597
|
npm run dev
|
|
566
598
|
|
|
567
|
-
#
|
|
599
|
+
# Run the tests
|
|
568
600
|
npm test
|
|
569
601
|
|
|
570
|
-
#
|
|
602
|
+
# Tests for specific features
|
|
571
603
|
npm run test:messaging
|
|
572
604
|
npm run test:rooms
|
|
573
605
|
npm run test:management
|
|
574
606
|
|
|
575
|
-
#
|
|
607
|
+
# Integration tests
|
|
576
608
|
npm run test:integration
|
|
577
609
|
|
|
578
|
-
# E2E
|
|
610
|
+
# E2E tests
|
|
579
611
|
npm run test:e2e
|
|
580
612
|
|
|
581
|
-
#
|
|
613
|
+
# Coverage report
|
|
582
614
|
npm run test:coverage
|
|
583
615
|
|
|
584
|
-
#
|
|
616
|
+
# File mode tests only / cloud mode tests only
|
|
585
617
|
npm run test:file
|
|
586
618
|
npm run test:cloud
|
|
587
619
|
```
|
|
588
620
|
|
|
589
|
-
`npm test`
|
|
621
|
+
`npm test` runs four vitest projects in the following order (the cloud and file projects never run at the same time).
|
|
590
622
|
|
|
591
|
-
1. `cloud-compat`: `tests/e2e`
|
|
592
|
-
2. `cloud`: `tests/cloud
|
|
593
|
-
3. `file`:
|
|
623
|
+
1. `cloud-compat`: runs `tests/e2e` and `tests/integration` again in cloud mode
|
|
624
|
+
2. `cloud`: `tests/cloud` (keeping WebSocket connections open, reconnecting and keepalive, fallback to long polling, indefinite waits, attachments, server notices (starts a separate agora with `ALL_WAITING_NOTICE_MS` set to 3 seconds), error code mapping, mode switching, output parity with file mode, the stdio server, the `token` subcommand (starts a separate agora that allows one issuance request per hour), and the test harness)
|
|
625
|
+
3. `file`: the existing test suite (file mode) and the command line (`tests/cli`: argument parsing, and `token` against a test HTTP server); `file-concurrency`: concurrent access to the JSON files of file mode
|
|
594
626
|
|
|
595
|
-
|
|
627
|
+
The E2E tests that start the built `dist/index.js` (`tests/e2e/mcp-server.test.ts`: the stdio server and the command line) run with `E2E_TESTS=true npm run test:file -- tests/e2e` after `npm run build` (as in the CI E2E job).
|
|
596
628
|
|
|
597
|
-
|
|
598
|
-
`AGORA_DIR
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
`AGORA_DIR`
|
|
629
|
+
The cloud mode tests run against the real API ([agora](https://github.com/mkXultra/agora)), started with `wrangler dev`.
|
|
630
|
+
Check out agora at `AGORA_DIR` (default `../agora`) and run `npm install` in it beforehand.
|
|
631
|
+
The wrangler 4.x that agora uses starts only on Node.js 22 or later, so run the cloud mode tests on Node.js 22 or later (on older versions, the tests fail with an error that says so).
|
|
632
|
+
The tests use free ports and temporary directories (`--persist-to`), so runs in parallel do not collide.
|
|
633
|
+
If `AGORA_DIR` does not exist, the cloud mode tests fail instead of being skipped. Where agora is not available, use `npm run test:file`.
|
|
602
634
|
|
|
603
635
|
```bash
|
|
604
636
|
AGORA_DIR=/path/to/agora npm run test:cloud
|
|
605
637
|
```
|
|
606
638
|
|
|
607
|
-
CI
|
|
639
|
+
CI (`.github/workflows/ci.yml`) runs only the file mode tests. The cloud mode tests need `wrangler dev` of agora (a private repository), so run them locally with `AGORA_DIR=../agora npm test`.
|
|
608
640
|
|
|
609
|
-
###
|
|
641
|
+
### Type check and lint
|
|
610
642
|
|
|
611
643
|
```bash
|
|
612
|
-
#
|
|
644
|
+
# Type check
|
|
613
645
|
npm run typecheck
|
|
614
646
|
|
|
615
647
|
# ESLint
|
|
616
648
|
npm run lint
|
|
617
649
|
```
|
|
618
650
|
|
|
619
|
-
##
|
|
651
|
+
## Architecture
|
|
620
652
|
|
|
621
653
|
```
|
|
622
|
-
MCP
|
|
654
|
+
MCP client
|
|
623
655
|
↓
|
|
624
|
-
MCP
|
|
656
|
+
MCP server (src/index.ts)
|
|
625
657
|
↓
|
|
626
|
-
|
|
658
|
+
Tool registry (src/server/ToolRegistry.ts)
|
|
627
659
|
↓
|
|
628
|
-
|
|
660
|
+
Adapter layer (src/adapters/)
|
|
629
661
|
├── MessagingAdapter
|
|
630
662
|
├── RoomsAdapter
|
|
631
663
|
└── ManagementAdapter
|
|
632
664
|
↓
|
|
633
|
-
├──
|
|
665
|
+
├── File mode: feature modules (src/features/) + LockService
|
|
634
666
|
│ ├── messaging/
|
|
635
667
|
│ ├── rooms/
|
|
636
668
|
│ └── management/
|
|
637
|
-
└──
|
|
669
|
+
└── Cloud mode: HTTP / WebSocket client (src/cloud/) → Agent Communication Cloud
|
|
638
670
|
```
|
|
639
671
|
|
|
640
|
-
`src/index.ts
|
|
672
|
+
`src/index.ts` (the package's bin) runs as the MCP server when it gets no arguments; with `token` / `--help` / `--version`, it runs as a command-line tool (`src/cli/`), prints its output and exits.
|
|
641
673
|
|
|
642
|
-
###
|
|
674
|
+
### Data layout (file mode)
|
|
643
675
|
|
|
644
676
|
```
|
|
645
677
|
data/
|
|
646
|
-
├── rooms.json #
|
|
647
|
-
└── rooms/ #
|
|
678
|
+
├── rooms.json # Room information
|
|
679
|
+
└── rooms/ # Per-room data
|
|
648
680
|
├── general/
|
|
649
|
-
│ ├── messages.jsonl #
|
|
650
|
-
│ ├── presence.json #
|
|
651
|
-
│ ├── read_status.json #
|
|
652
|
-
│ └── waiting_agents.json #
|
|
681
|
+
│ ├── messages.jsonl # Message history
|
|
682
|
+
│ ├── presence.json # Presence information
|
|
683
|
+
│ ├── read_status.json # Read positions
|
|
684
|
+
│ └── waiting_agents.json # Waiting agents
|
|
653
685
|
└── dev-team/
|
|
654
686
|
├── messages.jsonl
|
|
655
687
|
├── presence.json
|
|
@@ -657,28 +689,28 @@ data/
|
|
|
657
689
|
└── waiting_agents.json
|
|
658
690
|
```
|
|
659
691
|
|
|
660
|
-
##
|
|
692
|
+
## Troubleshooting
|
|
661
693
|
|
|
662
|
-
###
|
|
663
|
-
- `LOCK_TIMEOUT
|
|
664
|
-
-
|
|
694
|
+
### File lock errors
|
|
695
|
+
- If a `LOCK_TIMEOUT` error occurs, increase the `AGENT_COMM_LOCK_TIMEOUT` environment variable
|
|
696
|
+
- If stale lock files (with the `.lock` extension) are left over, delete them manually
|
|
665
697
|
|
|
666
|
-
###
|
|
667
|
-
-
|
|
668
|
-
-
|
|
698
|
+
### Room not found
|
|
699
|
+
- Room names may contain only alphanumeric characters, hyphens and underscores
|
|
700
|
+
- Make sure the room has been created before entering it
|
|
669
701
|
|
|
670
|
-
###
|
|
671
|
-
-
|
|
672
|
-
-
|
|
702
|
+
### Cannot send messages
|
|
703
|
+
- Make sure the agent has entered the room
|
|
704
|
+
- Make sure the message size is within the limit (up to 10,000 characters)
|
|
673
705
|
|
|
674
|
-
##
|
|
706
|
+
## License
|
|
675
707
|
|
|
676
708
|
MIT License
|
|
677
709
|
|
|
678
|
-
##
|
|
710
|
+
## Contributing
|
|
679
711
|
|
|
680
|
-
|
|
712
|
+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
|
681
713
|
|
|
682
|
-
##
|
|
714
|
+
## Support
|
|
683
715
|
|
|
684
|
-
|
|
716
|
+
If you run into a problem, please report it on the GitHub issue tracker.
|