@2kw/ai-mcp-server 8.4.0-dev.16 → 8.4.0-dev.25

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.
@@ -354,11 +354,19 @@ export function register(server, client) {
354
354
  }
355
355
  });
356
356
  // ── get_latest_agent_version ────────────────────────────────────────────
357
- server.tool("2kw_get_latest_agent_version", "Retrieve the most recent version of an agent.", { agentId: z.string().describe("The agent ID") }, async ({ agentId }) => {
357
+ server.tool("2kw_get_latest_agent_version", "Retrieve the most recent version of an agent, or with label 'live' the version users get (its Live version).", {
358
+ agentId: z.string().describe("The agent ID"),
359
+ label: z
360
+ .enum(["latest", "live"])
361
+ .optional()
362
+ .default("latest")
363
+ .describe("latest (default): the newest saved version. live: the version users get."),
364
+ }, async ({ agentId, label }) => {
358
365
  try {
359
- const { data } = await client.GET("/v1/agents/{agentId}/versions/latest", {
360
- params: { path: { agentId } },
361
- });
366
+ const params = { params: { path: { agentId } } };
367
+ const { data } = label === "live"
368
+ ? await client.GET("/v1/agents/{agentId}/versions/live", params)
369
+ : await client.GET("/v1/agents/{agentId}/versions/latest", params);
362
370
  return {
363
371
  content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
364
372
  };
@@ -371,7 +379,7 @@ export function register(server, client) {
371
379
  }
372
380
  });
373
381
  // ── list_agent_skills ───────────────────────────────────────────────────
374
- server.tool("2kw_list_agent_skills", "List the skills an agent's latest published version binds, in authored order. This is the "
382
+ server.tool("2kw_list_agent_skills", "List the skills the version of an agent that users get (its Live version) binds, in authored order. This is the "
375
383
  + "read a chat-only USER key may perform; 2kw_get_latest_agent_version carries the full version "
376
384
  + "and needs MEMBER or above. An agent with no published version lists none.", { agentId: z.string().describe("The agent ID") }, async ({ agentId }) => {
377
385
  try {
@@ -575,6 +583,78 @@ export function register(server, client) {
575
583
  };
576
584
  }
577
585
  });
586
+ // ── Live (#1825) ────────────────────────────────────────────────────────
587
+ // Both writes send the Live version and mode just read as expectedVersionId/expectedLiveMode, so a
588
+ // Live someone else moved in between answers 409 instead of being overwritten.
589
+ const putLive = async (agentId, body) => {
590
+ const { data: agent } = await client.GET("/v1/agents/{id}", { params: { path: { id: agentId } } });
591
+ const fields = { ...body, expectedVersionId: agent?.liveVersionId, expectedLiveMode: agent?.liveMode };
592
+ const { data } = await client.PUT("/v1/agents/{agentId}/labels/{labelName}", {
593
+ params: { path: { agentId, labelName: "live" } },
594
+ // Null Live fields (Live not enabled yet) are left out; the server says why.
595
+ body: Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined && value !== null)),
596
+ });
597
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
598
+ };
599
+ server.tool("2kw_go_live_agent", "Put an agent version live: users get that version, and Live stays pinned on it until it is changed "
600
+ + "again. Naming an older version is a roll back. Needs an ADMIN or OWNER key. Answers an error if "
601
+ + "someone else changed Live meanwhile, if the version is deactivated, or while Live is not enabled.", {
602
+ agentId: z.string().describe("The agent ID"),
603
+ agentVersionId: z.string().describe("The version id to put live (see 2kw_list_agent_versions)"),
604
+ note: z.string().max(1000).optional().describe("Why, shown in the Live history"),
605
+ }, async ({ agentId, agentVersionId, note }) => {
606
+ try {
607
+ return await putLive(agentId, { agentVersionId, note });
608
+ }
609
+ catch (error) {
610
+ return {
611
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
612
+ isError: true,
613
+ };
614
+ }
615
+ });
616
+ server.tool("2kw_follow_latest_agent", "Let an agent's Live version move with every saved version again, so users always get the newest one. "
617
+ + "Needs an ADMIN or OWNER key.", {
618
+ agentId: z.string().describe("The agent ID"),
619
+ note: z.string().max(1000).optional().describe("Why, shown in the Live history"),
620
+ }, async ({ agentId, note }) => {
621
+ try {
622
+ return await putLive(agentId, { liveMode: "follows_latest", note });
623
+ }
624
+ catch (error) {
625
+ return {
626
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
627
+ isError: true,
628
+ };
629
+ }
630
+ });
631
+ server.tool("2kw_agent_live_history", "List who put which version of an agent live, rolled it back or let it follow latest again, newest first.", {
632
+ agentId: z.string().describe("The agent ID"),
633
+ page: z.number().optional().default(0).describe("Page number (0-based)"),
634
+ size: z.number().optional().default(20).describe("Page size"),
635
+ }, async ({ agentId, page, size }) => {
636
+ try {
637
+ const { data } = await client.GET("/v1/agents/{agentId}/labels/live/history", {
638
+ params: { path: { agentId }, query: { pageable: { page, size } } },
639
+ });
640
+ const result = data;
641
+ const lines = (result.content ?? []).map((e) => `- ${e.at} ${e.kind}: ${e.fromVersionNumber != null ? `v${e.fromVersionNumber}` : "none"} → v${e.toVersionNumber} (${e.liveMode}) by ${e.actorKind}${e.note ? ` — ${e.note}` : ""}`);
642
+ return {
643
+ content: [
644
+ {
645
+ type: "text",
646
+ text: `Live history (${result.totalElements} total, page ${(result.number ?? 0) + 1}/${result.totalPages}):\n${lines.join("\n") || "(none)"}`,
647
+ },
648
+ ],
649
+ };
650
+ }
651
+ catch (error) {
652
+ return {
653
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
654
+ isError: true,
655
+ };
656
+ }
657
+ });
578
658
  // ── list_agent_approvals ────────────────────────────────────────────────
579
659
  server.tool("2kw_list_agent_approvals", "List human-in-the-loop tool approvals raised by an agent, newest first. Filter with status=pending|approved|rejected|cancelled. A surface principal sees only their own.", {
580
660
  agentId: z.string().describe("The agent ID"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2kw/ai-mcp-server",
3
- "version": "8.4.0-dev.16",
3
+ "version": "8.4.0-dev.25",
4
4
  "description": "MCP server for 2kw.ai — EU-hosted AI platform: OpenAI-compatible LLM gateway, schema-driven document extraction, transcription, agents with a knowledge base, and cost observability. 199 tools for Claude Code, Cursor, and Windsurf.",
5
5
  "mcpName": "ai.2kw/mcp-server",
6
6
  "keywords": [