@burdenoff/mcp-libs 2026.1008.4 → 2026.1009.2
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/modules/files/index.cjs +101 -432
- package/dist/modules/files/index.cjs.map +1 -1
- package/dist/modules/files/index.js +102 -428
- package/dist/modules/files/index.js.map +1 -1
- package/dist/modules/groups/index.cjs +89 -360
- package/dist/modules/groups/index.cjs.map +1 -1
- package/dist/modules/groups/index.js +90 -356
- package/dist/modules/groups/index.js.map +1 -1
- package/dist/modules/rbac/index.cjs +85 -409
- package/dist/modules/rbac/index.cjs.map +1 -1
- package/dist/modules/rbac/index.js +86 -405
- package/dist/modules/rbac/index.js.map +1 -1
- package/dist/modules/sandbox/index.cjs +80 -1136
- package/dist/modules/sandbox/index.cjs.map +1 -1
- package/dist/modules/sandbox/index.js +80 -916
- package/dist/modules/sandbox/index.js.map +1 -1
- package/dist/modules/scheduler/index.cjs +70 -1044
- package/dist/modules/scheduler/index.cjs.map +1 -1
- package/dist/modules/scheduler/index.js +69 -1038
- package/dist/modules/scheduler/index.js.map +1 -1
- package/dist/modules/security/index.cjs +42 -507
- package/dist/modules/security/index.cjs.map +1 -1
- package/dist/modules/security/index.js +41 -501
- package/dist/modules/security/index.js.map +1 -1
- package/dist/modules/store/index.cjs +49 -479
- package/dist/modules/store/index.cjs.map +1 -1
- package/dist/modules/store/index.js +48 -473
- package/dist/modules/store/index.js.map +1 -1
- package/dist/modules/support/index.cjs +18 -19
- package/dist/modules/support/index.cjs.map +1 -1
- package/dist/modules/support/index.js +18 -19
- package/dist/modules/support/index.js.map +1 -1
- package/dist/modules/tags/index.cjs +43 -348
- package/dist/modules/tags/index.cjs.map +1 -1
- package/dist/modules/tags/index.js +42 -342
- package/dist/modules/tags/index.js.map +1 -1
- package/dist/modules/vibecontrols/index.js +1774 -1
- package/dist/modules/vibecontrols/index.js.map +1 -1
- package/dist/modules/workspaces/index.cjs +20 -29
- package/dist/modules/workspaces/index.cjs.map +1 -1
- package/dist/modules/workspaces/index.js +20 -29
- package/dist/modules/workspaces/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-XITZQYB2.js +0 -1776
- package/dist/chunk-XITZQYB2.js.map +0 -1
|
@@ -1,421 +1,102 @@
|
|
|
1
|
-
import { mcpToolName, errorResult
|
|
1
|
+
import { mcpToolName, errorResult } from '../../chunk-G76DKEPI.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
var LIST_ROLES = `
|
|
6
|
-
query ListRoles($filter: RoleFilterInput, $pagination: PaginationInput, $scopeId: String!) {
|
|
7
|
-
roles(filter: $filter, pagination: $pagination, scopeId: $scopeId) {
|
|
8
|
-
id
|
|
9
|
-
name
|
|
10
|
-
description
|
|
11
|
-
isSystem
|
|
12
|
-
scopeId
|
|
13
|
-
priority
|
|
14
|
-
defaultPermissions {
|
|
15
|
-
level
|
|
16
|
-
resourceType
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
var GET_ROLE = `
|
|
22
|
-
query GetRole($id: ID!) {
|
|
23
|
-
role(id: $id) {
|
|
24
|
-
id
|
|
25
|
-
name
|
|
26
|
-
description
|
|
27
|
-
isSystem
|
|
28
|
-
scopeId
|
|
29
|
-
priority
|
|
30
|
-
defaultPermissions {
|
|
31
|
-
level
|
|
32
|
-
resourceType
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
var CREATE_ROLE = `
|
|
38
|
-
mutation CreateRole($input: CreateRoleInput!) {
|
|
39
|
-
createRole(input: $input) {
|
|
40
|
-
id
|
|
41
|
-
name
|
|
42
|
-
description
|
|
43
|
-
scopeId
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
var UPDATE_ROLE = `
|
|
48
|
-
mutation UpdateRole($id: ID!, $input: UpdateRoleInput!) {
|
|
49
|
-
updateRole(id: $id, input: $input) {
|
|
50
|
-
id
|
|
51
|
-
name
|
|
52
|
-
description
|
|
53
|
-
priority
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
`;
|
|
57
|
-
var DELETE_ROLE = `
|
|
58
|
-
mutation DeleteRole($id: ID!, $reassignToRoleId: ID) {
|
|
59
|
-
deleteRole(id: $id, reassignToRoleId: $reassignToRoleId)
|
|
60
|
-
}
|
|
61
|
-
`;
|
|
62
|
-
var CHECK_PERMISSION = `
|
|
63
|
-
query CheckPermission($input: PermissionCheckInput!) {
|
|
64
|
-
checkPermission(input: $input) {
|
|
65
|
-
allowed
|
|
66
|
-
decisionPath
|
|
67
|
-
roleName
|
|
68
|
-
roleLevel
|
|
69
|
-
overrideType
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
var LIST_POLICY_REFERENCES = `
|
|
74
|
-
query PolicyReferences($filter: PolicyReferenceFilterInput, $pagination: PaginationInput) {
|
|
75
|
-
policyReferences(filter: $filter, pagination: $pagination) {
|
|
76
|
-
id
|
|
77
|
-
name
|
|
78
|
-
description
|
|
79
|
-
opaPackage
|
|
80
|
-
resourceType
|
|
81
|
-
action
|
|
82
|
-
isActive
|
|
83
|
-
priority
|
|
84
|
-
createdAt
|
|
85
|
-
updatedAt
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
var ATTACH_POLICY = `
|
|
90
|
-
mutation AttachPolicy($roleId: ID!, $policyId: ID!) {
|
|
91
|
-
attachPolicyToRole(roleId: $roleId, policyId: $policyId) {
|
|
92
|
-
id
|
|
93
|
-
name
|
|
94
|
-
resourceType
|
|
95
|
-
action
|
|
96
|
-
isActive
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
`;
|
|
100
|
-
var DETACH_POLICY = `
|
|
101
|
-
mutation DetachPolicy($roleId: ID!, $policyId: ID!) {
|
|
102
|
-
detachPolicyFromRole(roleId: $roleId, policyId: $policyId)
|
|
103
|
-
}
|
|
104
|
-
`;
|
|
105
|
-
|
|
106
|
-
// src/modules/rbac/tools.ts
|
|
107
|
-
var LayerEnum = z.enum(["workspace", "global"]);
|
|
108
|
-
var ActorTypeEnum = z.enum(["USER", "BOT", "GROUP", "INTEGRATION", "DELEGATED_AGENT"]);
|
|
109
|
-
function clientForLayer(ctx, layer) {
|
|
110
|
-
return layer === "workspace" ? ctx.gql.workspace : ctx.gql.global;
|
|
111
|
-
}
|
|
112
|
-
function defaultScopeId(ctx, layer) {
|
|
113
|
-
const auth = ctx.auth.read();
|
|
114
|
-
if (!auth) return null;
|
|
115
|
-
if (layer === "workspace") return auth.workspaceId ?? null;
|
|
116
|
-
return auth.organizationId ?? null;
|
|
117
|
-
}
|
|
118
|
-
function registerRbacTools(server, ctx, track) {
|
|
4
|
+
function stubbedTool(server, toolName, title, description, featureNote, inputSchema, altSuggestions) {
|
|
119
5
|
server.registerTool(
|
|
120
|
-
|
|
6
|
+
toolName,
|
|
121
7
|
{
|
|
122
|
-
title
|
|
123
|
-
description:
|
|
124
|
-
inputSchema
|
|
125
|
-
layer: LayerEnum.optional().describe("workspace or global (default: workspace)"),
|
|
126
|
-
scopeId: z.string().optional().describe("Override scope id (workspace or tenant)"),
|
|
127
|
-
includeSystem: z.boolean().optional().describe("Include system roles"),
|
|
128
|
-
limit: z.number().optional().describe("Page size")
|
|
129
|
-
}
|
|
8
|
+
title,
|
|
9
|
+
description: `${description} [STUB]`,
|
|
10
|
+
inputSchema
|
|
130
11
|
},
|
|
131
|
-
async (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const resolvedScope = scopeId ?? defaultScopeId(ctx, targetLayer);
|
|
135
|
-
if (!resolvedScope) {
|
|
136
|
-
return errorResult(
|
|
137
|
-
`No ${targetLayer} scope. Pass scopeId or authenticate to a workspace/organization.`
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
const filter = {};
|
|
141
|
-
if (includeSystem) filter.includeSystem = true;
|
|
142
|
-
const data = await clientForLayer(ctx, targetLayer).request(
|
|
143
|
-
LIST_ROLES,
|
|
144
|
-
{
|
|
145
|
-
filter: Object.keys(filter).length ? filter : void 0,
|
|
146
|
-
pagination: { limit: limit ?? 100, offset: 0 },
|
|
147
|
-
scopeId: resolvedScope
|
|
148
|
-
}
|
|
149
|
-
);
|
|
150
|
-
return jsonResult(data.roles);
|
|
151
|
-
} catch (error) {
|
|
152
|
-
ctx.logger.error("rbac_roles_list failed", { error: String(error) });
|
|
153
|
-
return errorResult(
|
|
154
|
-
`Failed to list roles: ${error instanceof Error ? error.message : String(error)}`
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
12
|
+
async () => errorResult(
|
|
13
|
+
`[stubbed] ${featureNote} Use ${altSuggestions.join(", ")} instead. The tool remains registered so callers receive a meaningful response instead of a schema-validation error.`
|
|
14
|
+
)
|
|
158
15
|
);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const targetLayer = layer ?? "workspace";
|
|
172
|
-
const data = await clientForLayer(ctx, targetLayer).request(
|
|
173
|
-
GET_ROLE,
|
|
174
|
-
{ id }
|
|
175
|
-
);
|
|
176
|
-
if (!data.role) return errorResult(`Role ${id} not found`);
|
|
177
|
-
return jsonResult(data.role);
|
|
178
|
-
} catch (error) {
|
|
179
|
-
ctx.logger.error("rbac_roles_get failed", { error: String(error) });
|
|
180
|
-
return errorResult(
|
|
181
|
-
`Failed to get role: ${error instanceof Error ? error.message : String(error)}`
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
16
|
+
}
|
|
17
|
+
function registerRbacTools(server, _ctx, track) {
|
|
18
|
+
const featureNote = "Live alpha removed the rbac policies surface (no `attachPolicyToRole` / `detachPolicyFromRole` mutations; `roles` / `policies` queries are gone).";
|
|
19
|
+
const alts = ["the next alpha release that re-exposes the rbac surface"];
|
|
20
|
+
stubbedTool(
|
|
21
|
+
server,
|
|
22
|
+
track(mcpToolName(_ctx.productName, "rbac_check")),
|
|
23
|
+
"Check Permission",
|
|
24
|
+
"Check whether the calling actor has a given permission.",
|
|
25
|
+
featureNote,
|
|
26
|
+
{ permission: z.string() },
|
|
27
|
+
alts
|
|
185
28
|
);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
parentId: z.string().optional().describe("Parent role id"),
|
|
195
|
-
priority: z.number().optional().describe("Priority"),
|
|
196
|
-
layer: LayerEnum.optional().describe("workspace or global (default: workspace)"),
|
|
197
|
-
scopeId: z.string().optional().describe("Override scope id"),
|
|
198
|
-
scopeType: z.string().optional().describe("wspace|entity (global layer only)")
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
async ({ name, description, parentId, priority, layer, scopeId, scopeType }) => {
|
|
202
|
-
try {
|
|
203
|
-
const targetLayer = layer ?? "workspace";
|
|
204
|
-
const resolvedScope = scopeId ?? defaultScopeId(ctx, targetLayer);
|
|
205
|
-
if (!resolvedScope) {
|
|
206
|
-
return errorResult(
|
|
207
|
-
`No ${targetLayer} scope. Pass scopeId or authenticate to a workspace/organization.`
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
const input = { name, scopeId: resolvedScope };
|
|
211
|
-
if (description !== void 0) input.description = description;
|
|
212
|
-
if (parentId !== void 0) input.parentId = parentId;
|
|
213
|
-
if (priority !== void 0) input.priority = priority;
|
|
214
|
-
if (targetLayer === "global" && scopeType) input.scopeType = scopeType;
|
|
215
|
-
const data = await clientForLayer(ctx, targetLayer).request(
|
|
216
|
-
CREATE_ROLE,
|
|
217
|
-
{ input }
|
|
218
|
-
);
|
|
219
|
-
return jsonResult(data.createRole);
|
|
220
|
-
} catch (error) {
|
|
221
|
-
ctx.logger.error("rbac_roles_create failed", { error: String(error) });
|
|
222
|
-
return errorResult(
|
|
223
|
-
`Failed to create role: ${error instanceof Error ? error.message : String(error)}`
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
29
|
+
stubbedTool(
|
|
30
|
+
server,
|
|
31
|
+
track(mcpToolName(_ctx.productName, "rbac_policies_list")),
|
|
32
|
+
"List Policy References",
|
|
33
|
+
"List references to a policy across the system.",
|
|
34
|
+
featureNote,
|
|
35
|
+
{ policyId: z.string() },
|
|
36
|
+
alts
|
|
227
37
|
);
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
description: z.string().optional().describe("Updated description"),
|
|
237
|
-
priority: z.number().optional().describe("Updated priority"),
|
|
238
|
-
parentId: z.string().optional().describe("Updated parent role id"),
|
|
239
|
-
layer: LayerEnum.optional().describe("workspace or global (default: workspace)")
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
async ({ id, name, description, priority, parentId, layer }) => {
|
|
243
|
-
try {
|
|
244
|
-
const targetLayer = layer ?? "workspace";
|
|
245
|
-
const input = {};
|
|
246
|
-
if (name !== void 0) input.name = name;
|
|
247
|
-
if (description !== void 0) input.description = description;
|
|
248
|
-
if (priority !== void 0) input.priority = priority;
|
|
249
|
-
if (parentId !== void 0) input.parentId = parentId;
|
|
250
|
-
if (!Object.keys(input).length) {
|
|
251
|
-
return errorResult("No updates specified");
|
|
252
|
-
}
|
|
253
|
-
const data = await clientForLayer(ctx, targetLayer).request(
|
|
254
|
-
UPDATE_ROLE,
|
|
255
|
-
{ id, input }
|
|
256
|
-
);
|
|
257
|
-
return jsonResult(data.updateRole);
|
|
258
|
-
} catch (error) {
|
|
259
|
-
ctx.logger.error("rbac_roles_update failed", { error: String(error) });
|
|
260
|
-
return errorResult(
|
|
261
|
-
`Failed to update role: ${error instanceof Error ? error.message : String(error)}`
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
38
|
+
stubbedTool(
|
|
39
|
+
server,
|
|
40
|
+
track(mcpToolName(_ctx.productName, "rbac_policies_attach")),
|
|
41
|
+
"Attach Policy to Role",
|
|
42
|
+
"Attach a policy to a role.",
|
|
43
|
+
featureNote,
|
|
44
|
+
{ roleId: z.string(), policyId: z.string() },
|
|
45
|
+
alts
|
|
265
46
|
);
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
layer: LayerEnum.optional().describe("workspace or global (default: workspace)")
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
async ({ id, reassignToRoleId, layer }) => {
|
|
278
|
-
try {
|
|
279
|
-
const targetLayer = layer ?? "workspace";
|
|
280
|
-
const data = await clientForLayer(ctx, targetLayer).request(
|
|
281
|
-
DELETE_ROLE,
|
|
282
|
-
{ id, reassignToRoleId }
|
|
283
|
-
);
|
|
284
|
-
return jsonResult({ deleted: data.deleteRole, roleId: id });
|
|
285
|
-
} catch (error) {
|
|
286
|
-
ctx.logger.error("rbac_roles_delete failed", { error: String(error) });
|
|
287
|
-
return errorResult(
|
|
288
|
-
`Failed to delete role: ${error instanceof Error ? error.message : String(error)}`
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
47
|
+
stubbedTool(
|
|
48
|
+
server,
|
|
49
|
+
track(mcpToolName(_ctx.productName, "rbac_policies_detach")),
|
|
50
|
+
"Detach Policy from Role",
|
|
51
|
+
"Detach a policy from a role.",
|
|
52
|
+
featureNote,
|
|
53
|
+
{ roleId: z.string(), policyId: z.string() },
|
|
54
|
+
alts
|
|
292
55
|
);
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
action: z.string().optional().describe("Filter by action (e.g. read/write/delete)"),
|
|
302
|
-
isActive: z.boolean().optional().describe("Only active/inactive policies"),
|
|
303
|
-
limit: z.number().int().optional().describe("Page size (default 100)"),
|
|
304
|
-
offset: z.number().int().optional().describe("Pagination offset (default 0)")
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
async ({ layer, resourceType, action, isActive, limit, offset }) => {
|
|
308
|
-
try {
|
|
309
|
-
const targetLayer = layer ?? "workspace";
|
|
310
|
-
const filter = {};
|
|
311
|
-
if (resourceType !== void 0) filter.resourceType = resourceType;
|
|
312
|
-
if (action !== void 0) filter.action = action;
|
|
313
|
-
if (isActive !== void 0) filter.isActive = isActive;
|
|
314
|
-
const data = await clientForLayer(ctx, targetLayer).request(LIST_POLICY_REFERENCES, {
|
|
315
|
-
filter: Object.keys(filter).length ? filter : void 0,
|
|
316
|
-
pagination: { limit: limit ?? 100, offset: offset ?? 0 }
|
|
317
|
-
});
|
|
318
|
-
return jsonResult(data.policyReferences);
|
|
319
|
-
} catch (error) {
|
|
320
|
-
ctx.logger.error("rbac_policies_list failed", { error: String(error) });
|
|
321
|
-
return errorResult(
|
|
322
|
-
`Failed to list policy references: ${error instanceof Error ? error.message : String(error)}`
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
56
|
+
stubbedTool(
|
|
57
|
+
server,
|
|
58
|
+
track(mcpToolName(_ctx.productName, "rbac_roles_list")),
|
|
59
|
+
"List Roles",
|
|
60
|
+
"List roles (workspace or global layer).",
|
|
61
|
+
featureNote,
|
|
62
|
+
{ layer: z.enum(["workspace", "global"]).optional() },
|
|
63
|
+
alts
|
|
326
64
|
);
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
layer: LayerEnum.optional().describe("workspace or global (default: workspace)")
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
async ({ roleId, policyId, layer }) => {
|
|
339
|
-
try {
|
|
340
|
-
const targetLayer = layer ?? "workspace";
|
|
341
|
-
const data = await clientForLayer(ctx, targetLayer).request(ATTACH_POLICY, { roleId, policyId });
|
|
342
|
-
return jsonResult(data.attachPolicyToRole);
|
|
343
|
-
} catch (error) {
|
|
344
|
-
ctx.logger.error("rbac_policies_attach failed", { error: String(error) });
|
|
345
|
-
return errorResult(
|
|
346
|
-
`Failed to attach policy: ${error instanceof Error ? error.message : String(error)}`
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
65
|
+
stubbedTool(
|
|
66
|
+
server,
|
|
67
|
+
track(mcpToolName(_ctx.productName, "rbac_roles_get")),
|
|
68
|
+
"Get Role",
|
|
69
|
+
"Get a role by ID.",
|
|
70
|
+
featureNote,
|
|
71
|
+
{ id: z.string() },
|
|
72
|
+
alts
|
|
350
73
|
);
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
layer: LayerEnum.optional().describe("workspace or global (default: workspace)")
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
async ({ roleId, policyId, layer }) => {
|
|
363
|
-
try {
|
|
364
|
-
const targetLayer = layer ?? "workspace";
|
|
365
|
-
const data = await clientForLayer(ctx, targetLayer).request(DETACH_POLICY, { roleId, policyId });
|
|
366
|
-
return jsonResult({ detached: data.detachPolicyFromRole, roleId, policyId });
|
|
367
|
-
} catch (error) {
|
|
368
|
-
ctx.logger.error("rbac_policies_detach failed", { error: String(error) });
|
|
369
|
-
return errorResult(
|
|
370
|
-
`Failed to detach policy: ${error instanceof Error ? error.message : String(error)}`
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
74
|
+
stubbedTool(
|
|
75
|
+
server,
|
|
76
|
+
track(mcpToolName(_ctx.productName, "rbac_roles_create")),
|
|
77
|
+
"Create Role",
|
|
78
|
+
"Create a new role.",
|
|
79
|
+
featureNote,
|
|
80
|
+
{ name: z.string() },
|
|
81
|
+
alts
|
|
374
82
|
);
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
const targetLayer = layer ?? "workspace";
|
|
393
|
-
const resolvedScope = scopeId ?? defaultScopeId(ctx, targetLayer);
|
|
394
|
-
if (!resolvedScope) {
|
|
395
|
-
return errorResult(
|
|
396
|
-
`No ${targetLayer} scope. Pass scopeId or authenticate to a workspace/organization.`
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
|
-
const input = {
|
|
400
|
-
actorId,
|
|
401
|
-
actorType: actorType ?? "USER",
|
|
402
|
-
action,
|
|
403
|
-
resourceType,
|
|
404
|
-
scopeId: resolvedScope
|
|
405
|
-
};
|
|
406
|
-
if (resourceId !== void 0) input.resourceId = resourceId;
|
|
407
|
-
const data = await clientForLayer(ctx, targetLayer).request(
|
|
408
|
-
CHECK_PERMISSION,
|
|
409
|
-
{ input }
|
|
410
|
-
);
|
|
411
|
-
return jsonResult(data.checkPermission);
|
|
412
|
-
} catch (error) {
|
|
413
|
-
ctx.logger.error("rbac_check failed", { error: String(error) });
|
|
414
|
-
return errorResult(
|
|
415
|
-
`Failed to check permission: ${error instanceof Error ? error.message : String(error)}`
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
83
|
+
stubbedTool(
|
|
84
|
+
server,
|
|
85
|
+
track(mcpToolName(_ctx.productName, "rbac_roles_update")),
|
|
86
|
+
"Update Role",
|
|
87
|
+
"Update a role.",
|
|
88
|
+
featureNote,
|
|
89
|
+
{ id: z.string() },
|
|
90
|
+
alts
|
|
91
|
+
);
|
|
92
|
+
stubbedTool(
|
|
93
|
+
server,
|
|
94
|
+
track(mcpToolName(_ctx.productName, "rbac_roles_delete")),
|
|
95
|
+
"Delete Role",
|
|
96
|
+
"Delete a role.",
|
|
97
|
+
featureNote,
|
|
98
|
+
{ id: z.string() },
|
|
99
|
+
alts
|
|
419
100
|
);
|
|
420
101
|
}
|
|
421
102
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/modules/rbac/operations.ts","../../../src/modules/rbac/tools.ts","../../../src/modules/rbac/index.ts"],"names":[],"mappings":";;;;AAAO,IAAM,UAAA,GAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAiBnB,IAAM,QAAA,GAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAiBjB,IAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAWpB,IAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAWpB,IAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA,CAAA;AAMpB,IAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAYzB,IAAM,sBAAA,GAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAiB/B,IAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAYtB,IAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA,CAAA;;;ACxF7B,IAAM,YAAY,CAAA,CAAE,IAAA,CAAK,CAAC,WAAA,EAAa,QAAQ,CAAC,CAAA;AAChD,IAAM,aAAA,GAAgB,EAAE,IAAA,C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d,QAAA,GAAA,CAAI,MAAA,CAAO,MAAM,mBAAA,EAAqB,EAAE,OAAO,MAAA,CAAO,KAAK,GAAG,CAAA;AAC9D,QAAA,OAAO,WAAA;AAAA,UACL,+BAA+B,KAAA,YAAiB,KAAA,GAAQ,MAAM,OAAA,GAAU,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,SACvF;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF;;;ACrVA,IAAM,UAAA,GAAwB;AAAA,EAC5B,EAAA,EAAI,MAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,MAAA;AAAA,EACb,SAAA,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,iBAAA,CAAkB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAEpC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,YAAA,GAAQ","file":"index.js","sourcesContent":["export const LIST_ROLES = `\n query ListRoles($filter: RoleFilterInput, $pagination: PaginationInput, $scopeId: String!) {\n roles(filter: $filter, pagination: $pagination, scopeId: $scopeId) {\n id\n name\n description\n isSystem\n scopeId\n priority\n defaultPermissions {\n level\n resourceType\n }\n }\n }\n`;\n\nexport const GET_ROLE = `\n query GetRole($id: ID!) {\n role(id: $id) {\n id\n name\n description\n isSystem\n scopeId\n priority\n defaultPermissions {\n level\n resourceType\n }\n }\n }\n`;\n\nexport const CREATE_ROLE = `\n mutation CreateRole($input: CreateRoleInput!) {\n createRole(input: $input) {\n id\n name\n description\n scopeId\n }\n }\n`;\n\nexport const UPDATE_ROLE = `\n mutation UpdateRole($id: ID!, $input: UpdateRoleInput!) {\n updateRole(id: $id, input: $input) {\n id\n name\n description\n priority\n }\n }\n`;\n\nexport const DELETE_ROLE = `\n mutation DeleteRole($id: ID!, $reassignToRoleId: ID) {\n deleteRole(id: $id, reassignToRoleId: $reassignToRoleId)\n }\n`;\n\nexport const CHECK_PERMISSION = `\n query CheckPermission($input: PermissionCheckInput!) {\n checkPermission(input: $input) {\n allowed\n decisionPath\n roleName\n roleLevel\n overrideType\n }\n }\n`;\n\nexport const LIST_POLICY_REFERENCES = `\n query PolicyReferences($filter: PolicyReferenceFilterInput, $pagination: PaginationInput) {\n policyReferences(filter: $filter, pagination: $pagination) {\n id\n name\n description\n opaPackage\n resourceType\n action\n isActive\n priority\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const ATTACH_POLICY = `\n mutation AttachPolicy($roleId: ID!, $policyId: ID!) {\n attachPolicyToRole(roleId: $roleId, policyId: $policyId) {\n id\n name\n resourceType\n action\n isActive\n }\n }\n`;\n\nexport const DETACH_POLICY = `\n mutation DetachPolicy($roleId: ID!, $policyId: ID!) {\n detachPolicyFromRole(roleId: $roleId, policyId: $policyId)\n }\n`;\n","import { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport {\n LIST_ROLES,\n GET_ROLE,\n CREATE_ROLE,\n UPDATE_ROLE,\n DELETE_ROLE,\n CHECK_PERMISSION,\n LIST_POLICY_REFERENCES,\n ATTACH_POLICY,\n DETACH_POLICY,\n} from './operations.js';\n\nconst LayerEnum = z.enum(['workspace', 'global']);\nconst ActorTypeEnum = z.enum(['USER', 'BOT', 'GROUP', 'INTEGRATION', 'DELEGATED_AGENT']);\n\ntype Layer = 'workspace' | 'global';\n\nfunction clientForLayer(ctx: McpContext, layer: Layer) {\n return layer === 'workspace' ? ctx.gql.workspace : ctx.gql.global;\n}\n\nfunction defaultScopeId(ctx: McpContext, layer: Layer): string | null {\n const auth = ctx.auth.read();\n if (!auth) return null;\n if (layer === 'workspace') return auth.workspaceId ?? null;\n return auth.organizationId ?? null;\n}\n\nexport function registerRbacTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'rbac_roles_list')),\n {\n title: 'List Roles',\n description: 'List RBAC roles for a workspace or global scope.',\n inputSchema: {\n layer: LayerEnum.optional().describe('workspace or global (default: workspace)'),\n scopeId: z.string().optional().describe('Override scope id (workspace or tenant)'),\n includeSystem: z.boolean().optional().describe('Include system roles'),\n limit: z.number().optional().describe('Page size'),\n },\n },\n async ({ layer, scopeId, includeSystem, limit }) => {\n try {\n const targetLayer: Layer = layer ?? 'workspace';\n const resolvedScope = scopeId ?? defaultScopeId(ctx, targetLayer);\n if (!resolvedScope) {\n return errorResult(\n `No ${targetLayer} scope. Pass scopeId or authenticate to a workspace/organization.`,\n );\n }\n const filter: Record<string, unknown> = {};\n if (includeSystem) filter.includeSystem = true;\n const data = await clientForLayer(ctx, targetLayer).request<{ roles: unknown }>(\n LIST_ROLES,\n {\n filter: Object.keys(filter).length ? filter : undefined,\n pagination: { limit: limit ?? 100, offset: 0 },\n scopeId: resolvedScope,\n },\n );\n return jsonResult(data.roles);\n } catch (error) {\n ctx.logger.error('rbac_roles_list failed', { error: String(error) });\n return errorResult(\n `Failed to list roles: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'rbac_roles_get')),\n {\n title: 'Get Role',\n description: 'Get a role by id from the workspace or global layer.',\n inputSchema: {\n id: z.string().describe('Role ID'),\n layer: LayerEnum.optional().describe('workspace or global (default: workspace)'),\n },\n },\n async ({ id, layer }) => {\n try {\n const targetLayer: Layer = layer ?? 'workspace';\n const data = await clientForLayer(ctx, targetLayer).request<{ role: unknown | null }>(\n GET_ROLE,\n { id },\n );\n if (!data.role) return errorResult(`Role ${id} not found`);\n return jsonResult(data.role);\n } catch (error) {\n ctx.logger.error('rbac_roles_get failed', { error: String(error) });\n return errorResult(\n `Failed to get role: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'rbac_roles_create')),\n {\n title: 'Create Role',\n description: 'Create a new RBAC role at the workspace or global layer.',\n inputSchema: {\n name: z.string().describe('Role name'),\n description: z.string().optional().describe('Role description'),\n parentId: z.string().optional().describe('Parent role id'),\n priority: z.number().optional().describe('Priority'),\n layer: LayerEnum.optional().describe('workspace or global (default: workspace)'),\n scopeId: z.string().optional().describe('Override scope id'),\n scopeType: z.string().optional().describe('wspace|entity (global layer only)'),\n },\n },\n async ({ name, description, parentId, priority, layer, scopeId, scopeType }) => {\n try {\n const targetLayer: Layer = layer ?? 'workspace';\n const resolvedScope = scopeId ?? defaultScopeId(ctx, targetLayer);\n if (!resolvedScope) {\n return errorResult(\n `No ${targetLayer} scope. Pass scopeId or authenticate to a workspace/organization.`,\n );\n }\n const input: Record<string, unknown> = { name, scopeId: resolvedScope };\n if (description !== undefined) input.description = description;\n if (parentId !== undefined) input.parentId = parentId;\n if (priority !== undefined) input.priority = priority;\n if (targetLayer === 'global' && scopeType) input.scopeType = scopeType;\n const data = await clientForLayer(ctx, targetLayer).request<{ createRole: unknown }>(\n CREATE_ROLE,\n { input },\n );\n return jsonResult(data.createRole);\n } catch (error) {\n ctx.logger.error('rbac_roles_create failed', { error: String(error) });\n return errorResult(\n `Failed to create role: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'rbac_roles_update')),\n {\n title: 'Update Role',\n description: 'Update an existing role.',\n inputSchema: {\n id: z.string().describe('Role ID'),\n name: z.string().optional().describe('Updated name'),\n description: z.string().optional().describe('Updated description'),\n priority: z.number().optional().describe('Updated priority'),\n parentId: z.string().optional().describe('Updated parent role id'),\n layer: LayerEnum.optional().describe('workspace or global (default: workspace)'),\n },\n },\n async ({ id, name, description, priority, parentId, layer }) => {\n try {\n const targetLayer: Layer = layer ?? 'workspace';\n const input: Record<string, unknown> = {};\n if (name !== undefined) input.name = name;\n if (description !== undefined) input.description = description;\n if (priority !== undefined) input.priority = priority;\n if (parentId !== undefined) input.parentId = parentId;\n if (!Object.keys(input).length) {\n return errorResult('No updates specified');\n }\n const data = await clientForLayer(ctx, targetLayer).request<{ updateRole: unknown }>(\n UPDATE_ROLE,\n { id, input },\n );\n return jsonResult(data.updateRole);\n } catch (error) {\n ctx.logger.error('rbac_roles_update failed', { error: String(error) });\n return errorResult(\n `Failed to update role: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'rbac_roles_delete')),\n {\n title: 'Delete Role',\n description: 'Delete a role, optionally reassigning actors to another role.',\n inputSchema: {\n id: z.string().describe('Role ID'),\n reassignToRoleId: z.string().optional().describe('Reassign actors to this role'),\n layer: LayerEnum.optional().describe('workspace or global (default: workspace)'),\n },\n },\n async ({ id, reassignToRoleId, layer }) => {\n try {\n const targetLayer: Layer = layer ?? 'workspace';\n const data = await clientForLayer(ctx, targetLayer).request<{ deleteRole: unknown }>(\n DELETE_ROLE,\n { id, reassignToRoleId },\n );\n return jsonResult({ deleted: data.deleteRole, roleId: id });\n } catch (error) {\n ctx.logger.error('rbac_roles_delete failed', { error: String(error) });\n return errorResult(\n `Failed to delete role: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Policies ────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'rbac_policies_list')),\n {\n title: 'List Policy References',\n description:\n 'List OPA policy references registered on the chosen gateway (workspace or global), optionally filtered by resource/action/active state. Returns an array of PolicyReference.',\n inputSchema: {\n layer: LayerEnum.optional().describe('workspace or global (default: workspace)'),\n resourceType: z.string().optional().describe('Filter by resource type (e.g. project)'),\n action: z.string().optional().describe('Filter by action (e.g. read/write/delete)'),\n isActive: z.boolean().optional().describe('Only active/inactive policies'),\n limit: z.number().int().optional().describe('Page size (default 100)'),\n offset: z.number().int().optional().describe('Pagination offset (default 0)'),\n },\n },\n async ({ layer, resourceType, action, isActive, limit, offset }) => {\n try {\n const targetLayer: Layer = layer ?? 'workspace';\n const filter: Record<string, unknown> = {};\n if (resourceType !== undefined) filter.resourceType = resourceType;\n if (action !== undefined) filter.action = action;\n if (isActive !== undefined) filter.isActive = isActive;\n const data = await clientForLayer(ctx, targetLayer).request<{\n policyReferences: unknown[];\n }>(LIST_POLICY_REFERENCES, {\n filter: Object.keys(filter).length ? filter : undefined,\n pagination: { limit: limit ?? 100, offset: offset ?? 0 },\n });\n return jsonResult(data.policyReferences);\n } catch (error) {\n ctx.logger.error('rbac_policies_list failed', { error: String(error) });\n return errorResult(\n `Failed to list policy references: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'rbac_policies_attach')),\n {\n title: 'Attach Policy To Role',\n description:\n 'Attach an OPA policy reference to a role on the chosen gateway. Returns the attached PolicyReference.',\n inputSchema: {\n roleId: z.string().describe('Role ID'),\n policyId: z.string().describe('PolicyReference ID'),\n layer: LayerEnum.optional().describe('workspace or global (default: workspace)'),\n },\n },\n async ({ roleId, policyId, layer }) => {\n try {\n const targetLayer: Layer = layer ?? 'workspace';\n const data = await clientForLayer(ctx, targetLayer).request<{\n attachPolicyToRole: unknown;\n }>(ATTACH_POLICY, { roleId, policyId });\n return jsonResult(data.attachPolicyToRole);\n } catch (error) {\n ctx.logger.error('rbac_policies_attach failed', { error: String(error) });\n return errorResult(\n `Failed to attach policy: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'rbac_policies_detach')),\n {\n title: 'Detach Policy From Role',\n description:\n 'Detach an OPA policy reference from a role on the chosen gateway. Returns { detached: boolean, roleId, policyId }.',\n inputSchema: {\n roleId: z.string().describe('Role ID'),\n policyId: z.string().describe('PolicyReference ID'),\n layer: LayerEnum.optional().describe('workspace or global (default: workspace)'),\n },\n },\n async ({ roleId, policyId, layer }) => {\n try {\n const targetLayer: Layer = layer ?? 'workspace';\n const data = await clientForLayer(ctx, targetLayer).request<{\n detachPolicyFromRole: boolean;\n }>(DETACH_POLICY, { roleId, policyId });\n return jsonResult({ detached: data.detachPolicyFromRole, roleId, policyId });\n } catch (error) {\n ctx.logger.error('rbac_policies_detach failed', { error: String(error) });\n return errorResult(\n `Failed to detach policy: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'rbac_check')),\n {\n title: 'Check Permission',\n description: 'Check whether an actor has permission for an action on a resource.',\n inputSchema: {\n actorId: z.string().describe('Actor id (user/app/service/super_admin)'),\n action: z.string().describe('Action like read/write/delete'),\n resourceType: z.string().describe('Resource type like project/task'),\n actorType: ActorTypeEnum.optional().describe('Actor type (default: USER)'),\n resourceId: z.string().optional().describe('Specific resource id (optional)'),\n scopeId: z.string().optional().describe('Scope id (workspaceId or tenantId)'),\n layer: LayerEnum.optional().describe('workspace or global (default: workspace)'),\n },\n },\n async ({ actorId, action, resourceType, actorType, resourceId, scopeId, layer }) => {\n try {\n const targetLayer: Layer = layer ?? 'workspace';\n const resolvedScope = scopeId ?? defaultScopeId(ctx, targetLayer);\n if (!resolvedScope) {\n return errorResult(\n `No ${targetLayer} scope. Pass scopeId or authenticate to a workspace/organization.`,\n );\n }\n const input: Record<string, unknown> = {\n actorId,\n actorType: actorType ?? 'USER',\n action,\n resourceType,\n scopeId: resolvedScope,\n };\n if (resourceId !== undefined) input.resourceId = resourceId;\n const data = await clientForLayer(ctx, targetLayer).request<{ checkPermission: unknown }>(\n CHECK_PERMISSION,\n { input },\n );\n return jsonResult(data.checkPermission);\n } catch (error) {\n ctx.logger.error('rbac_check failed', { error: String(error) });\n return errorResult(\n `Failed to check permission: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * RBAC module — role-based access control across workspace + global layers.\n *\n * Tools:\n * <product>_rbac_roles_{list,get,create,update,delete}\n * <product>_rbac_check\n *\n * Backend: ~/products/wspace/rbac/wspace-rbac-svc/, ~/products/global/rbac/global-rbac-svc/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerRbacTools } from './tools.js';\n\nconst rbacModule: McpModule = {\n id: 'rbac',\n version: '0.0.1',\n displayName: 'RBAC',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerRbacTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default rbacModule;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/modules/rbac/tools.ts","../../../src/modules/rbac/index.ts"],"names":[],"mappings":";;;AAKA,SAAS,YACP,MAAA,EACA,QAAA,EACA,OACA,WAAA,EACA,WAAA,EACA,aACA,cAAA,EACM;AACN,EAAA,MAAA,CAAO,YAAA;AAAA,IACL,QAAA;AAAA,IACA;AAAA,MACE,KAAA;AAAA,MACA,WAAA,EAAa,GAAG,WAAW,CAAA,OAAA,CAAA;AAAA,MAC3B;AAAA,KACF;AAAA,IACA,YACE,WAAA;AAAA,MACE,aAAa,WAAW,CAAA,KAAA,EAAQ,cAAA,CAAe,IAAA,CAAK,IAAI,CAAC,CAAA,oHAAA;AAAA;AAC3D,GACJ;AACF;AAEO,SAAS,iBAAA,CACd,MAAA,EACA,IAAA,EACA,KAAA,EACM;AAON,EAAA,MAAM,WAAA,GACJ,mJAAA;AACF,EAAA,MAAM,IAAA,GAAO,CAAC,yDAAyD,CAAA;AAEvE,EA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,SAAA,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,iBAAA,CAAkB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAEpC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,YAAA,GAAQ","file":"index.js","sourcesContent":["import { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { errorResult, mcpToolName, type McpContext } from '../../core/index.js';\n\ntype StubInputSchema = Record<string, z.ZodTypeAny>;\nfunction stubbedTool(\n server: McpServer,\n toolName: string,\n title: string,\n description: string,\n featureNote: string,\n inputSchema: StubInputSchema,\n altSuggestions: string[],\n): void {\n server.registerTool(\n toolName,\n {\n title,\n description: `${description} [STUB]`,\n inputSchema,\n },\n async () =>\n errorResult(\n `[stubbed] ${featureNote} Use ${altSuggestions.join(', ')} instead. The tool remains registered so callers receive a meaningful response instead of a schema-validation error.`,\n ),\n );\n}\n\nexport function registerRbacTools(\n server: McpServer,\n _ctx: McpContext,\n track: (n: string) => string,\n): void {\n // BOFF-8195: `Mutation.attachPolicyToRole` / `detachPolicyFromRole`\n // removed from the live alpha gateway (gateway returned a missing-\n // `@rbac`-directive error). The `rbac_check` and `rbac_policies_list`\n // queries are gone too (`Query.roles` / `Query.policies` do not\n // exist). Whole rbac module unreachable today. Stubs preserve the\n // per-call wiring for the day the service re-exposes the surface.\n const featureNote =\n 'Live alpha removed the rbac policies surface (no `attachPolicyToRole` / `detachPolicyFromRole` mutations; `roles` / `policies` queries are gone).';\n const alts = ['the next alpha release that re-exposes the rbac surface'];\n\n stubbedTool(\n server,\n track(mcpToolName(_ctx.productName, 'rbac_check')),\n 'Check Permission',\n 'Check whether the calling actor has a given permission.',\n featureNote,\n { permission: z.string() },\n alts,\n );\n stubbedTool(\n server,\n track(mcpToolName(_ctx.productName, 'rbac_policies_list')),\n 'List Policy References',\n 'List references to a policy across the system.',\n featureNote,\n { policyId: z.string() },\n alts,\n );\n stubbedTool(\n server,\n track(mcpToolName(_ctx.productName, 'rbac_policies_attach')),\n 'Attach Policy to Role',\n 'Attach a policy to a role.',\n featureNote,\n { roleId: z.string(), policyId: z.string() },\n alts,\n );\n stubbedTool(\n server,\n track(mcpToolName(_ctx.productName, 'rbac_policies_detach')),\n 'Detach Policy from Role',\n 'Detach a policy from a role.',\n featureNote,\n { roleId: z.string(), policyId: z.string() },\n alts,\n );\n stubbedTool(\n server,\n track(mcpToolName(_ctx.productName, 'rbac_roles_list')),\n 'List Roles',\n 'List roles (workspace or global layer).',\n featureNote,\n { layer: z.enum(['workspace', 'global']).optional() },\n alts,\n );\n stubbedTool(\n server,\n track(mcpToolName(_ctx.productName, 'rbac_roles_get')),\n 'Get Role',\n 'Get a role by ID.',\n featureNote,\n { id: z.string() },\n alts,\n );\n stubbedTool(\n server,\n track(mcpToolName(_ctx.productName, 'rbac_roles_create')),\n 'Create Role',\n 'Create a new role.',\n featureNote,\n { name: z.string() },\n alts,\n );\n stubbedTool(\n server,\n track(mcpToolName(_ctx.productName, 'rbac_roles_update')),\n 'Update Role',\n 'Update a role.',\n featureNote,\n { id: z.string() },\n alts,\n );\n stubbedTool(\n server,\n track(mcpToolName(_ctx.productName, 'rbac_roles_delete')),\n 'Delete Role',\n 'Delete a role.',\n featureNote,\n { id: z.string() },\n alts,\n );\n}\n","/**\n * RBAC module — role-based access control across workspace + global layers.\n *\n * Tools:\n * <product>_rbac_roles_{list,get,create,update,delete}\n * <product>_rbac_check\n *\n * Backend: ~/products/wspace/rbac/wspace-rbac-svc/, ~/products/global/rbac/global-rbac-svc/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerRbacTools } from './tools.js';\n\nconst rbacModule: McpModule = {\n id: 'rbac',\n version: '0.0.1',\n displayName: 'RBAC',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerRbacTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default rbacModule;\n"]}
|