myrmo-mcp 0.35.0 → 0.36.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/dist/index.js CHANGED
@@ -436,6 +436,28 @@ function sendJson(res, status, body) {
436
436
  async function serveHttp(port, host) {
437
437
  const hosts = allowedHosts(port);
438
438
  const url = hostedColonyUrl();
439
+ // What the colony says it is decides private mode, as in the stdio client. A private colony tells only callers with a
440
+ // key, and this server has none of its own: it asks with the first caller's key and remembers the answer for everyone.
441
+ // MYRMO_PRIVATE=1 still turns it on from the start. A caller without a key never gets private mode from a declaration.
442
+ let declared;
443
+ let asking;
444
+ const learn = (key) => (asking ??= fetch(`${url.replace(/\/+$/, "")}/v1/version`, {
445
+ headers: { accept: "application/json", "x-myrmo-client": `myrmo-mcp/${VERSION}`, authorization: `Bearer ${key}` },
446
+ signal: AbortSignal.timeout(2000),
447
+ })
448
+ .then(async (r) => {
449
+ const said = r.ok ? clean((await r.json()).colony) : undefined;
450
+ if (said)
451
+ declared = said;
452
+ else
453
+ asking = undefined; // a wrong key or an older colony: ask again with the next caller
454
+ })
455
+ .catch(() => {
456
+ asking = undefined;
457
+ }));
458
+ const warned = privateMode(url, process.env, false, undefined, false).warning;
459
+ if (warned)
460
+ console.error(`myrmo-mcp: ${warned}`);
439
461
  const http = createHttpServer(async (req, res) => {
440
462
  const path = (req.url ?? "/").split("?")[0];
441
463
  if (path === "/healthz")
@@ -457,18 +479,25 @@ async function serveHttp(port, host) {
457
479
  const agent = req.headers["x-myrmo-agent"];
458
480
  if (typeof agent === "string")
459
481
  headers["x-myrmo-agent"] = agent;
482
+ // The caller's own key or none: never MYRMO_API_KEY or a key saved on this machine, which anyone who can reach
483
+ // this port would otherwise use.
484
+ const key = callerKey(req.headers.authorization);
485
+ if (key && !declared)
486
+ await learn(key);
487
+ const privacy = privateMode(url, process.env, false, declared, Boolean(key));
488
+ const keepPersonal = declared?.keep_personal === true;
460
489
  const colony = new Colony({
461
490
  url,
462
491
  headers,
463
- // The caller's own key or none: never MYRMO_API_KEY or a key saved on this machine, which anyone who can reach
464
- // this port would otherwise use.
465
- apiKey: callerKey(req.headers.authorization),
492
+ apiKey: key,
493
+ private: privacy.on,
494
+ keepPersonal,
466
495
  publish: "off",
467
496
  cacheTtlMs: 0,
468
497
  // The hosted server has no identity of its own: it forwards the header of whoever is calling.
469
498
  agentId: false,
470
499
  });
471
- const server = createServer({ colony, publishMode: "off", minFailedAttempts, fillLocalEnvironment: false, hosted: true });
500
+ const server = createServer({ colony, publishMode: "off", minFailedAttempts, fillLocalEnvironment: false, hosted: true, privateColony: privacy.on, keepPersonal });
472
501
  // A web page can make a browser send requests to this port under a name it controls (DNS rebinding): only the
473
502
  // Host names this server is meant for are answered (MYRMO_MCP_ALLOWED_HOSTS).
474
503
  const transport = new StreamableHTTPServerTransport({
package/dist/server.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { Colony, type PublishMode, type RejectionDetail } from "myrmo";
3
- export declare const VERSION = "0.35.0";
3
+ export declare const VERSION = "0.36.0";
4
4
  export interface ServerOptions {
5
5
  colony: Colony;
6
6
  /** Who this server acts as, for the agent to read: a prefix of the key's hash, or of the agent id. Never the key. */
package/dist/server.js CHANGED
@@ -7,7 +7,7 @@ import { z } from "zod";
7
7
  import { checkTrail } from "./check.js";
8
8
  import { buildInstructions } from "./instructions.js";
9
9
  import { MATTER_DESCRIPTION, MATTERS_DESCRIPTION, formatMatter, formatMatters } from "./worklog.js";
10
- export const VERSION = "0.35.0"; // x-release-please-version
10
+ export const VERSION = "0.36.0"; // x-release-please-version
11
11
  const PUBLIC_HOSTS = new Set(["myrmo.dev", "www.myrmo.dev"]);
12
12
  /**
13
13
  * Whether the server runs for an organisation's colony, where agents keep its internal names. Never for the public
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myrmo-mcp",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Myrmo MCP server: gives Claude Code, Cursor, Windsurf and any MCP client a shared memory of solved errors. Search fixes other AI agents found, report outcomes, publish new ones.",
5
5
  "license": "Apache-2.0",
6
6
  "mcpName": "io.github.MartinM10/myrmo",