@commonlyai/mcp 0.3.29 → 0.3.31

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 +20 -0
  2. package/package.json +1 -1
  3. package/src/index.js +18 -5
package/README.md CHANGED
@@ -17,6 +17,26 @@ Commonly MCP Server — exposes the [Commonly](https://github.com/Team-Commonly/
17
17
  > commonly agent run <agent-name>
18
18
  > ```
19
19
  >
20
+ > In Windows PowerShell, which has no `export`, set the two variables with `$env:`:
21
+ >
22
+ > ```powershell
23
+ > npm i -g @commonlyai/cli@latest
24
+ > $env:COMMONLY_API_URL="https://api.commonly.me"
25
+ > $env:COMMONLY_AGENT_TOKEN="cm_agent_xxx"
26
+ > commonly agent run <agent-name> --unsandboxed
27
+ > ```
28
+ >
29
+ > Both forms last only in the window that ran them. Windows has no sandbox for
30
+ > the agent, so on native Windows `commonly agent run` refuses a Claude Code
31
+ > agent without `--unsandboxed`. With it, the agent keeps Commonly's restricted
32
+ > tool settings and gets no shell, but nothing at the OS level confines it,
33
+ > and it gets no connector grants. To keep it running after this window
34
+ > closes, run `commonly daemon install --unsandboxed`, then assign the agent to
35
+ > this computer under **Agents → Bring your own → On my computer**; the daemon
36
+ > runs only agents assigned to it, so close the foreground run after that.
37
+ > Neither Claude Code nor Codex has been tested on Windows yet; Codex needs no
38
+ > flag, and gets no connector grants there either.
39
+ >
20
40
  > The first run binds the CLI. To bind Codex instead of Claude Code, add `--adapter codex` to
21
41
  > that first `commonly agent run`. To switch an existing agent's adapter later:
22
42
  > `commonly agent config <name> --adapter codex` (daemon-managed), or
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.29",
4
+ "version": "0.3.31",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
package/src/index.js CHANGED
@@ -30,6 +30,7 @@ import { buildTools } from './tools.js';
30
30
  import { PACKAGE_VERSION } from './version.js';
31
31
 
32
32
  const PACKAGE_NAME = '@commonlyai/mcp';
33
+ const CHECK_IN_WAIT_MS = 1000;
33
34
 
34
35
  const main = async () => {
35
36
  // Fail fast on missing env. The MCP host (codex/claude) will surface this
@@ -64,22 +65,34 @@ const main = async () => {
64
65
  return tool.call(req.params.arguments || {});
65
66
  });
66
67
 
67
- const transport = new StdioServerTransport();
68
- await server.connect(transport);
69
-
70
68
  // One authenticated call at start (TASK-345). Until a tool ran, nothing
71
69
  // reached Commonly, so a working install and a broken one looked the same and
72
70
  // the agent never showed as connected. A failure goes to stderr and never
73
71
  // ends the server: stdout belongs to the MCP transport.
74
72
  // Bounded, so a server that never answers cannot keep the process alive
75
- // after the host has gone.
76
- request(config, {
73
+ // after the host has gone. Started before the transport, so it is already
74
+ // on its way when the client's initialize arrives.
75
+ const checkIn = request(config, {
77
76
  method: 'GET', path: '/api/agents/runtime/installations', signal: AbortSignal.timeout(10000),
78
77
  }).catch((e) => {
79
78
  // The status says which kind of failure this is; see docs/MCP_INTEGRATION.md.
80
79
  const status = e.status ? `HTTP ${e.status}: ` : '';
81
80
  process.stderr.write(`[commonly-mcp] could not reach Commonly at start: ${status}${e.message}\n`);
82
81
  });
82
+
83
+ const transport = new StdioServerTransport();
84
+ await server.connect(transport);
85
+
86
+ // `claude mcp list` initializes, prints "Connected" and closes the server,
87
+ // which once came before the check-in landed (Growth's walk, 11-04): the
88
+ // person who added it looked like one who never had. So initialize waits for
89
+ // the check-in, for at most a second, so a slow API never holds startup.
90
+ const deliver = transport.onmessage;
91
+ transport.onmessage = (message, extra) => {
92
+ if (message?.method !== 'initialize') return deliver(message, extra);
93
+ const cap = new Promise((resolve) => { setTimeout(resolve, CHECK_IN_WAIT_MS).unref(); });
94
+ return Promise.race([checkIn, cap]).then(() => deliver(message, extra));
95
+ };
83
96
  };
84
97
 
85
98
  main().catch((e) => {