lodestar-mcp 0.1.0 → 0.2.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/README.md +4 -1
- package/dist/stdio-server.js +137 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,10 +73,13 @@ npx -y lodestar-mcp setup --client claude-desktop
|
|
|
73
73
|
|
|
74
74
|
## Exposed Tools, Resources & Prompts
|
|
75
75
|
|
|
76
|
-
### Tools (
|
|
76
|
+
### Tools (15 on hosted `https://lodestar.so/mcp`)
|
|
77
77
|
|
|
78
78
|
- `lodestar_eval_probes` — Score prompts, messages, RAG context, or tool outputs at Token 0 (~20ms, \$0 output).
|
|
79
79
|
- `lodestar_chat` — Run Glass-Box chat completions with `probes`, `abort_if`, `on_abort` remediation, and surgical `patches`.
|
|
80
|
+
- `lodestar_teach_lesson` — Teach a workspace continual model a permanent rule from plain English, a `trace_id`, or a `bad_output -> good_output` diff (~2–5s).
|
|
81
|
+
- `lodestar_list_lessons` — List learned lessons, versions, trigger counts, delivery modes (`guard`, `episodic`, `hybrid`, `weight`), and consolidation status.
|
|
82
|
+
- `lodestar_revert_lesson` — Instantly roll back a continual model by `lesson_id` or `to_version`.
|
|
80
83
|
- `lodestar_list_probes` — List workspace built-in guards and custom probes.
|
|
81
84
|
- `lodestar_test_guard_stack` — Test a prompt against the workspace's full configured guard stack.
|
|
82
85
|
- `lodestar_update_guard` — Enable/disable or tune a built-in guard threshold (0.10–0.99).
|
package/dist/stdio-server.js
CHANGED
|
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { DEFAULT_API_BASE_URL, normalizeMcpUrl } from "./clients.js";
|
|
6
|
-
const DEFAULT_MODEL = "
|
|
6
|
+
const DEFAULT_MODEL = "lodestar-s1";
|
|
7
7
|
function parseSseMessages(bodyText) {
|
|
8
8
|
const out = [];
|
|
9
9
|
let dataLines = [];
|
|
@@ -197,9 +197,9 @@ export function createDirectApiMcpServer(opts) {
|
|
|
197
197
|
}
|
|
198
198
|
return parsed;
|
|
199
199
|
}
|
|
200
|
-
const server = new McpServer({ name: "lodestar", version: "0.
|
|
200
|
+
const server = new McpServer({ name: "lodestar", version: "0.2.0" }, {
|
|
201
201
|
capabilities: { tools: {}, resources: {}, prompts: {} },
|
|
202
|
-
instructions: "Lodestar Direct API MCP server connected to api.lodestar.so/v1. Use lodestar_eval_probes to score prompts before generation, lodestar_chat for guarded completions with abort_if/on_abort/patches, and lodestar_create_probe to train custom System-One probes.",
|
|
202
|
+
instructions: "Lodestar Direct API MCP server connected to api.lodestar.so/v1. Use lodestar_eval_probes to score prompts before generation, lodestar_chat for guarded completions with abort_if/on_abort/patches, lodestar_teach_lesson / lodestar_list_lessons / lodestar_revert_lesson for continual learning, and lodestar_create_probe to train custom System-One probes.",
|
|
203
203
|
});
|
|
204
204
|
server.registerTool("lodestar_eval_probes", {
|
|
205
205
|
title: "Evaluate System-One Probes",
|
|
@@ -357,6 +357,140 @@ export function createDirectApiMcpServer(opts) {
|
|
|
357
357
|
return errorToolResult(err instanceof Error ? err.message : "Failed to fetch usage.");
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
|
+
server.registerTool("lodestar_teach_lesson", {
|
|
361
|
+
title: "Teach a Continual Learning Lesson",
|
|
362
|
+
description: "Teach a workspace continual model a permanent behavioral rule from plain English, a production trace_id, or a bad_output -> good_output diff. Compiles a zero-false-positive Token-0 probe in ~2-5s and auto-consolidates skill lessons or lessons with 5+ traces into weights.",
|
|
363
|
+
inputSchema: {
|
|
364
|
+
model: z.string().min(2).max(80).describe("Continual model slug (e.g. 'acme-agent'). Auto-created on first teach()."),
|
|
365
|
+
correction: z.string().optional().describe("Plain-English policy, guard, or skill rule to teach."),
|
|
366
|
+
trace_id: z.string().optional().describe("Optional production trace ID where the model failed."),
|
|
367
|
+
bad_output: z.string().optional().describe("Optional undesired reply from the failure case."),
|
|
368
|
+
good_output: z.string().optional().describe("Optional corrected reply."),
|
|
369
|
+
when: z
|
|
370
|
+
.object({
|
|
371
|
+
positives: z.array(z.string()).optional(),
|
|
372
|
+
negatives: z.array(z.string()).optional(),
|
|
373
|
+
})
|
|
374
|
+
.optional(),
|
|
375
|
+
kind: z.enum(["auto", "policy", "guard", "skill"]).optional(),
|
|
376
|
+
delivery: z.enum(["auto", "episodic", "guard", "weight"]).optional(),
|
|
377
|
+
rollout: z.enum(["active", "canary", "staging"]).optional(),
|
|
378
|
+
canary_pct: z.number().int().min(0).max(100).optional(),
|
|
379
|
+
tags: z.array(z.string()).optional(),
|
|
380
|
+
upstream: z
|
|
381
|
+
.object({
|
|
382
|
+
provider: z.enum(["openai", "anthropic", "gemini"]),
|
|
383
|
+
model: z.string().min(1),
|
|
384
|
+
})
|
|
385
|
+
.optional(),
|
|
386
|
+
},
|
|
387
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
|
|
388
|
+
}, async ({ model, correction, trace_id, bad_output, good_output, when, kind, delivery, rollout, canary_pct, tags, upstream }) => {
|
|
389
|
+
if (!correction?.trim() && !trace_id?.trim() && !good_output?.trim()) {
|
|
390
|
+
return errorToolResult("Provide at least one of `correction`, `trace_id`, or `good_output`.");
|
|
391
|
+
}
|
|
392
|
+
try {
|
|
393
|
+
const body = {};
|
|
394
|
+
if (correction?.trim())
|
|
395
|
+
body.correction = correction.trim();
|
|
396
|
+
if (trace_id?.trim())
|
|
397
|
+
body.trace_id = trace_id.trim();
|
|
398
|
+
if (bad_output?.trim())
|
|
399
|
+
body.bad_output = bad_output.trim();
|
|
400
|
+
if (good_output?.trim())
|
|
401
|
+
body.good_output = good_output.trim();
|
|
402
|
+
if (when)
|
|
403
|
+
body.when = when;
|
|
404
|
+
if (kind)
|
|
405
|
+
body.kind = kind;
|
|
406
|
+
if (delivery)
|
|
407
|
+
body.delivery = delivery;
|
|
408
|
+
if (rollout)
|
|
409
|
+
body.rollout = rollout;
|
|
410
|
+
if (canary_pct !== undefined)
|
|
411
|
+
body.canary_pct = canary_pct;
|
|
412
|
+
if (tags?.length)
|
|
413
|
+
body.tags = tags;
|
|
414
|
+
if (upstream)
|
|
415
|
+
body.upstream = upstream;
|
|
416
|
+
const res = await apiRequest("POST", `/models/${encodeURIComponent(model.trim())}/teach`, body);
|
|
417
|
+
return jsonToolResult(res, `Taught lesson ${res.id ?? "unknown"} on model '${model.trim()}' (v${res.version ?? "?"}, delivery=${res.delivery_mode ?? "episodic"}).`);
|
|
418
|
+
}
|
|
419
|
+
catch (err) {
|
|
420
|
+
return errorToolResult(err instanceof Error ? err.message : "Failed to teach lesson.");
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
server.registerTool("lodestar_list_lessons", {
|
|
424
|
+
title: "List Continual Learning Lessons",
|
|
425
|
+
description: "List learned lessons, versions, trigger counts, delivery modes (guard/episodic/hybrid/weight), and consolidation status for a continual model or across all workspace continual models.",
|
|
426
|
+
inputSchema: {
|
|
427
|
+
model: z.string().optional().describe("Optional continual model slug. Omit to list across all continual models."),
|
|
428
|
+
status: z.enum(["active", "canary", "paused", "staging", "reverted", "superseded"]).optional(),
|
|
429
|
+
limit: z.number().int().min(1).max(200).optional(),
|
|
430
|
+
},
|
|
431
|
+
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
432
|
+
}, async ({ model, status, limit }) => {
|
|
433
|
+
try {
|
|
434
|
+
const cap = limit ?? 50;
|
|
435
|
+
const qs = new URLSearchParams({ limit: String(cap) });
|
|
436
|
+
if (status)
|
|
437
|
+
qs.set("status", status);
|
|
438
|
+
if (model?.trim()) {
|
|
439
|
+
const res = await apiRequest("GET", `/models/${encodeURIComponent(model.trim())}/lessons?${qs.toString()}`);
|
|
440
|
+
const rows = Array.isArray(res.data) ? res.data : [];
|
|
441
|
+
return jsonToolResult(res, `Model '${model.trim()}' (v${res.version ?? 0}) has ${rows.length} matching lesson(s).`);
|
|
442
|
+
}
|
|
443
|
+
const modelsRes = await apiRequest("GET", "/models");
|
|
444
|
+
const continualModels = (modelsRes.data ?? []).filter((m) => Boolean(m.continual));
|
|
445
|
+
const allLessons = [];
|
|
446
|
+
for (const cm of continualModels) {
|
|
447
|
+
const slug = String(cm.id ?? "");
|
|
448
|
+
if (!slug)
|
|
449
|
+
continue;
|
|
450
|
+
const lr = await apiRequest("GET", `/models/${encodeURIComponent(slug)}/lessons?${qs.toString()}`);
|
|
451
|
+
for (const item of lr.data ?? []) {
|
|
452
|
+
allLessons.push(item);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
return jsonToolResult({
|
|
456
|
+
models: continualModels,
|
|
457
|
+
lessons: allLessons.slice(0, cap),
|
|
458
|
+
total_models: continualModels.length,
|
|
459
|
+
total_lessons: allLessons.length,
|
|
460
|
+
}, `Found ${continualModels.length} continual model(s) and ${allLessons.length} matching lesson(s).`);
|
|
461
|
+
}
|
|
462
|
+
catch (err) {
|
|
463
|
+
return errorToolResult(err instanceof Error ? err.message : "Failed to list lessons.");
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
server.registerTool("lodestar_revert_lesson", {
|
|
467
|
+
title: "Revert a Continual Learning Lesson",
|
|
468
|
+
description: "Instantly roll back a continual model by reverting a specific lesson_id or rolling back to an earlier integer version (to_version).",
|
|
469
|
+
inputSchema: {
|
|
470
|
+
model: z.string().min(1).describe("Continual model slug (e.g. 'acme-agent')."),
|
|
471
|
+
lesson_id: z.string().optional().describe("Specific lesson ID (les_...) to revert."),
|
|
472
|
+
to_version: z.number().int().min(0).optional().describe("Roll back all lessons added after this version."),
|
|
473
|
+
},
|
|
474
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
|
|
475
|
+
}, async ({ model, lesson_id, to_version }) => {
|
|
476
|
+
if (!lesson_id?.trim() && to_version === undefined) {
|
|
477
|
+
return errorToolResult("Provide either `lesson_id` or `to_version` to revert.");
|
|
478
|
+
}
|
|
479
|
+
try {
|
|
480
|
+
const body = {};
|
|
481
|
+
if (lesson_id?.trim())
|
|
482
|
+
body.lesson_id = lesson_id.trim();
|
|
483
|
+
if (to_version !== undefined)
|
|
484
|
+
body.to_version = to_version;
|
|
485
|
+
const res = await apiRequest("POST", `/models/${encodeURIComponent(model.trim())}/revert`, body);
|
|
486
|
+
const reverted = Array.isArray(res.reverted_lesson_ids) ? res.reverted_lesson_ids : [];
|
|
487
|
+
const restored = Array.isArray(res.restored_lesson_ids) ? res.restored_lesson_ids : [];
|
|
488
|
+
return jsonToolResult(res, `Reverted ${reverted.length} lesson(s) and restored ${restored.length} lesson(s) on '${model.trim()}' (now v${res.version ?? "?"}).`);
|
|
489
|
+
}
|
|
490
|
+
catch (err) {
|
|
491
|
+
return errorToolResult(err instanceof Error ? err.message : "Failed to revert lesson.");
|
|
492
|
+
}
|
|
493
|
+
});
|
|
360
494
|
server.registerResource("quickstart-docs", "lodestar://docs/quickstart", {
|
|
361
495
|
title: "Lodestar Quickstart",
|
|
362
496
|
description: "Quickstart reference for Lodestar Glass-Box Inference, guards, patches, and SDKs.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lodestar-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Official Lodestar MCP server & one-command setup CLI for Claude Code, Claude Desktop, OpenAI Codex CLI, and Gemini CLI",
|
|
5
5
|
"homepage": "https://lodestar.so/docs#mcp-server",
|
|
6
6
|
"repository": {
|