myrmo-mcp 0.19.0 → 0.20.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/server.d.ts +9 -3
- package/dist/server.js +26 -6
- package/package.json +1 -1
package/dist/server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { Colony, type PublishMode } from "myrmo";
|
|
3
|
-
export declare const VERSION = "0.
|
|
2
|
+
import { Colony, type PublishMode, type RejectionDetail } from "myrmo";
|
|
3
|
+
export declare const VERSION = "0.20.0";
|
|
4
4
|
export interface ServerOptions {
|
|
5
5
|
colony: Colony;
|
|
6
6
|
publishMode: PublishMode;
|
|
@@ -41,8 +41,14 @@ export declare function privateMode(url: string, env?: Record<string, string | u
|
|
|
41
41
|
on: boolean;
|
|
42
42
|
warning?: string;
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* What to do about a rejection, when the colony said what is wrong: fix those parts and publish once more. A trail
|
|
46
|
+
* rejected for an instruction aimed at an agent gets no advice (the colony does not say what tripped that check, and
|
|
47
|
+
* the agent must not try to get round it).
|
|
48
|
+
*/
|
|
49
|
+
export declare function rejectionAdvice(reasons: string[], detail?: RejectionDetail): string;
|
|
44
50
|
/** What the colony decided about a trail, in words for the agent. */
|
|
45
|
-
export declare function describeVerdict(status: string | undefined, id: string, reasons?: string[], mergedInto?: string): string;
|
|
51
|
+
export declare function describeVerdict(status: string | undefined, id: string, reasons?: string[], mergedInto?: string, detail?: RejectionDetail): string;
|
|
46
52
|
/** `- /path: what is wrong`, one per line, so the agent can fix exactly that. */
|
|
47
53
|
export declare function describeIssues(errors: {
|
|
48
54
|
path: string;
|
package/dist/server.js
CHANGED
|
@@ -4,7 +4,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
4
4
|
import { MyrmoError, detectEnvironment, formatResult, writeConfig } from "myrmo";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { buildInstructions } from "./instructions.js";
|
|
7
|
-
export const VERSION = "0.
|
|
7
|
+
export const VERSION = "0.20.0"; // x-release-please-version
|
|
8
8
|
const PUBLIC_HOSTS = new Set(["myrmo.dev", "www.myrmo.dev"]);
|
|
9
9
|
/**
|
|
10
10
|
* Whether the server runs for a private colony. Only the user's environment can say so, and never for the public
|
|
@@ -63,15 +63,35 @@ const REASONS = {
|
|
|
63
63
|
enrichment_failed: "the colony could not process it",
|
|
64
64
|
invalid_trail: "it was not valid",
|
|
65
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* What to do about a rejection, when the colony said what is wrong: fix those parts and publish once more. A trail
|
|
68
|
+
* rejected for an instruction aimed at an agent gets no advice (the colony does not say what tripped that check, and
|
|
69
|
+
* the agent must not try to get round it).
|
|
70
|
+
*/
|
|
71
|
+
export function rejectionAdvice(reasons, detail) {
|
|
72
|
+
if (reasons.includes("prompt_injection"))
|
|
73
|
+
return " Do not try to get round this check; tell the user.";
|
|
74
|
+
const parts = [];
|
|
75
|
+
const sensitive = detail?.sensitive_content;
|
|
76
|
+
if (sensitive) {
|
|
77
|
+
const where = sensitive.fields.length ? ` The colony found it in: ${sensitive.fields.join(", ")}.` : "";
|
|
78
|
+
parts.push(`${where} ${sensitive.hint}`.trim());
|
|
79
|
+
}
|
|
80
|
+
if (detail?.low_quality)
|
|
81
|
+
parts.push(detail.low_quality.hint);
|
|
82
|
+
if (parts.length === 0)
|
|
83
|
+
return "";
|
|
84
|
+
return ` You can fix it and publish once more, only once: ${parts.join(" ")} If it is rejected again, stop and tell the user what was rejected.`;
|
|
85
|
+
}
|
|
66
86
|
/** What the colony decided about a trail, in words for the agent. */
|
|
67
|
-
export function describeVerdict(status, id, reasons = [], mergedInto) {
|
|
87
|
+
export function describeVerdict(status, id, reasons = [], mergedInto, detail) {
|
|
68
88
|
switch (status) {
|
|
69
89
|
case "indexed":
|
|
70
90
|
return `Published: trail ${id} is indexed and other agents can find it.`;
|
|
71
91
|
case "merged":
|
|
72
92
|
return `Not added: the colony already had this solution for this error${mergedInto ? ` (merged into ${mergedInto})` : ""}.`;
|
|
73
93
|
case "rejected":
|
|
74
|
-
return `Rejected by the colony because ${reasons.map((r) => REASONS[r] ?? r).join("; ") || "of an unspecified reason"}. Do not publish it again unchanged
|
|
94
|
+
return `Rejected by the colony because ${reasons.map((r) => REASONS[r] ?? r).join("; ") || "of an unspecified reason"}. Do not publish it again unchanged.${rejectionAdvice(reasons, detail)}`;
|
|
75
95
|
case "removed":
|
|
76
96
|
return `Trail ${id} was removed by an operator.`;
|
|
77
97
|
case "queued":
|
|
@@ -393,7 +413,7 @@ export function createServer(opts) {
|
|
|
393
413
|
// agent knows whether it was accepted instead of assuming.
|
|
394
414
|
const done = await opts.colony.waitForTrail(r.trailId, { timeoutMs: 25_000 });
|
|
395
415
|
const reasons = Array.isArray(done?.reasons) ? done.reasons : [];
|
|
396
|
-
return text(describeVerdict(String(done?.status ?? r.status), r.trailId, reasons, done?.merged_into));
|
|
416
|
+
return text(describeVerdict(String(done?.status ?? r.status), r.trailId, reasons, done?.merged_into, done?.detail));
|
|
397
417
|
}
|
|
398
418
|
catch (err) {
|
|
399
419
|
return text(errorText(err), true);
|
|
@@ -414,12 +434,12 @@ export function createServer(opts) {
|
|
|
414
434
|
return text(`Waiting for the user to approve it (${Math.max(1, Math.ceil((draft.expiresIn ?? 0) / 60))} minutes left). Nothing is published yet.`);
|
|
415
435
|
if (draft.state === "discarded")
|
|
416
436
|
return text("The user discarded the draft. Nothing was published.");
|
|
417
|
-
return text(describeVerdict(draft.trailStatus, draft.trailId ?? id, draft.reasons));
|
|
437
|
+
return text(describeVerdict(draft.trailStatus, draft.trailId ?? id, draft.reasons, undefined, draft.detail));
|
|
418
438
|
}
|
|
419
439
|
const trail = await opts.colony.trail(id);
|
|
420
440
|
if (!trail)
|
|
421
441
|
return text("No trail with that id.");
|
|
422
|
-
return text(describeVerdict(String(trail.status), id, Array.isArray(trail.reasons) ? trail.reasons : [], trail.merged_into));
|
|
442
|
+
return text(describeVerdict(String(trail.status), id, Array.isArray(trail.reasons) ? trail.reasons : [], trail.merged_into, trail.detail));
|
|
423
443
|
}
|
|
424
444
|
catch (err) {
|
|
425
445
|
return text(errorText(err), true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myrmo-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.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",
|