@centrali-io/centrali-mcp 9.5.1 → 9.6.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.
@@ -294,7 +294,7 @@ export function registerDescribeTools(server: McpServer) {
294
294
  "Function runs (execution history)": { sdk: true, mcp: true, console: true },
295
295
  "Outbound webhooks": { sdk: true, mcp: true, console: true, note: "SDK namespace (client.webhookSubscriptions) and MCP tools wrap the REST surface including delivery replay" },
296
296
  "Service accounts & IAM": { sdk: false, mcp: true, console: true, note: "MCP tools for full SA lifecycle, roles, groups, and permission introspection" },
297
- "File uploads": { sdk: true, mcp: false, console: true, note: "REST, SDK client.uploadFile(), and console; no MCP upload tool" },
297
+ "File uploads": { sdk: true, mcp: true, console: true, note: "upload_file accepts up to 256 KiB decoded and 768 KiB serialized content; public uploads require a passive MIME type. Larger files use client.uploadFile()." },
298
298
  },
299
299
  },
300
300
  sdk_integration: {
@@ -311,7 +311,7 @@ export function registerDescribeTools(server: McpServer) {
311
311
  note: "workspaceId is the workspace slug (e.g., 'acme'), not a UUID. See https://docs.centrali.io/guides/centrali-sdk for the full guide.",
312
312
  },
313
313
  file_storage: {
314
- description: "Centrali has built-in file storage (Azure Blob). Use the SDK to upload files and get render/download URLs. Not available via MCP — use in app code.",
314
+ description: "Centrali has built-in file storage (Azure Blob). Use upload_file via MCP for files up to 256 KiB decoded (base64 or utf8), or the SDK for larger uploads. MCP uploads return renderId and render/download URLs, default to private, and use existing workspace folder permissions. Record attachment is a separate update. Private URLs require normal authentication. The MCP tool cannot access host attachments or local paths directly.",
315
315
  folder_system: {
316
316
  description: "Files live in folders. Every workspace starts with system folders: /root, /root/shared, /root/users, /root/_data_directory. You MUST create a folder before uploading to it — uploading to a non-existent folder will fail.",
317
317
  system_folders: {
@@ -1975,13 +1975,13 @@ export function registerDescribeTools(server: McpServer) {
1975
1975
  },
1976
1976
  development: {
1977
1977
  description: "Dev tokens — short-lived tokens for testing without the OAuth2 flow.",
1978
- tool: "generate_dev_token(serviceAccountId, ttlSeconds)",
1978
+ tool: "generate_dev_token(clientId, ttlSeconds)",
1979
1979
  note: "Dev tokens have limited TTL. For production, always use client_credentials flow.",
1980
1980
  },
1981
1981
  },
1982
1982
  service_account_shape: {
1983
- id: "number — auto-generated numeric ID",
1984
- clientId: "string — format: ci_<hex> — used as the client_id in OAuth2",
1983
+ id: "number — internal database key; used by remediation and role-query contracts, not service-account paths",
1984
+ clientId: "string — opaque public identifier (new accounts: sa_<hex>; legacy IDs preserved); used in all service-account paths and as client_id for token requests",
1985
1985
  clientSecret: "string — format: sk_<hex> — ONLY returned on creation and rotation",
1986
1986
  name: "string — display name",
1987
1987
  description: "string | null — optional description",
@@ -0,0 +1,72 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { CentraliSDK } from "@centrali-io/centrali-sdk";
3
+ import { z } from "zod";
4
+ import { registerTool, formatError } from "./_register.js";
5
+
6
+ const MAX_FILE_BYTES = 256 * 1024;
7
+ const MAX_CONTENT_CHARS = 4 * Math.ceil(MAX_FILE_BYTES / 3);
8
+ const MAX_CONTENT_JSON_BYTES = 768 * 1024;
9
+ // Storage renders the supplied MIME type inline on the API origin.
10
+ // Keep active documents (HTML, SVG, XML, etc.) out of public MCP uploads.
11
+ const PUBLIC_CONTENT_TYPES = new Set([
12
+ "image/png", "image/jpeg", "image/gif", "image/webp",
13
+ "text/plain", "application/json",
14
+ "audio/mpeg", "audio/ogg", "audio/wav", "video/mp4", "video/webm",
15
+ ]);
16
+
17
+ const uploadSchema = z.object({
18
+ filename: z.string().min(1).max(255)
19
+ .refine(value => !/[\\/\x00-\x1f\x7f]/.test(value) && value !== "." && value !== "..",
20
+ "Use a filename without path separators or control characters"),
21
+ contentType: z.string().max(127)
22
+ .regex(/^[a-zA-Z0-9!#$&^_.+-]+\/[a-zA-Z0-9!#$&^_.+-]+$/, "Expected a MIME type such as image/png"),
23
+ contentEncoding: z.enum(["base64", "utf8"]),
24
+ content: z.string().max(MAX_CONTENT_CHARS)
25
+ .refine(value => Buffer.byteLength(JSON.stringify(value), "utf8") <= MAX_CONTENT_JSON_BYTES,
26
+ "Serialized content exceeds 768 KiB; use base64 for heavily escaped text")
27
+ .describe("Exact file content, including empty content. Maximum 256 KiB decoded and 768 KiB as a JSON string; use base64 for heavily escaped UTF-8 text."),
28
+ location: z.string().min(1).max(1024).optional()
29
+ .describe("Existing destination folder; defaults to /root/shared. Does not create folders."),
30
+ isPublic: z.boolean().default(false)
31
+ .describe("Explicitly opt into unauthenticated public access. Only PNG, JPEG, GIF, WebP, plain text, JSON, MPEG/OGG/WAV audio and MP4/WebM video are allowed publicly. Defaults to private."),
32
+ });
33
+
34
+ export function registerFileTools(server: McpServer, sdk: CentraliSDK) {
35
+ registerTool<z.infer<typeof uploadSchema>>(server,
36
+ "upload_file",
37
+ "Upload a standalone file or image into the authenticated workspace's Storage (maximum 256 KiB decoded). Supply exact bytes as canonical padded base64, or text as utf8; never reconstruct binary bytes from an image description. Requires files/create permission on the destination folder. Private by default. Returns renderId and render/download URLs; private URLs require normal authentication. Use renderId in a separate record update to attach the file. This tool cannot access host attachments, local paths, or source URLs. Repeating an upload can create another file; it is not idempotent.",
38
+ uploadSchema.shape,
39
+ async (args) => {
40
+ try {
41
+ const input = uploadSchema.parse(args);
42
+ if (input.isPublic && !PUBLIC_CONTENT_TYPES.has(input.contentType.toLowerCase())) {
43
+ throw new Error("Public uploads require a supported passive MIME type; HTML, SVG and other active documents must remain private");
44
+ }
45
+ const bytes = Buffer.from(input.content, input.contentEncoding === "base64" ? "base64" : "utf8");
46
+ if (bytes.length > MAX_FILE_BYTES) {
47
+ throw new Error("File exceeds the 256 KiB decoded upload limit");
48
+ }
49
+ if (input.contentEncoding === "base64" && bytes.toString("base64") !== input.content) {
50
+ throw new Error("content must be canonical padded base64");
51
+ }
52
+ const file = new File([new Uint8Array(bytes)], input.filename, { type: input.contentType });
53
+ const result = await sdk.uploadFile(file, input.location, input.isPublic);
54
+ const renderId = result.data;
55
+ return { content: [{ type: "text", text: JSON.stringify({
56
+ renderId,
57
+ sizeBytes: bytes.length,
58
+ contentType: input.contentType,
59
+ isPublic: input.isPublic,
60
+ renderUrl: sdk.getFileRenderUrl(renderId),
61
+ downloadUrl: sdk.getFileDownloadUrl(renderId),
62
+ }, null, 2) }] };
63
+ } catch (error: unknown) {
64
+ // Zod errors include rejected input values. Never echo file content.
65
+ const message = error instanceof z.ZodError
66
+ ? "Invalid upload_file arguments; check filename, MIME type, encoding and content size"
67
+ : formatError(error, "uploading file");
68
+ return { content: [{ type: "text", text: message }], isError: true };
69
+ }
70
+ }
71
+ );
72
+ }
@@ -7,6 +7,25 @@ type InsightStatus = "active" | "acknowledged" | "dismissed";
7
7
  type InsightSeverity = "info" | "warning" | "critical";
8
8
 
9
9
  export function registerInsightTools(server: McpServer, sdk: CentraliSDK) {
10
+ registerTool<{ triggerId?: string; period?: 7 | 30 }>(
11
+ server,
12
+ "get_trigger_health",
13
+ "Inspect HTTP request acceptance separately from execution success. Returns durable receivedCount, acceptedCount, rejectedCount, rejectionReasonBreakdown, requestAcceptanceRate (null without arrivals), and executionSuccessRate. Completed decisions are buffered and rolled up about every five minutes. Storage interruptions may lose or duplicate observations; rates are approximate. In-flight requests are not counted. Counts begin at tracking rollout; older traffic is unavailable. Omit triggerId for workspace health including unattributed requests to unknown paths. Non-HTTP triggers have execution health only.",
14
+ {
15
+ triggerId: z.string().uuid().optional().describe("Trigger UUID; omit to list workspace health"),
16
+ period: z.union([z.literal(7), z.literal(30)]).optional().describe("Days of health history, default 30"),
17
+ },
18
+ async ({ triggerId, period }) => {
19
+ try {
20
+ const result = triggerId
21
+ ? await sdk.triggers.healthTrend(triggerId, period)
22
+ : await sdk.triggers.health(period);
23
+ return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
24
+ } catch (error: unknown) {
25
+ return { content: [{ type: "text", text: formatError(error, "getting trigger health") }], isError: true };
26
+ }
27
+ },
28
+ );
10
29
  registerTool<{
11
30
  recordSlug?: string;
12
31
  status?: InsightStatus;
@@ -147,7 +147,7 @@ export function registerServiceAccountTools(
147
147
  description: me.description,
148
148
  revoked: me.revoked,
149
149
  workspace: workspaceId,
150
- _hint: "Use this 'id' (numeric) with scan_service_account_permissions, simulate_service_account_permission, and generate_remediation to check or fix your own permissions.",
150
+ _hint: "Use clientId with scan_service_account_permissions and simulate_service_account_permission. Use the numeric id as serviceAccountId with generate_remediation, preview_remediation, and apply_remediation.",
151
151
  }, null, 2),
152
152
  }],
153
153
  };
@@ -189,19 +189,19 @@ export function registerServiceAccountTools(
189
189
 
190
190
  registerTool<any>(server,
191
191
  "get_service_account",
192
- "Get details of a specific service account by its numeric ID. Returns name, clientId, description, and revocation status. Does NOT return the clientSecret (it's only shown once at creation time).",
192
+ "Get details of a specific service account by its clientId. Returns name, clientId, description, and revocation status. Does NOT return the clientSecret (it's only shown once at creation time).",
193
193
  {
194
- serviceAccountId: z.number().describe("The service account numeric ID"),
194
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
195
195
  },
196
- async ({ serviceAccountId }) => {
196
+ async ({ clientId }) => {
197
197
  try {
198
- const result = await getSaClient().get(`/${serviceAccountId}`);
198
+ const result = await getSaClient().get(`/${encodeURIComponent(clientId)}`);
199
199
  return {
200
200
  content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }],
201
201
  };
202
202
  } catch (error: unknown) {
203
203
  return {
204
- content: [{ type: "text", text: formatError(error, `getting service account '${serviceAccountId}'`) }],
204
+ content: [{ type: "text", text: formatError(error, `getting service account '${encodeURIComponent(clientId)}'`) }],
205
205
  isError: true,
206
206
  };
207
207
  }
@@ -246,18 +246,18 @@ export function registerServiceAccountTools(
246
246
  "update_service_account_name",
247
247
  "Update the display name of a service account.",
248
248
  {
249
- serviceAccountId: z.number().describe("The service account numeric ID"),
249
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
250
250
  name: z.string().describe("New display name"),
251
251
  },
252
- async ({ serviceAccountId, name }) => {
252
+ async ({ clientId, name }) => {
253
253
  try {
254
- const result = await getSaClient().put(`/${serviceAccountId}/name`, { name });
254
+ const result = await getSaClient().put(`/${encodeURIComponent(clientId)}/name`, { name });
255
255
  return {
256
256
  content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }],
257
257
  };
258
258
  } catch (error: unknown) {
259
259
  return {
260
- content: [{ type: "text", text: formatError(error, `updating service account '${serviceAccountId}' name`) }],
260
+ content: [{ type: "text", text: formatError(error, `updating service account '${encodeURIComponent(clientId)}' name`) }],
261
261
  isError: true,
262
262
  };
263
263
  }
@@ -268,18 +268,18 @@ export function registerServiceAccountTools(
268
268
  "update_service_account_description",
269
269
  "Update the description of a service account.",
270
270
  {
271
- serviceAccountId: z.number().describe("The service account numeric ID"),
271
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
272
272
  description: z.string().nullable().describe("New description (or null to clear)"),
273
273
  },
274
- async ({ serviceAccountId, description }) => {
274
+ async ({ clientId, description }) => {
275
275
  try {
276
- const result = await getSaClient().put(`/${serviceAccountId}/description`, { description });
276
+ const result = await getSaClient().put(`/${encodeURIComponent(clientId)}/description`, { description });
277
277
  return {
278
278
  content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }],
279
279
  };
280
280
  } catch (error: unknown) {
281
281
  return {
282
- content: [{ type: "text", text: formatError(error, `updating service account '${serviceAccountId}' description`) }],
282
+ content: [{ type: "text", text: formatError(error, `updating service account '${encodeURIComponent(clientId)}' description`) }],
283
283
  isError: true,
284
284
  };
285
285
  }
@@ -288,19 +288,19 @@ export function registerServiceAccountTools(
288
288
 
289
289
  registerTool<any>(server,
290
290
  "delete_service_account",
291
- "Permanently delete a service account. This is irreversible — all tokens are invalidated immediately. Note: the service account must not be revoked (revoke prevents deletion).",
291
+ "Permanently delete a service account by clientId, including an already-revoked account. This cannot be undone.",
292
292
  {
293
- clientId: z.string().describe("The service account's clientId string (e.g., 'ci_abc123') — NOT the numeric ID"),
293
+ clientId: z.string().describe("The service account's clientId string (e.g., 'sa_abc123') — NOT the numeric ID"),
294
294
  },
295
295
  async ({ clientId }) => {
296
296
  try {
297
- await getSaClient().delete(`/${clientId}`);
297
+ await getSaClient().delete(`/${encodeURIComponent(clientId)}`);
298
298
  return {
299
- content: [{ type: "text", text: `Service account '${clientId}' deleted successfully.` }],
299
+ content: [{ type: "text", text: `Service account '${encodeURIComponent(clientId)}' deleted successfully.` }],
300
300
  };
301
301
  } catch (error: unknown) {
302
302
  return {
303
- content: [{ type: "text", text: formatError(error, `deleting service account '${clientId}'`) }],
303
+ content: [{ type: "text", text: formatError(error, `deleting service account '${encodeURIComponent(clientId)}'`) }],
304
304
  isError: true,
305
305
  };
306
306
  }
@@ -313,11 +313,11 @@ export function registerServiceAccountTools(
313
313
  "rotate_service_account_secret",
314
314
  "Rotate the client secret of a service account. The old secret is immediately invalidated. Returns the new clientSecret — store it securely, it's only shown once.",
315
315
  {
316
- serviceAccountId: z.number().describe("The service account numeric ID"),
316
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
317
317
  },
318
- async ({ serviceAccountId }) => {
318
+ async ({ clientId }) => {
319
319
  try {
320
- const result = await getSaClient().post(`/${serviceAccountId}/rotate`);
320
+ const result = await getSaClient().post(`/${encodeURIComponent(clientId)}/rotate`);
321
321
  return {
322
322
  content: [{
323
323
  type: "text",
@@ -333,7 +333,7 @@ export function registerServiceAccountTools(
333
333
  };
334
334
  } catch (error: unknown) {
335
335
  return {
336
- content: [{ type: "text", text: formatError(error, `rotating secret for service account '${serviceAccountId}'`) }],
336
+ content: [{ type: "text", text: formatError(error, `rotating secret for service account '${encodeURIComponent(clientId)}'`) }],
337
337
  isError: true,
338
338
  };
339
339
  }
@@ -344,17 +344,17 @@ export function registerServiceAccountTools(
344
344
  "revoke_service_account",
345
345
  "Revoke a service account. All existing tokens are invalidated and no new tokens can be issued. This cannot be undone.",
346
346
  {
347
- serviceAccountId: z.number().describe("The service account numeric ID to revoke"),
347
+ clientId: z.string().describe("The service account clientId to revoke"),
348
348
  },
349
- async ({ serviceAccountId }) => {
349
+ async ({ clientId }) => {
350
350
  try {
351
- const result = await getSaClient().post(`/${serviceAccountId}/revoke`);
351
+ const result = await getSaClient().post(`/${encodeURIComponent(clientId)}/revoke`);
352
352
  return {
353
353
  content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }],
354
354
  };
355
355
  } catch (error: unknown) {
356
356
  return {
357
- content: [{ type: "text", text: formatError(error, `revoking service account '${serviceAccountId}'`) }],
357
+ content: [{ type: "text", text: formatError(error, `revoking service account '${encodeURIComponent(clientId)}'`) }],
358
358
  isError: true,
359
359
  };
360
360
  }
@@ -367,12 +367,12 @@ export function registerServiceAccountTools(
367
367
  "generate_dev_token",
368
368
  "Generate a short-lived development token for a service account. Useful for testing and local development without the full OAuth2 client_credentials flow. The token has limited TTL.",
369
369
  {
370
- serviceAccountId: z.number().describe("The service account numeric ID"),
370
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
371
371
  ttlSeconds: z.number().describe("Token time-to-live in seconds (valid options depend on server config, typically 3600, 86400, 604800)"),
372
372
  },
373
- async ({ serviceAccountId, ttlSeconds }) => {
373
+ async ({ clientId, ttlSeconds }) => {
374
374
  try {
375
- const result = await getSaClient().post(`/${serviceAccountId}/dev-token`, { ttlSeconds });
375
+ const result = await getSaClient().post(`/${encodeURIComponent(clientId)}/dev-token`, { ttlSeconds });
376
376
  return {
377
377
  content: [{
378
378
  type: "text",
@@ -388,7 +388,7 @@ export function registerServiceAccountTools(
388
388
  };
389
389
  } catch (error: unknown) {
390
390
  return {
391
- content: [{ type: "text", text: formatError(error, `generating dev token for service account '${serviceAccountId}'`) }],
391
+ content: [{ type: "text", text: formatError(error, `generating dev token for service account '${encodeURIComponent(clientId)}'`) }],
392
392
  isError: true,
393
393
  };
394
394
  }
@@ -401,22 +401,22 @@ export function registerServiceAccountTools(
401
401
  "scan_service_account_permissions",
402
402
  "Scan all permissions for a service account. Returns a full access matrix showing every resource and action with Allow/Deny decisions and reasons. Use this to audit what a service account can and cannot do.",
403
403
  {
404
- serviceAccountId: z.number().describe("The service account numeric ID"),
404
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
405
405
  filter: z.enum(["all", "allowed", "denied"]).optional().describe("Filter results: 'all' (default), 'allowed' (only granted), 'denied' (only missing)"),
406
406
  resourceCategory: z.string().optional().describe("Filter by resource category (e.g., 'workspace')"),
407
407
  },
408
- async ({ serviceAccountId, filter, resourceCategory }) => {
408
+ async ({ clientId, filter, resourceCategory }) => {
409
409
  try {
410
410
  const params: Record<string, any> = {};
411
411
  if (filter) params.filter = filter;
412
412
  if (resourceCategory) params.resourceCategory = resourceCategory;
413
- const result = await getSaClient().get(`/${serviceAccountId}/permissions/scan`, { params });
413
+ const result = await getSaClient().get(`/${encodeURIComponent(clientId)}/permissions/scan`, { params });
414
414
  return {
415
415
  content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }],
416
416
  };
417
417
  } catch (error: unknown) {
418
418
  return {
419
- content: [{ type: "text", text: formatError(error, `scanning permissions for service account '${serviceAccountId}'`) }],
419
+ content: [{ type: "text", text: formatError(error, `scanning permissions for service account '${encodeURIComponent(clientId)}'`) }],
420
420
  isError: true,
421
421
  };
422
422
  }
@@ -427,14 +427,14 @@ export function registerServiceAccountTools(
427
427
  "simulate_service_account_permission",
428
428
  "Simulate an authorization check for a service account against a specific resource and action. Returns the decision (Allow/Deny), evaluation trace, and suggestions for granting access if denied.",
429
429
  {
430
- serviceAccountId: z.number().describe("The service account numeric ID"),
430
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
431
431
  resource: z.string().describe("Resource identifier (e.g., 'workspace::records', 'workspace::compute-functions')"),
432
432
  resourceCategory: z.string().describe("Resource category (e.g., 'workspace')"),
433
433
  action: z.string().describe("Action to check (e.g., 'create', 'retrieve', 'update', 'delete', 'list', 'execute', 'manage')"),
434
434
  },
435
- async ({ serviceAccountId, resource, resourceCategory, action }) => {
435
+ async ({ clientId, resource, resourceCategory, action }) => {
436
436
  try {
437
- const result = await getSaClient().post(`/${serviceAccountId}/permissions/simulate`, {
437
+ const result = await getSaClient().post(`/${encodeURIComponent(clientId)}/permissions/simulate`, {
438
438
  resource,
439
439
  resourceCategory,
440
440
  action,
@@ -444,7 +444,7 @@ export function registerServiceAccountTools(
444
444
  };
445
445
  } catch (error: unknown) {
446
446
  return {
447
- content: [{ type: "text", text: formatError(error, `simulating permission for service account '${serviceAccountId}'`) }],
447
+ content: [{ type: "text", text: formatError(error, `simulating permission for service account '${encodeURIComponent(clientId)}'`) }],
448
448
  isError: true,
449
449
  };
450
450
  }
@@ -577,17 +577,17 @@ export function registerServiceAccountTools(
577
577
  "list_service_account_roles",
578
578
  "List all roles assigned to a service account.",
579
579
  {
580
- serviceAccountId: z.number().describe("The service account numeric ID"),
580
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
581
581
  },
582
- async ({ serviceAccountId }) => {
582
+ async ({ clientId }) => {
583
583
  try {
584
- const result = await getSaClient().get(`/${serviceAccountId}/roles`);
584
+ const result = await getSaClient().get(`/${encodeURIComponent(clientId)}/roles`);
585
585
  return {
586
586
  content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }],
587
587
  };
588
588
  } catch (error: unknown) {
589
589
  return {
590
- content: [{ type: "text", text: formatError(error, `listing roles for service account '${serviceAccountId}'`) }],
590
+ content: [{ type: "text", text: formatError(error, `listing roles for service account '${encodeURIComponent(clientId)}'`) }],
591
591
  isError: true,
592
592
  };
593
593
  }
@@ -598,18 +598,18 @@ export function registerServiceAccountTools(
598
598
  "assign_role_to_service_account",
599
599
  "Assign a role to a service account. The service account inherits all permissions defined in the role.",
600
600
  {
601
- serviceAccountId: z.number().describe("The service account numeric ID"),
601
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
602
602
  roleId: z.string().describe("The role ID (UUID) to assign"),
603
603
  },
604
- async ({ serviceAccountId, roleId }) => {
604
+ async ({ clientId, roleId }) => {
605
605
  try {
606
- const result = await getSaClient().post(`/${serviceAccountId}/roles/${roleId}`);
606
+ const result = await getSaClient().post(`/${encodeURIComponent(clientId)}/roles/${roleId}`);
607
607
  return {
608
608
  content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }],
609
609
  };
610
610
  } catch (error: unknown) {
611
611
  return {
612
- content: [{ type: "text", text: formatError(error, `assigning role '${roleId}' to service account '${serviceAccountId}'`) }],
612
+ content: [{ type: "text", text: formatError(error, `assigning role '${roleId}' to service account '${encodeURIComponent(clientId)}'`) }],
613
613
  isError: true,
614
614
  };
615
615
  }
@@ -620,18 +620,18 @@ export function registerServiceAccountTools(
620
620
  "remove_role_from_service_account",
621
621
  "Remove a role from a service account. The service account loses all permissions from this role.",
622
622
  {
623
- serviceAccountId: z.number().describe("The service account numeric ID"),
623
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
624
624
  roleId: z.string().describe("The role ID (UUID) to remove"),
625
625
  },
626
- async ({ serviceAccountId, roleId }) => {
626
+ async ({ clientId, roleId }) => {
627
627
  try {
628
- await getSaClient().delete(`/${serviceAccountId}/roles/${roleId}`);
628
+ await getSaClient().delete(`/${encodeURIComponent(clientId)}/roles/${roleId}`);
629
629
  return {
630
- content: [{ type: "text", text: `Role '${roleId}' removed from service account '${serviceAccountId}'.` }],
630
+ content: [{ type: "text", text: `Role '${roleId}' removed from service account '${encodeURIComponent(clientId)}'.` }],
631
631
  };
632
632
  } catch (error: unknown) {
633
633
  return {
634
- content: [{ type: "text", text: formatError(error, `removing role '${roleId}' from service account '${serviceAccountId}'`) }],
634
+ content: [{ type: "text", text: formatError(error, `removing role '${roleId}' from service account '${encodeURIComponent(clientId)}'`) }],
635
635
  isError: true,
636
636
  };
637
637
  }
@@ -644,17 +644,17 @@ export function registerServiceAccountTools(
644
644
  "list_service_account_groups",
645
645
  "List all groups a service account belongs to.",
646
646
  {
647
- serviceAccountId: z.number().describe("The service account numeric ID"),
647
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
648
648
  },
649
- async ({ serviceAccountId }) => {
649
+ async ({ clientId }) => {
650
650
  try {
651
- const result = await getSaClient().get(`/${serviceAccountId}/groups`);
651
+ const result = await getSaClient().get(`/${encodeURIComponent(clientId)}/groups`);
652
652
  return {
653
653
  content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }],
654
654
  };
655
655
  } catch (error: unknown) {
656
656
  return {
657
- content: [{ type: "text", text: formatError(error, `listing groups for service account '${serviceAccountId}'`) }],
657
+ content: [{ type: "text", text: formatError(error, `listing groups for service account '${encodeURIComponent(clientId)}'`) }],
658
658
  isError: true,
659
659
  };
660
660
  }
@@ -665,18 +665,18 @@ export function registerServiceAccountTools(
665
665
  "add_service_account_to_group",
666
666
  "Add a service account to a group. The service account inherits all roles assigned to the group.",
667
667
  {
668
- serviceAccountId: z.number().describe("The service account numeric ID"),
668
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
669
669
  groupId: z.string().describe("The group ID (UUID) to add the service account to"),
670
670
  },
671
- async ({ serviceAccountId, groupId }) => {
671
+ async ({ clientId, groupId }) => {
672
672
  try {
673
- const result = await getSaClient().post(`/${serviceAccountId}/groups/${groupId}`);
673
+ const result = await getSaClient().post(`/${encodeURIComponent(clientId)}/groups/${groupId}`);
674
674
  return {
675
675
  content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }],
676
676
  };
677
677
  } catch (error: unknown) {
678
678
  return {
679
- content: [{ type: "text", text: formatError(error, `adding service account '${serviceAccountId}' to group '${groupId}'`) }],
679
+ content: [{ type: "text", text: formatError(error, `adding service account '${encodeURIComponent(clientId)}' to group '${groupId}'`) }],
680
680
  isError: true,
681
681
  };
682
682
  }
@@ -687,18 +687,18 @@ export function registerServiceAccountTools(
687
687
  "remove_service_account_from_group",
688
688
  "Remove a service account from a group. The service account loses all permissions inherited through this group.",
689
689
  {
690
- serviceAccountId: z.number().describe("The service account numeric ID"),
690
+ clientId: z.string().describe("The service account clientId (not its numeric database id)"),
691
691
  groupId: z.string().describe("The group ID (UUID) to remove the service account from"),
692
692
  },
693
- async ({ serviceAccountId, groupId }) => {
693
+ async ({ clientId, groupId }) => {
694
694
  try {
695
- await getSaClient().delete(`/${serviceAccountId}/groups/${groupId}`);
695
+ await getSaClient().delete(`/${encodeURIComponent(clientId)}/groups/${groupId}`);
696
696
  return {
697
- content: [{ type: "text", text: `Service account '${serviceAccountId}' removed from group '${groupId}'.` }],
697
+ content: [{ type: "text", text: `Service account '${encodeURIComponent(clientId)}' removed from group '${groupId}'.` }],
698
698
  };
699
699
  } catch (error: unknown) {
700
700
  return {
701
- content: [{ type: "text", text: formatError(error, `removing service account '${serviceAccountId}' from group '${groupId}'`) }],
701
+ content: [{ type: "text", text: formatError(error, `removing service account '${encodeURIComponent(clientId)}' from group '${groupId}'`) }],
702
702
  isError: true,
703
703
  };
704
704
  }
@@ -12,8 +12,11 @@ test("master description distinguishes retired services, interface coverage and
12
12
  assert.match(features["Search"].note, /PostgreSQL/);
13
13
  assert.match(features["Search"].note, /Meilisearch.*retired/);
14
14
  assert.equal(features["File uploads"].console, true);
15
- assert.equal(features["File uploads"].mcp, false);
16
- assert.match(features["File uploads"].note, /REST/);
15
+ assert.equal(features["File uploads"].mcp, true);
16
+ assert.match(features["File uploads"].note, /upload_file/);
17
+ assert.match(features["File uploads"].note, /256 KiB decoded/);
18
+ assert.match(features["File uploads"].note, /768 KiB serialized/);
19
+ assert.match(features["File uploads"].note, /passive MIME type/);
17
20
  assert.match(features["Realtime subscriptions (SSE)"].note, /REST SSE/);
18
21
  assert.match(description.availability_notes.retired, /Pages.*retired/);
19
22
  assert.match(description.availability_notes.provider_presets, /do not provision/);