@avallon-labs/mcp 60.0.0 → 60.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/index.js
CHANGED
|
@@ -1951,6 +1951,29 @@ var updateAccess = async (entityType, entityId, updateAccessBody, options) => {
|
|
|
1951
1951
|
const data = body ? JSON.parse(body) : {};
|
|
1952
1952
|
return { data, status: res.status, headers: res.headers };
|
|
1953
1953
|
};
|
|
1954
|
+
var getChangeAccessUrl = (entityType, entityId) => {
|
|
1955
|
+
return `/v1/access/${entityType}/${entityId}`;
|
|
1956
|
+
};
|
|
1957
|
+
var changeAccess = async (entityType, entityId, changeAccessBody, options) => {
|
|
1958
|
+
const getHeaders = (h) => {
|
|
1959
|
+
if (!h) return {};
|
|
1960
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
1961
|
+
if (Array.isArray(h)) return Object.fromEntries(h);
|
|
1962
|
+
return h;
|
|
1963
|
+
};
|
|
1964
|
+
const res = await fetch(
|
|
1965
|
+
getChangeAccessUrl(entityType, entityId),
|
|
1966
|
+
{
|
|
1967
|
+
...options,
|
|
1968
|
+
method: "PATCH",
|
|
1969
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1970
|
+
body: JSON.stringify(changeAccessBody)
|
|
1971
|
+
}
|
|
1972
|
+
);
|
|
1973
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1974
|
+
const data = body ? JSON.parse(body) : {};
|
|
1975
|
+
return { data, status: res.status, headers: res.headers };
|
|
1976
|
+
};
|
|
1954
1977
|
var getGetMyAccessUrl = (entityType, entityId) => {
|
|
1955
1978
|
return `/v1/access/${entityType}/${entityId}/me`;
|
|
1956
1979
|
};
|
|
@@ -6145,6 +6168,29 @@ var updateAccessHandler = async (args, options) => {
|
|
|
6145
6168
|
structuredContent: res.data
|
|
6146
6169
|
};
|
|
6147
6170
|
};
|
|
6171
|
+
var changeAccessHandler = async (args, options) => {
|
|
6172
|
+
const res = await changeAccess(args.pathParams.entityType, args.pathParams.entityId, args.bodyParams, options);
|
|
6173
|
+
if (res.status >= 400) {
|
|
6174
|
+
return {
|
|
6175
|
+
content: [
|
|
6176
|
+
{
|
|
6177
|
+
type: "text",
|
|
6178
|
+
text: JSON.stringify(res.data ?? null)
|
|
6179
|
+
}
|
|
6180
|
+
],
|
|
6181
|
+
isError: true
|
|
6182
|
+
};
|
|
6183
|
+
}
|
|
6184
|
+
return {
|
|
6185
|
+
content: [
|
|
6186
|
+
{
|
|
6187
|
+
type: "text",
|
|
6188
|
+
text: JSON.stringify(res.data ?? null)
|
|
6189
|
+
}
|
|
6190
|
+
],
|
|
6191
|
+
structuredContent: res.data
|
|
6192
|
+
};
|
|
6193
|
+
};
|
|
6148
6194
|
var getMyAccessHandler = async (args, options) => {
|
|
6149
6195
|
const res = await getMyAccess(args.pathParams.entityType, args.pathParams.entityId, options);
|
|
6150
6196
|
if (res.status >= 400) {
|
|
@@ -11381,6 +11427,36 @@ var UpdateAccessResponse = zod.object({
|
|
|
11381
11427
|
}),
|
|
11382
11428
|
"message": zod.string()
|
|
11383
11429
|
});
|
|
11430
|
+
var ChangeAccessParams = zod.object({
|
|
11431
|
+
"entityType": zod.enum(["worker", "case_type"]),
|
|
11432
|
+
"entityId": zod.string().describe("The worker's id or the case type's slug.")
|
|
11433
|
+
});
|
|
11434
|
+
var changeAccessBodyGrantsDefault = [];
|
|
11435
|
+
var changeAccessBodyGrantsMax = 1e3;
|
|
11436
|
+
var changeAccessBodyRevocationsDefault = [];
|
|
11437
|
+
var changeAccessBodyRevocationsMax = 1e3;
|
|
11438
|
+
var ChangeAccessBody = zod.object({
|
|
11439
|
+
"grants": zod.array(zod.object({
|
|
11440
|
+
"principal_type": zod.enum(["profile", "worker", "tenant"]).describe("Who holds the grant: a team member's `profile`, a `worker`, whose runs act with it, or the whole `tenant`. `tenant` is not supported yet."),
|
|
11441
|
+
"principal_id": zod.string().uuid(),
|
|
11442
|
+
"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. On a `case_type`, `editor` can also edit, promote and share it.")
|
|
11443
|
+
})).max(changeAccessBodyGrantsMax).default(changeAccessBodyGrantsDefault).describe("Grants to create, or whose level to change."),
|
|
11444
|
+
"revocations": zod.array(zod.object({
|
|
11445
|
+
"principal_type": zod.enum(["profile", "worker", "tenant"]).describe("Who holds the grant: a team member's `profile`, a `worker`, whose runs act with it, or the whole `tenant`. `tenant` is not supported yet."),
|
|
11446
|
+
"principal_id": zod.string().uuid()
|
|
11447
|
+
})).max(changeAccessBodyRevocationsMax).default(changeAccessBodyRevocationsDefault).describe("Grants to remove. Revoking a principal without a grant has no effect.")
|
|
11448
|
+
});
|
|
11449
|
+
var ChangeAccessResponse = zod.object({
|
|
11450
|
+
"data": zod.object({
|
|
11451
|
+
"grants": zod.array(zod.object({
|
|
11452
|
+
"principal_type": zod.enum(["profile", "worker", "tenant"]).describe("Who holds the grant: a team member's `profile`, a `worker`, whose runs act with it, or the whole `tenant`. `tenant` is not supported yet."),
|
|
11453
|
+
"principal_id": zod.string().uuid(),
|
|
11454
|
+
"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. On a `case_type`, `editor` can also edit, promote and share it."),
|
|
11455
|
+
"created_at": zod.string().datetime({ "offset": true })
|
|
11456
|
+
}))
|
|
11457
|
+
}),
|
|
11458
|
+
"message": zod.string()
|
|
11459
|
+
});
|
|
11384
11460
|
var GetMyAccessParams = zod.object({
|
|
11385
11461
|
"entityType": zod.enum(["worker", "case_type"]),
|
|
11386
11462
|
"entityId": zod.string().describe("The worker's id or the case type's slug.")
|
|
@@ -15660,8 +15736,8 @@ var createMcpServer = (options) => {
|
|
|
15660
15736
|
tools.updateAccess = server2.registerTool(
|
|
15661
15737
|
"updateAccess",
|
|
15662
15738
|
{
|
|
15663
|
-
title: "Update access",
|
|
15664
|
-
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 and `case-types:write` on a case type. An editor who leaves their own grant out loses access, unless their role gives it.",
|
|
15739
|
+
title: "Update access (deprecated)",
|
|
15740
|
+
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 and `case-types:write` on a case type. An editor who leaves their own grant out loses access, unless their role gives it.\n\n**Deprecated:** Use `PATCH /v1/access/{entityType}/{entityId}` instead.",
|
|
15665
15741
|
inputSchema: {
|
|
15666
15742
|
pathParams: UpdateAccessParams,
|
|
15667
15743
|
bodyParams: UpdateAccessBody.optional()
|
|
@@ -15674,6 +15750,23 @@ var createMcpServer = (options) => {
|
|
|
15674
15750
|
signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
|
|
15675
15751
|
})
|
|
15676
15752
|
);
|
|
15753
|
+
tools.changeAccess = server2.registerTool(
|
|
15754
|
+
"changeAccess",
|
|
15755
|
+
{
|
|
15756
|
+
title: "Change access",
|
|
15757
|
+
description: "Grant, change or revoke access for specific team members and workers. Everyone not named keeps their access. Each grantee must be a team member or a worker of the tenant. Requires `workers:write` on a worker and `case-types:write` on a case type. An editor who revokes their own grant loses access, and one who downgrades it can no longer change or share the entity, unless their role gives it.",
|
|
15758
|
+
inputSchema: {
|
|
15759
|
+
pathParams: ChangeAccessParams,
|
|
15760
|
+
bodyParams: ChangeAccessBody.optional()
|
|
15761
|
+
},
|
|
15762
|
+
outputSchema: ChangeAccessResponse,
|
|
15763
|
+
annotations: { destructiveHint: true }
|
|
15764
|
+
},
|
|
15765
|
+
(args, ctx) => changeAccessHandler(args, {
|
|
15766
|
+
...options,
|
|
15767
|
+
signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
|
|
15768
|
+
})
|
|
15769
|
+
);
|
|
15677
15770
|
tools.getMyAccess = server2.registerTool(
|
|
15678
15771
|
"getMyAccess",
|
|
15679
15772
|
{
|
|
@@ -17336,4 +17429,4 @@ var transport = new StdioServerTransport();
|
|
|
17336
17429
|
server.connect(transport).then(() => {
|
|
17337
17430
|
console.error("MCP server running on stdio");
|
|
17338
17431
|
}).catch(console.error);
|
|
17339
|
-
//# sourceMappingURL=server-
|
|
17432
|
+
//# sourceMappingURL=server-FHO2NMID.js.map
|