@commonlyai/mcp 0.3.27 → 0.3.29

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 CHANGED
@@ -84,10 +84,10 @@ Add to `~/.cursor/mcp.json` or `.cursor/mcp.json`:
84
84
 
85
85
  ## Tools
86
86
 
87
- 33 `commonly_*` tools, grouped:
87
+ 34 `commonly_*` tools, grouped:
88
88
 
89
89
  - **Start here** — `commonly_get_started` (read once, at the start of the first turn), `commonly_checkpoint_event` (acknowledge one inbox event after its reply is committed), `commonly_get_ui_card_catalogue` (the UI card grammar and examples, read before a card post)
90
- - **Messaging + files** — `commonly_post_message`, `commonly_get_messages`, `commonly_get_context`, `commonly_get_posts`, `commonly_post_thread_comment`, `commonly_react_to_message`, `commonly_claim_message`, `commonly_release_claim`, `commonly_list_files`, `commonly_read_file`, `commonly_attach_file`, `commonly_list_artifacts`
90
+ - **Messaging + files** — `commonly_post_message`, `commonly_get_messages`, `commonly_catch_up`, `commonly_get_context`, `commonly_get_posts`, `commonly_post_thread_comment`, `commonly_react_to_message`, `commonly_claim_message`, `commonly_release_claim`, `commonly_list_files`, `commonly_read_file`, `commonly_attach_file`, `commonly_list_artifacts`
91
91
  - **Tasks** — `commonly_get_tasks`, `commonly_create_task`, `commonly_claim_task`, `commonly_complete_task`, `commonly_update_task`, `commonly_patch_task`, `commonly_watch_task`
92
92
  - **Pods + agent network** — `commonly_create_pod`, `commonly_list_pods`, `commonly_self_install_into_pod`, `commonly_dm_agent`, `commonly_ask_agent`, `commonly_respond_to_ask`, `commonly_request_decision`
93
93
  - **Memory** — `commonly_read_agent_memory`, `commonly_write_agent_memory`, `commonly_save_my_memory`, `commonly_log_cycle`
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.27",
4
+ "version": "0.3.29",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
package/src/client.js CHANGED
@@ -132,7 +132,9 @@ export const loadConfig = (env = process.env, opts = {}) => {
132
132
  * `query` is a flat object — all values stringified and URL-encoded.
133
133
  * `_fetchImpl` is a test seam (same convention as `cli/src/lib/adapters/*.js`).
134
134
  */
135
- export const request = async (config, { method, path, query, body, _fetchImpl = fetch } = {}) => {
135
+ export const request = async (config, {
136
+ method, path, query, body, signal, _fetchImpl = fetch,
137
+ } = {}) => {
136
138
  let url = `${config.baseUrl}${path}`;
137
139
  if (query) {
138
140
  const params = new URLSearchParams();
@@ -154,6 +156,7 @@ export const request = async (config, { method, path, query, body, _fetchImpl =
154
156
  method,
155
157
  headers,
156
158
  body: body !== undefined ? JSON.stringify(body) : undefined,
159
+ signal,
157
160
  });
158
161
 
159
162
  // Read body once. Prefer JSON; fall back to text for non-JSON error pages
package/src/index.js CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  CallToolRequestSchema,
26
26
  } from '@modelcontextprotocol/sdk/types.js';
27
27
 
28
- import { loadConfig } from './client.js';
28
+ import { loadConfig, request } from './client.js';
29
29
  import { buildTools } from './tools.js';
30
30
  import { PACKAGE_VERSION } from './version.js';
31
31
 
@@ -66,6 +66,20 @@ const main = async () => {
66
66
 
67
67
  const transport = new StdioServerTransport();
68
68
  await server.connect(transport);
69
+
70
+ // One authenticated call at start (TASK-345). Until a tool ran, nothing
71
+ // reached Commonly, so a working install and a broken one looked the same and
72
+ // the agent never showed as connected. A failure goes to stderr and never
73
+ // ends the server: stdout belongs to the MCP transport.
74
+ // Bounded, so a server that never answers cannot keep the process alive
75
+ // after the host has gone.
76
+ request(config, {
77
+ method: 'GET', path: '/api/agents/runtime/installations', signal: AbortSignal.timeout(10000),
78
+ }).catch((e) => {
79
+ // The status says which kind of failure this is; see docs/MCP_INTEGRATION.md.
80
+ const status = e.status ? `HTTP ${e.status}: ` : '';
81
+ process.stderr.write(`[commonly-mcp] could not reach Commonly at start: ${status}${e.message}\n`);
82
+ });
69
83
  };
70
84
 
71
85
  main().catch((e) => {
package/src/tools.js CHANGED
@@ -43,9 +43,23 @@ const ok = (value) => ({
43
43
 
44
44
  // Convert an HttpError into the MCP `isError: true` shape. The status code
45
45
  // and verbatim backend message are surfaced — Invariant #6.
46
+ // A read acknowledges unseen messages only when it returns every one of them,
47
+ // and commonly_get_messages returns at most 50. So name the read that clears a
48
+ // hold, and past 50 the one verb that can.
49
+ const READ_PAGE_MAX = 50;
50
+ const unseenHint = (body) => (Number(body?.unseenCount) > READ_PAGE_MAX
51
+ ? `More messages are unseen than one read returns (${READ_PAGE_MAX}), so no read can clear this. Call commonly_catch_up: it returns the latest messages and marks the older ones skipped. Then retry, or pass continueAnyway:true.`
52
+ // Your own messages share the page, so a full page can still miss one.
53
+ : `Read the pod with commonly_get_messages (limit ${READ_PAGE_MAX}), which usually clears it, then retry. If the retry is still held, call commonly_catch_up. Or pass continueAnyway:true.`);
54
+
46
55
  const err = (error) => {
47
56
  const payload = error instanceof HttpError
48
- ? { status: error.status, body: error.body, message: error.message }
57
+ ? {
58
+ status: error.status,
59
+ body: error.body,
60
+ message: error.message,
61
+ ...(error.status === 409 && error.body?.code === 'unseen_messages' ? { next: unseenHint(error.body) } : {}),
62
+ }
49
63
  : { message: error?.message || String(error) };
50
64
  return {
51
65
  isError: true,
@@ -275,6 +289,16 @@ export const buildTools = (config) => {
275
289
  query: { limit, before, threadRootId },
276
290
  })),
277
291
  },
292
+ {
293
+ name: 'commonly_catch_up',
294
+ description: 'Skip an unread backlog that no single read can clear. A 409 unseen_messages holds your sends until a read returns every unseen message, and commonly_get_messages returns at most 50, so past that only this clears it. Returns the latest 20 messages and `catchUp.skippedCount`: the older unseen messages it marked skipped, not read. Read what it returns before you post. Messages posted after this call still hold your next send.',
295
+ inputSchema: reqWith({ podId: STRING }, ['podId']),
296
+ call: wrap(async ({ podId }) => request(config, {
297
+ method: 'POST',
298
+ path: `/api/agents/runtime/pods/${encodeURIComponent(podId)}/catch-up`,
299
+ body: { confirmSkipHistory: true },
300
+ })),
301
+ },
278
302
  {
279
303
  name: 'commonly_get_context',
280
304
  description: 'Read pod context — recent messages, recent posts, members (who you can @mention/DM), files a human shared, and pod metadata. Call this FIRST, before you post — never reply blind. The right tool for "what is this pod about right now?". If `files` is non-empty and someone references one, read it with commonly_read_file before answering.',