@2kw/ai-mcp-server 8.3.0-dev.4 → 8.3.0-dev.8

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.
@@ -134,7 +134,15 @@ export function register(server, client) {
134
134
  tools: z.unknown().optional().describe("Tool configuration (JSON object)"),
135
135
  skills: z.unknown().optional().describe("Skill configuration (JSON object)"),
136
136
  hitlPolicy: z.unknown().optional().describe("Human-in-the-loop approval policy (JSON object)"),
137
- }, async ({ name, model, models, description, instructions, options, tools, skills, hitlPolicy }) => {
137
+ visibility: z
138
+ .enum(["organization", "restricted"])
139
+ .optional()
140
+ .describe("Who may use the agent: `organization` (default) for every member, `restricted` for members of `teamIds` only. A member may restrict an agent only to teams they belong to"),
141
+ teamIds: z
142
+ .array(z.string().min(1))
143
+ .optional()
144
+ .describe("The teams a restricted agent is open to; omit for `organization`"),
145
+ }, async ({ name, model, models, description, instructions, options, tools, skills, hitlPolicy, visibility, teamIds }) => {
138
146
  try {
139
147
  const body = { name, ...modelFields(model, models, true) };
140
148
  if (description !== undefined)
@@ -149,11 +157,15 @@ export function register(server, client) {
149
157
  body.skills = skills;
150
158
  if (hitlPolicy !== undefined)
151
159
  body.hitlPolicy = hitlPolicy;
160
+ if (visibility !== undefined)
161
+ body.visibility = visibility;
162
+ if (teamIds !== undefined)
163
+ body.teamIds = teamIds;
152
164
  const { data } = await client.POST("/v1/agents", {
153
165
  body: body,
154
166
  });
155
- // Create publishes version 1; an older backend does not, so publish then (#668).
156
- const { name: _name, description: _description, ...configuration } = body;
167
+ // Create publishes version 1; an older backend does not, so publish then (#668). Access is not version config.
168
+ const { name: _name, description: _description, visibility: _visibility, teamIds: _teamIds, ...configuration } = body;
157
169
  await ensurePublished(client, data, { ...configuration, changeDescription: "Initial version" });
158
170
  return {
159
171
  content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
@@ -240,6 +252,35 @@ export function register(server, client) {
240
252
  };
241
253
  }
242
254
  });
255
+ // ── get_agent_access / set_agent_access ─────────────────────────────────
256
+ server.tool("2kw_get_agent_access", "Show who may use an agent: everyone in the organization (`organization`), or only members of the listed teams (`restricted`). Administrators and owners reach every agent.", { agentId: z.string().describe("The agent ID") }, async ({ agentId }) => {
257
+ try {
258
+ const { data } = await client.GET("/v1/agents/{id}/access", { params: { path: { id: agentId } } });
259
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
260
+ }
261
+ catch (error) {
262
+ return { content: [{ type: "text", text: formatErrorForMcp(error) }], isError: true };
263
+ }
264
+ });
265
+ server.tool("2kw_set_agent_access", "Replace who may use an agent. `organization` opens it to every member and takes no teams; `restricted` limits it to members of `teamIds` (with no team: administrators and owners only). Administrators and owners only. The organization's default agent cannot be restricted.", {
266
+ agentId: z.string().describe("The agent ID"),
267
+ visibility: z.enum(["organization", "restricted"]).describe("Who may use the agent"),
268
+ teamIds: z
269
+ .array(z.string().min(1))
270
+ .optional()
271
+ .describe("The teams a restricted agent is open to; omit for `organization`"),
272
+ }, async ({ agentId, visibility, teamIds }) => {
273
+ try {
274
+ const { data } = await client.PUT("/v1/agents/{id}/access", {
275
+ params: { path: { id: agentId } },
276
+ body: { visibility, teamIds: teamIds ?? [] },
277
+ });
278
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
279
+ }
280
+ catch (error) {
281
+ return { content: [{ type: "text", text: formatErrorForMcp(error) }], isError: true };
282
+ }
283
+ });
243
284
  // ── list_agent_versions ─────────────────────────────────────────────────
244
285
  server.tool("2kw_list_agent_versions", "List version history for an agent, with pagination.", {
245
286
  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.3.0-dev.4",
3
+ "version": "8.3.0-dev.8",
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": [