@2kw/ai-mcp-server 7.1.0-dev.9 → 7.1.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/lib/agent-publish.d.ts +11 -0
- package/dist/lib/agent-publish.js +20 -0
- package/dist/tools/agents.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ApiClient } from "../client.js";
|
|
2
|
+
import type { components } from "../generated/openapi.js";
|
|
3
|
+
/**
|
|
4
|
+
* A just-created agent, published. A backend that publishes version 1 on create (#668) answers with
|
|
5
|
+
* `latestVersionId`: nothing more to do. An older backend leaves the agent unpublished, so post the
|
|
6
|
+
* configuration as its first version, as before. One path, correct against either backend, so neither
|
|
7
|
+
* deploy order nor a backend rollback leaves a new agent unrunnable. Mirrors the CLI's helper; the two
|
|
8
|
+
* packages share no runtime code.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ensurePublished(client: ApiClient, created: components["schemas"]["AgentDTO"] | undefined, versionBody: Record<string, unknown>): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=agent-publish.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A just-created agent, published. A backend that publishes version 1 on create (#668) answers with
|
|
3
|
+
* `latestVersionId`: nothing more to do. An older backend leaves the agent unpublished, so post the
|
|
4
|
+
* configuration as its first version, as before. One path, correct against either backend, so neither
|
|
5
|
+
* deploy order nor a backend rollback leaves a new agent unrunnable. Mirrors the CLI's helper; the two
|
|
6
|
+
* packages share no runtime code.
|
|
7
|
+
*/
|
|
8
|
+
export async function ensurePublished(client, created, versionBody) {
|
|
9
|
+
if (!created?.id || created.latestVersionId)
|
|
10
|
+
return;
|
|
11
|
+
const { data: version } = await client.POST("/v1/agents/{agentId}/versions", {
|
|
12
|
+
params: { path: { agentId: String(created.id) } },
|
|
13
|
+
body: versionBody,
|
|
14
|
+
});
|
|
15
|
+
// Report the head the fallback just published, not the pre-publish create response.
|
|
16
|
+
if (version?.id) {
|
|
17
|
+
Object.assign(created, { latestVersionId: version.id, latestVersionNumber: version.versionNumber });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=agent-publish.js.map
|
package/dist/tools/agents.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { formatErrorForMcp } from "../errors.js";
|
|
3
3
|
import { checkToolOutputs, continueWithDecisions, decideErrorText, fetchPendingApprovals, planContinuation, resolveAgentId, splitAgentRef, } from "../lib/agent-decide.js";
|
|
4
4
|
import { buildRunEnvelope, chatUrlFor, MODE_RULE } from "../lib/agent-run.js";
|
|
5
|
+
import { ensurePublished } from "../lib/agent-publish.js";
|
|
5
6
|
import { assertNameNotBlank } from "../lib/overlay.js";
|
|
6
7
|
const modelSchema = z
|
|
7
8
|
.string()
|
|
@@ -120,7 +121,7 @@ export function register(server, client) {
|
|
|
120
121
|
}
|
|
121
122
|
});
|
|
122
123
|
// ── create_agent ────────────────────────────────────────────────────────
|
|
123
|
-
server.tool("2kw_create_agent", "Create a new agent for the organization. Give its model as `model` (one model) or `models` (an ordered list whose first entry is the default); one of the two is required.", {
|
|
124
|
+
server.tool("2kw_create_agent", "Create a new agent for the organization. It is published as version 1 and runnable at once. Give its model as `model` (one model) or `models` (an ordered list whose first entry is the default); one of the two is required.", {
|
|
124
125
|
name: z.string().min(1).describe("Agent name"),
|
|
125
126
|
model: modelSchema.optional(),
|
|
126
127
|
models: modelsSchema.optional(),
|
|
@@ -148,6 +149,9 @@ export function register(server, client) {
|
|
|
148
149
|
const { data } = await client.POST("/v1/agents", {
|
|
149
150
|
body: body,
|
|
150
151
|
});
|
|
152
|
+
// Create publishes version 1; an older backend does not, so publish then (#668).
|
|
153
|
+
const { name: _name, description: _description, ...configuration } = body;
|
|
154
|
+
await ensurePublished(client, data, { ...configuration, changeDescription: "Initial version" });
|
|
151
155
|
return {
|
|
152
156
|
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
153
157
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2kw/ai-mcp-server",
|
|
3
|
-
"version": "7.1.0
|
|
3
|
+
"version": "7.1.0",
|
|
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": [
|