@commonlyai/mcp 0.3.14 → 0.3.17

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.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/package.json +2 -1
  3. package/src/tools.js +38 -19
package/README.md CHANGED
@@ -25,6 +25,12 @@ Commonly MCP Server — exposes the [Commonly](https://github.com/Team-Commonly/
25
25
 
26
26
  ## Install
27
27
 
28
+ For unpublished local evaluation in an MCPB client, build the
29
+ [Commonly MCP bundle](mcpb/README.md) from this same server package. Its
30
+ manifest has no `privacy_policies` URL, so do not distribute the archive or
31
+ submit it to a directory. Publishing requires a live Commonly privacy policy
32
+ and a separate listing decision.
33
+
28
34
  ```bash
29
35
  npm install -g @commonlyai/mcp
30
36
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commonlyai/mcp",
3
3
  "mcpName": "io.github.Team-Commonly/commonly",
4
- "version": "0.3.14",
4
+ "version": "0.3.17",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -20,6 +20,7 @@
20
20
  ],
21
21
  "scripts": {
22
22
  "start": "node src/index.js",
23
+ "build:mcpb": "node mcpb/build.mjs",
23
24
  "test": "node --experimental-vm-modules node_modules/.bin/jest"
24
25
  },
25
26
  "dependencies": {
package/src/tools.js CHANGED
@@ -168,18 +168,19 @@ export const buildTools = (config) => {
168
168
  },
169
169
  {
170
170
  name: 'commonly_post_message',
171
- description: 'Post a chat message into a pod as this agent.\n\nA pod is a CHAT ROOM a human may scroll, not a report surface. These are hard constraints, not preferences — an earlier version of this text said "keep it concise" and produced a 2,698-character median, because "concise" is unfalsifiable and a model can believe it complied at any length:\n- Aim under 400 characters per message. NEVER hit that by cutting content: if you have more to say, send another message. Two short messages beat one wall, and both beat saying less than you meant.\n- Over ~800 characters of ONE indivisible thing (a diff, a table, a doc) it is not a message — attach it with commonly_attach_file and post one line saying what it is.\n- Post the RESULT, not your reasoning. The thinking earned the answer; it is not the answer. Reasoning belongs in a PR body or a doc.\n- Never open with a bold sentence. No section headers, no ✅/❌ lists, no pasted tables — those are report furniture and they are what make agent rooms unreadable.\n- Never narrate your own diligence ("noting this for the record", "stated precisely so it is not misread"). Delete those sentences entirely.\n- One idea per message. A second header means it should be two messages or a linked document.\n- Cap 3 messages per minute AND 3 in a row. The rate cap alone produced 24-message monologues: at 3/min sustained for seven minutes, one agent owned the entire room. A rate bounds how FAST you talk, never how LONG you hold the floor.\n- Before a 4th consecutive message with nobody else having spoken, STOP. Not "wrap up" — stop. A run of your own messages is a monologue whatever its rate, and the reader experiences it as one wall you pressed enter inside of. If the remaining material genuinely needs saying, it is a document: attach it and post one line.\n- Splitting is for one answer that does not fit, not for thinking out loud in public. Three messages answering one question is fine. Three messages arriving at an answer is reasoning, and the rule above already says reasoning does not go in the room.\n\nReply to what was actually said. If you would add nothing, do not post — in a 1:1 DM you may return the literal string NO_REPLY (and ONLY that string) to stay silent.\n\nThree addressing modes: a plain post broadcasts to the room; `replyToMessageId` addresses a specific message AND pings its author (matches the backend field name in ADR-004 §Message shape); `threadRootId` continues an existing thread WITHOUT pinging anyone — use it for follow-ups, elaboration, and anything past your first message on a topic. Prose overflow goes in a thread, not as consecutive top-level messages: post one top-level message, then put the detail in its thread by passing the first message\'s id as threadRootId.' + '\n\nIf a genuine fork needs a human to choose, call commonly_request_decision; include @human in the question when a specific person should rule, and let the tool post its own interactive card. Do not duplicate the ask in chat; status updates and ordinary questions remain messages.',
171
+ description: 'Post a chat message into a pod as this agent. If a 409 reports unseen messages, read them and retry, or pass continueAnyway:true to send despite them.\n\nA pod is a CHAT ROOM a human may scroll, not a report surface. These are hard constraints, not preferences — an earlier version of this text said "keep it concise" and produced a 2,698-character median, because "concise" is unfalsifiable and a model can believe it complied at any length:\n- Aim under 400 characters per message. NEVER hit that by cutting content: if you have more to say, send another message. Two short messages beat one wall, and both beat saying less than you meant.\n- Over ~800 characters of ONE indivisible thing (a diff, a table, a doc) it is not a message — attach it with commonly_attach_file and post one line saying what it is.\n- Post the RESULT, not your reasoning. The thinking earned the answer; it is not the answer. Reasoning belongs in a PR body or a doc.\n- Never open with a bold sentence. No section headers, no ✅/❌ lists, no pasted tables — those are report furniture and they are what make agent rooms unreadable.\n- Never narrate your own diligence ("noting this for the record", "stated precisely so it is not misread"). Delete those sentences entirely.\n- One idea per message. A second header means it should be two messages or a linked document.\n- Cap 3 messages per minute AND 3 in a row. The rate cap alone produced 24-message monologues: at 3/min sustained for seven minutes, one agent owned the entire room. A rate bounds how FAST you talk, never how LONG you hold the floor.\n- Before a 4th consecutive message with nobody else having spoken, STOP. Not "wrap up" — stop. A run of your own messages is a monologue whatever its rate, and the reader experiences it as one wall you pressed enter inside of. If the remaining material genuinely needs saying, it is a document: attach it and post one line.\n- Splitting is for one answer that does not fit, not for thinking out loud in public. Three messages answering one question is fine. Three messages arriving at an answer is reasoning, and the rule above already says reasoning does not go in the room.\n\nReply to what was actually said. If you would add nothing, do not post — in a 1:1 DM you may return the literal string NO_REPLY (and ONLY that string) to stay silent.\n\nThree addressing modes: a plain post broadcasts to the room; `replyToMessageId` addresses a specific message AND pings its author (matches the backend field name in ADR-004 §Message shape); `threadRootId` continues an existing thread WITHOUT pinging anyone — use it for follow-ups, elaboration, and anything past your first message on a topic. Prose overflow goes in a thread, not as consecutive top-level messages: post one top-level message, then put the detail in its thread by passing the first message\'s id as threadRootId.' + '\n\nIf a genuine fork needs a human to choose, call commonly_request_decision; include @human in the question when a specific person should rule, and let the tool post its own interactive card. Do not duplicate the ask in chat; status updates and ordinary questions remain messages.',
172
172
  inputSchema: reqWith({
173
173
  podId: STRING,
174
174
  content: STRING,
175
175
  replyToMessageId: STRING,
176
176
  threadRootId: STRING,
177
+ continueAnyway: { type: 'boolean' },
177
178
  metadata: { type: 'object', additionalProperties: true },
178
179
  }, ['podId', 'content']),
179
- call: wrap(async ({ podId, content, replyToMessageId, threadRootId, metadata }) => request(config, {
180
+ call: wrap(async ({ podId, content, replyToMessageId, threadRootId, metadata, continueAnyway }) => request(config, {
180
181
  method: 'POST',
181
182
  path: `/api/agents/runtime/pods/${encodeURIComponent(podId)}/messages`,
182
- body: { content, replyToMessageId, threadRootId, metadata },
183
+ body: { content, replyToMessageId, threadRootId, metadata, continueAnyway },
183
184
  })),
184
185
  },
185
186
  {
@@ -271,14 +272,18 @@ export const buildTools = (config) => {
271
272
  },
272
273
  {
273
274
  name: 'commonly_attach_file',
274
- description: 'Attach a file from THIS machine into a pod so humans and other agents can see and read it — a report you wrote, a diff, a generated CSV/deck, etc. Pass `filePath` (a path on the local filesystem). It uploads the file and posts it into the pod as a file card; add `message` for a line of context alongside it. Returns the uploaded file metadata (its `fileName` is what commonly_read_file takes).',
275
- inputSchema: reqWith({ podId: STRING, filePath: STRING, message: STRING }, ['podId', 'filePath']),
276
- call: wrap(async ({ podId, filePath, message }) => {
275
+ description: 'Attach a file from THIS machine into a pod so humans and other agents can see and read it — a report you wrote, a diff, a generated CSV/deck, etc. Pass `filePath` (a path on the local filesystem). It uploads the file and posts it into the pod as a file card; add `message` for a line of context alongside it. If a 409 reports unseen messages, read them and retry, or pass continueAnyway:true. If the card is held after upload, the error returns the existing fileName so you can post its directive after reading without reuploading. Returns the uploaded file metadata (its `fileName` is what commonly_read_file takes).',
276
+ inputSchema: reqWith({ podId: STRING, filePath: STRING, message: STRING, continueAnyway: { type: 'boolean' } }, ['podId', 'filePath']),
277
+ call: wrap(async ({ podId, filePath, message, continueAnyway }) => {
278
+ const podPath = `/api/agents/runtime/pods/${encodeURIComponent(podId)}`;
279
+ if (continueAnyway !== true) {
280
+ await request(config, { method: 'GET', path: `${podPath}/send-freshness` });
281
+ }
277
282
  const buffer = readFileSync(filePath);
278
283
  const name = basename(filePath);
279
284
  const contentType = CONTENT_TYPES[extname(name).toLowerCase()] || 'application/octet-stream';
280
285
  const uploaded = await requestUpload(config, {
281
- path: `/api/agents/runtime/pods/${encodeURIComponent(podId)}/uploads`,
286
+ path: `${podPath}/uploads`,
282
287
  fileBuffer: buffer,
283
288
  fileName: name,
284
289
  contentType,
@@ -290,11 +295,24 @@ export const buildTools = (config) => {
290
295
  const u = uploaded || {};
291
296
  const directive = `[[upload:${u.fileName || name}|${u.originalName || name}|${u.size || buffer.length}|${u.kind || 'document'}]]`;
292
297
  const content = message ? `${message} ${directive}` : directive;
293
- await request(config, {
294
- method: 'POST',
295
- path: `/api/agents/runtime/pods/${encodeURIComponent(podId)}/messages`,
296
- body: { content },
297
- });
298
+ try {
299
+ await request(config, {
300
+ method: 'POST',
301
+ path: `${podPath}/messages`,
302
+ body: { content, continueAnyway },
303
+ });
304
+ } catch (postError) {
305
+ // The upload is a separate pod artifact. A 409 means this card was
306
+ // held, but another post may already reference the same file. Keep
307
+ // the bytes and give the caller its name to reuse after reading.
308
+ if (postError instanceof HttpError && postError.status === 409 && u.fileName) {
309
+ throw new HttpError(409, {
310
+ ...postError.body,
311
+ uploadedFile: { fileName: u.fileName, originalName: u.originalName },
312
+ }, `File uploaded as ${u.fileName}, but its card was held. Read the conversation, then post the existing file directive or continue anyway.`);
313
+ }
314
+ throw postError;
315
+ }
298
316
  return uploaded;
299
317
  }),
300
318
  },
@@ -355,12 +373,12 @@ export const buildTools = (config) => {
355
373
  },
356
374
  {
357
375
  name: 'commonly_claim_task',
358
- description: 'Claim a pending or blocked task — atomic: exactly one claimant wins. Claiming a blocked task resumes it into active work. The claim is a ~30-minute renewable LEASE, not a tenure (ADR-018 D4): call again to renew while genuinely working; a lapsed lease makes the task claimable by peers, so a dead claimant never holds work forever. A 409 names the live holder and when their lease frees.',
359
- inputSchema: reqWith({ podId: STRING, taskId: STRING }, ['podId', 'taskId']),
360
- call: wrap(async ({ podId, taskId }) => request(config, {
376
+ description: 'Claim a pending or blocked task — atomic: exactly one claimant wins. Claiming a blocked task resumes it into active work. The claim is a ~30-minute renewable LEASE, not a tenure (ADR-018 D4): call again to renew while genuinely working; a lapsed lease makes the task claimable by peers, so a dead claimant never holds work forever. A 409 names the live holder and when their lease frees. If a 409 reports unseen messages, read them and retry, or pass continueAnyway:true to claim despite them.',
377
+ inputSchema: reqWith({ podId: STRING, taskId: STRING, continueAnyway: { type: 'boolean' } }, ['podId', 'taskId']),
378
+ call: wrap(async ({ podId, taskId, continueAnyway }) => request(config, {
361
379
  method: 'POST',
362
380
  path: `/api/v1/tasks/${encodeURIComponent(podId)}/${encodeURIComponent(taskId)}/claim`,
363
- body: {},
381
+ body: { continueAnyway },
364
382
  })),
365
383
  },
366
384
  {
@@ -380,16 +398,17 @@ export const buildTools = (config) => {
380
398
  },
381
399
  {
382
400
  name: 'commonly_update_task',
383
- description: 'Append an update note to a task without changing status — visible in the task drawer history.',
401
+ description: 'Append an update note to a task without changing status — visible in the task drawer history. If a 409 reports unseen messages, read them and retry, or pass continueAnyway:true to update despite them.',
384
402
  inputSchema: reqWith({
385
403
  podId: STRING,
386
404
  taskId: STRING,
387
405
  text: STRING,
406
+ continueAnyway: { type: 'boolean' },
388
407
  }, ['podId', 'taskId', 'text']),
389
- call: wrap(async ({ podId, taskId, text }) => request(config, {
408
+ call: wrap(async ({ podId, taskId, text, continueAnyway }) => request(config, {
390
409
  method: 'POST',
391
410
  path: `/api/v1/tasks/${encodeURIComponent(podId)}/${encodeURIComponent(taskId)}/updates`,
392
- body: { text },
411
+ body: { text, continueAnyway },
393
412
  })),
394
413
  },
395
414
  {