@2kw/ai-mcp-server 8.4.0-dev.2 → 8.4.0-dev.33
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/tools/agents.js +85 -5
- package/dist/tools/conversations.js +6 -2
- package/dist/tools/tracing.js +3 -2
- package/package.json +1 -1
package/dist/tools/agents.js
CHANGED
|
@@ -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
|
|
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 {
|
|
360
|
-
|
|
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
|
|
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"),
|
|
@@ -191,10 +191,14 @@ export function register(server, client) {
|
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
// ── list_conversation_items ──────────────────────────────────────────────
|
|
194
|
-
server.tool("2kw_list_conversation_items", "Fetch a conversation's items in replay order, oldest first. A connector's question to the user and the user's answer are listed without their text: the user reads and answers them in chat.", {
|
|
194
|
+
server.tool("2kw_list_conversation_items", "Fetch a conversation's items in replay order, oldest first, one page of responses at a time: while has_more is true, call again with after set to the response_id of the last item that has one (a batch summary entry has none). A connector's question to the user and the user's answer are listed without their text: the user reads and answers them in chat.", {
|
|
195
|
+
conversationId: z.string().describe("The conversation ID"),
|
|
196
|
+
after: z.string().optional().describe("The response_id of the last item already listed; omit for the first page"),
|
|
197
|
+
limit: z.number().int().min(1).max(100).optional().describe("Most responses per page (default 20)"),
|
|
198
|
+
}, async ({ conversationId, after, limit }) => {
|
|
195
199
|
try {
|
|
196
200
|
const { data } = await client.GET("/v1/conversations/{conversationId}/items", {
|
|
197
|
-
params: { path: { conversationId } },
|
|
201
|
+
params: { path: { conversationId }, query: { after, limit } },
|
|
198
202
|
});
|
|
199
203
|
return {
|
|
200
204
|
content: [{ type: "text", text: JSON.stringify(withoutInputContent(data), null, 2) }],
|
package/dist/tools/tracing.js
CHANGED
|
@@ -103,7 +103,8 @@ export function register(server, client) {
|
|
|
103
103
|
content: [
|
|
104
104
|
{
|
|
105
105
|
type: "text",
|
|
106
|
-
|
|
106
|
+
// The list counts nothing (#1923): totalPages only says whether a next page exists.
|
|
107
|
+
text: `Traces (page ${(result.number ?? 0) + 1}${(result.number ?? 0) + 1 < (result.totalPages ?? 1) ? ", more on the next page" : ""}):\n${lines.join("\n") || "(none)"}`,
|
|
107
108
|
},
|
|
108
109
|
],
|
|
109
110
|
};
|
|
@@ -171,7 +172,7 @@ export function register(server, client) {
|
|
|
171
172
|
content: [
|
|
172
173
|
{
|
|
173
174
|
type: "text",
|
|
174
|
-
text: `Sessions (${result.
|
|
175
|
+
text: `Sessions (page ${(result.number ?? 0) + 1}${(result.number ?? 0) + 1 < (result.totalPages ?? 1) ? ", more on the next page" : ""}):\n${lines.join("\n") || "(none)"}`,
|
|
175
176
|
},
|
|
176
177
|
],
|
|
177
178
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2kw/ai-mcp-server",
|
|
3
|
-
"version": "8.4.0-dev.
|
|
3
|
+
"version": "8.4.0-dev.33",
|
|
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": [
|