@avallon-labs/mcp 52.7.0 → 52.8.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/index.js CHANGED
@@ -46,5 +46,5 @@ function setupFetch() {
46
46
 
47
47
  // src/index.ts
48
48
  setupFetch();
49
- await import("./server-YOC5SGIR.js");
49
+ await import("./server-5KHVVGKL.js");
50
50
  //# sourceMappingURL=index.js.map
@@ -1837,6 +1837,59 @@ var updateWorkerMcps = async (workerId, updateWorkerMcpsBody, options) => {
1837
1837
  const data = body ? JSON.parse(body) : {};
1838
1838
  return { data, status: res.status, headers: res.headers };
1839
1839
  };
1840
+ var getGetAccessUrl = (entityType, entityId) => {
1841
+ return `/v1/access/${entityType}/${entityId}`;
1842
+ };
1843
+ var getAccess = async (entityType, entityId, options) => {
1844
+ const res = await fetch(
1845
+ getGetAccessUrl(entityType, entityId),
1846
+ {
1847
+ ...options,
1848
+ method: "GET"
1849
+ }
1850
+ );
1851
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1852
+ const data = body ? JSON.parse(body) : {};
1853
+ return { data, status: res.status, headers: res.headers };
1854
+ };
1855
+ var getUpdateAccessUrl = (entityType, entityId) => {
1856
+ return `/v1/access/${entityType}/${entityId}`;
1857
+ };
1858
+ var updateAccess = async (entityType, entityId, updateAccessBody, options) => {
1859
+ const getHeaders = (h) => {
1860
+ if (!h) return {};
1861
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1862
+ if (Array.isArray(h)) return Object.fromEntries(h);
1863
+ return h;
1864
+ };
1865
+ const res = await fetch(
1866
+ getUpdateAccessUrl(entityType, entityId),
1867
+ {
1868
+ ...options,
1869
+ method: "PUT",
1870
+ headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
1871
+ body: JSON.stringify(updateAccessBody)
1872
+ }
1873
+ );
1874
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1875
+ const data = body ? JSON.parse(body) : {};
1876
+ return { data, status: res.status, headers: res.headers };
1877
+ };
1878
+ var getGetMyAccessUrl = (entityType, entityId) => {
1879
+ return `/v1/access/${entityType}/${entityId}/me`;
1880
+ };
1881
+ var getMyAccess = async (entityType, entityId, options) => {
1882
+ const res = await fetch(
1883
+ getGetMyAccessUrl(entityType, entityId),
1884
+ {
1885
+ ...options,
1886
+ method: "GET"
1887
+ }
1888
+ );
1889
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1890
+ const data = body ? JSON.parse(body) : {};
1891
+ return { data, status: res.status, headers: res.headers };
1892
+ };
1840
1893
  var getListWorkerVersionsUrl = (workerId, params) => {
1841
1894
  const normalizedParams = new URLSearchParams();
1842
1895
  Object.entries(params || {}).forEach(([key, value]) => {
@@ -5578,6 +5631,75 @@ var updateWorkerMcpsHandler = async (args, options) => {
5578
5631
  structuredContent: res.data
5579
5632
  };
5580
5633
  };
5634
+ var getAccessHandler = async (args, options) => {
5635
+ const res = await getAccess(args.pathParams.entityType, args.pathParams.entityId, options);
5636
+ if (res.status >= 400) {
5637
+ return {
5638
+ content: [
5639
+ {
5640
+ type: "text",
5641
+ text: JSON.stringify(res.data ?? null)
5642
+ }
5643
+ ],
5644
+ isError: true
5645
+ };
5646
+ }
5647
+ return {
5648
+ content: [
5649
+ {
5650
+ type: "text",
5651
+ text: JSON.stringify(res.data ?? null)
5652
+ }
5653
+ ],
5654
+ structuredContent: res.data
5655
+ };
5656
+ };
5657
+ var updateAccessHandler = async (args, options) => {
5658
+ const res = await updateAccess(args.pathParams.entityType, args.pathParams.entityId, args.bodyParams, options);
5659
+ if (res.status >= 400) {
5660
+ return {
5661
+ content: [
5662
+ {
5663
+ type: "text",
5664
+ text: JSON.stringify(res.data ?? null)
5665
+ }
5666
+ ],
5667
+ isError: true
5668
+ };
5669
+ }
5670
+ return {
5671
+ content: [
5672
+ {
5673
+ type: "text",
5674
+ text: JSON.stringify(res.data ?? null)
5675
+ }
5676
+ ],
5677
+ structuredContent: res.data
5678
+ };
5679
+ };
5680
+ var getMyAccessHandler = async (args, options) => {
5681
+ const res = await getMyAccess(args.pathParams.entityType, args.pathParams.entityId, options);
5682
+ if (res.status >= 400) {
5683
+ return {
5684
+ content: [
5685
+ {
5686
+ type: "text",
5687
+ text: JSON.stringify(res.data ?? null)
5688
+ }
5689
+ ],
5690
+ isError: true
5691
+ };
5692
+ }
5693
+ return {
5694
+ content: [
5695
+ {
5696
+ type: "text",
5697
+ text: JSON.stringify(res.data ?? null)
5698
+ }
5699
+ ],
5700
+ structuredContent: res.data
5701
+ };
5702
+ };
5581
5703
  var listWorkerVersionsHandler = async (args, options) => {
5582
5704
  const res = await listWorkerVersions(args.pathParams.workerId, args.queryParams, options);
5583
5705
  if (res.status >= 400) {
@@ -10243,6 +10365,54 @@ var UpdateWorkerMcpsResponse = zod.object({
10243
10365
  }),
10244
10366
  "message": zod.string()
10245
10367
  });
10368
+ var GetAccessParams = zod.object({
10369
+ "entityType": zod.enum(["worker"]),
10370
+ "entityId": zod.string().uuid()
10371
+ });
10372
+ var GetAccessResponse = zod.object({
10373
+ "data": zod.object({
10374
+ "grants": zod.array(zod.object({
10375
+ "principal_type": zod.enum(["profile", "worker"]).describe("Who holds the grant: a team member's `profile`, or a `worker`, whose runs act with it."),
10376
+ "principal_id": zod.string().uuid(),
10377
+ "level": zod.enum(["viewer", "editor"]).describe("`viewer` can see and use the entity. `editor` can also change and share it. On a `worker`, `viewer` sees the worker, its prompt and everything it owns, and can start it; `editor` can also edit, promote, delete and share it. Attaching secrets and managing schedules still need the matching role permission."),
10378
+ "created_at": zod.string().datetime({ "offset": true })
10379
+ }))
10380
+ }),
10381
+ "message": zod.string()
10382
+ });
10383
+ var UpdateAccessParams = zod.object({
10384
+ "entityType": zod.enum(["worker"]),
10385
+ "entityId": zod.string().uuid()
10386
+ });
10387
+ var updateAccessBodyGrantsMax = 1e3;
10388
+ var UpdateAccessBody = zod.object({
10389
+ "grants": zod.array(zod.object({
10390
+ "principal_type": zod.enum(["profile", "worker"]).describe("Who holds the grant: a team member's `profile`, or a `worker`, whose runs act with it."),
10391
+ "principal_id": zod.string().uuid(),
10392
+ "level": zod.enum(["viewer", "editor"]).describe("`viewer` can see and use the entity. `editor` can also change and share it. On a `worker`, `viewer` sees the worker, its prompt and everything it owns, and can start it; `editor` can also edit, promote, delete and share it. Attaching secrets and managing schedules still need the matching role permission.")
10393
+ })).max(updateAccessBodyGrantsMax).describe("Everyone the entity is shared with, replacing the current set. Pass an empty array to share it with no one.")
10394
+ });
10395
+ var UpdateAccessResponse = zod.object({
10396
+ "data": zod.object({
10397
+ "grants": zod.array(zod.object({
10398
+ "principal_type": zod.enum(["profile", "worker"]).describe("Who holds the grant: a team member's `profile`, or a `worker`, whose runs act with it."),
10399
+ "principal_id": zod.string().uuid(),
10400
+ "level": zod.enum(["viewer", "editor"]).describe("`viewer` can see and use the entity. `editor` can also change and share it. On a `worker`, `viewer` sees the worker, its prompt and everything it owns, and can start it; `editor` can also edit, promote, delete and share it. Attaching secrets and managing schedules still need the matching role permission."),
10401
+ "created_at": zod.string().datetime({ "offset": true })
10402
+ }))
10403
+ }),
10404
+ "message": zod.string()
10405
+ });
10406
+ var GetMyAccessParams = zod.object({
10407
+ "entityType": zod.enum(["worker"]),
10408
+ "entityId": zod.string().uuid()
10409
+ });
10410
+ var GetMyAccessResponse = zod.object({
10411
+ "data": zod.object({
10412
+ "permissions": zod.array(zod.enum(["workers:read", "workers:run", "workers:write", "workers:promote"])).describe("What the caller may do with the entity, through their role or a grant on it. On a worker, `workers:write` also lets the caller share it.")
10413
+ }),
10414
+ "message": zod.string()
10415
+ });
10246
10416
  var ListWorkerVersionsParams = zod.object({
10247
10417
  "workerId": zod.string().uuid()
10248
10418
  });
@@ -10888,7 +11058,7 @@ var GetProfileResponse = zod.object({
10888
11058
  "last_name": zod.union([zod.string(), zod.null()]),
10889
11059
  "email": zod.string(),
10890
11060
  "role": zod.enum(["admin", "avallon_admin", "member"]),
10891
- "permissions": zod.array(zod.enum(["voice-agents:write", "voice-agents:promote", "tools:write", "tools:execute", "tools:promote", "extractors:write", "inboxes:write", "inboxes:send", "artifacts:write", "api-keys:write", "teams:write", "cases:write", "cases:delete", "information-requests:write", "information-requests:resolve", "feedback:write", "outbound-jobs:write", "outbound-jobs:schedule", "workers:write", "workers:execute", "workers:write-mcp", "workers:run", "workers:promote", "chat-agents:write", "notifications:write", "prompts:read", "prompts:write", "secrets:read", "secrets:write", "schedules:read", "schedules:write", "tenants:write"])),
11061
+ "permissions": zod.array(zod.enum(["voice-agents:write", "voice-agents:promote", "tools:write", "tools:execute", "tools:promote", "extractors:write", "inboxes:write", "inboxes:send", "artifacts:write", "api-keys:write", "teams:write", "cases:write", "cases:delete", "information-requests:write", "information-requests:resolve", "feedback:write", "outbound-jobs:write", "outbound-jobs:schedule", "workers:read", "workers:create", "workers:write", "workers:execute", "workers:write-mcp", "workers:run", "workers:promote", "chat-agents:write", "notifications:write", "prompts:read", "prompts:write", "secrets:read", "secrets:write", "schedules:read", "schedules:write", "tenants:write"])),
10892
11062
  "tenants": zod.object({
10893
11063
  "active": zod.object({
10894
11064
  "id": zod.string(),
@@ -13702,6 +13872,55 @@ var createMcpServer = (options) => {
13702
13872
  signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
13703
13873
  })
13704
13874
  );
13875
+ tools.getAccess = server2.registerTool(
13876
+ "getAccess",
13877
+ {
13878
+ title: "Get access",
13879
+ description: "List who an entity is shared with. Admins see every entity through their role, whether or not they are listed. Requires `workers:write` on a worker.",
13880
+ inputSchema: {
13881
+ pathParams: GetAccessParams
13882
+ },
13883
+ outputSchema: GetAccessResponse,
13884
+ annotations: { readOnlyHint: true }
13885
+ },
13886
+ (args, ctx) => getAccessHandler(args, {
13887
+ ...options,
13888
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
13889
+ })
13890
+ );
13891
+ tools.updateAccess = server2.registerTool(
13892
+ "updateAccess",
13893
+ {
13894
+ title: "Update access",
13895
+ description: "Replace who an entity is shared with. Each grantee must be a team member or a worker of the tenant. Requires `workers:write` on a worker. An editor who leaves their own grant out loses access, unless their role gives it.",
13896
+ inputSchema: {
13897
+ pathParams: UpdateAccessParams,
13898
+ bodyParams: UpdateAccessBody.optional()
13899
+ },
13900
+ outputSchema: UpdateAccessResponse,
13901
+ annotations: { destructiveHint: true, idempotentHint: true }
13902
+ },
13903
+ (args, ctx) => updateAccessHandler(args, {
13904
+ ...options,
13905
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
13906
+ })
13907
+ );
13908
+ tools.getMyAccess = server2.registerTool(
13909
+ "getMyAccess",
13910
+ {
13911
+ title: "Get my access",
13912
+ description: "List what the caller may do with an entity, through their role or a grant on it, to decide which controls to show. An entity the caller cannot see is not found.",
13913
+ inputSchema: {
13914
+ pathParams: GetMyAccessParams
13915
+ },
13916
+ outputSchema: GetMyAccessResponse,
13917
+ annotations: { readOnlyHint: true }
13918
+ },
13919
+ (args, ctx) => getMyAccessHandler(args, {
13920
+ ...options,
13921
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
13922
+ })
13923
+ );
13705
13924
  tools.listWorkerVersions = server2.registerTool(
13706
13925
  "listWorkerVersions",
13707
13926
  {
@@ -15105,4 +15324,4 @@ var transport = new StdioServerTransport();
15105
15324
  server.connect(transport).then(() => {
15106
15325
  console.error("MCP server running on stdio");
15107
15326
  }).catch(console.error);
15108
- //# sourceMappingURL=server-YOC5SGIR.js.map
15327
+ //# sourceMappingURL=server-5KHVVGKL.js.map