@burdenoff/mcp-libs 2026.511.1
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/README.md +76 -0
- package/dist/chunk-4GBVJ4OY.js +847 -0
- package/dist/chunk-4GBVJ4OY.js.map +1 -0
- package/dist/chunk-H2OYWLOA.js +919 -0
- package/dist/chunk-H2OYWLOA.js.map +1 -0
- package/dist/chunk-JFEQYSWM.js +174 -0
- package/dist/chunk-JFEQYSWM.js.map +1 -0
- package/dist/chunk-WWFVD7BO.js +273 -0
- package/dist/chunk-WWFVD7BO.js.map +1 -0
- package/dist/context-1jV4NsLv.d.cts +138 -0
- package/dist/context-1jV4NsLv.d.ts +138 -0
- package/dist/core/index.cjs +953 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +59 -0
- package/dist/core/index.d.ts +59 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -0
- package/dist/http-BP4c721D.d.cts +22 -0
- package/dist/http-DXTeCD5r.d.ts +22 -0
- package/dist/index.cjs +1013 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/module-DBcfA-i3.d.ts +67 -0
- package/dist/module-DFQBZNK6.d.cts +67 -0
- package/dist/modules/auth/index.cjs +533 -0
- package/dist/modules/auth/index.cjs.map +1 -0
- package/dist/modules/auth/index.d.cts +51 -0
- package/dist/modules/auth/index.d.ts +51 -0
- package/dist/modules/auth/index.js +159 -0
- package/dist/modules/auth/index.js.map +1 -0
- package/dist/modules/billing/index.cjs +655 -0
- package/dist/modules/billing/index.cjs.map +1 -0
- package/dist/modules/billing/index.d.cts +8 -0
- package/dist/modules/billing/index.d.ts +8 -0
- package/dist/modules/billing/index.js +606 -0
- package/dist/modules/billing/index.js.map +1 -0
- package/dist/modules/channels/index.cjs +443 -0
- package/dist/modules/channels/index.cjs.map +1 -0
- package/dist/modules/channels/index.d.cts +8 -0
- package/dist/modules/channels/index.d.ts +8 -0
- package/dist/modules/channels/index.js +394 -0
- package/dist/modules/channels/index.js.map +1 -0
- package/dist/modules/conversations/index.cjs +288 -0
- package/dist/modules/conversations/index.cjs.map +1 -0
- package/dist/modules/conversations/index.d.cts +8 -0
- package/dist/modules/conversations/index.d.ts +8 -0
- package/dist/modules/conversations/index.js +239 -0
- package/dist/modules/conversations/index.js.map +1 -0
- package/dist/modules/devportal/index.cjs +796 -0
- package/dist/modules/devportal/index.cjs.map +1 -0
- package/dist/modules/devportal/index.d.cts +8 -0
- package/dist/modules/devportal/index.d.ts +8 -0
- package/dist/modules/devportal/index.js +747 -0
- package/dist/modules/devportal/index.js.map +1 -0
- package/dist/modules/export/index.cjs +333 -0
- package/dist/modules/export/index.cjs.map +1 -0
- package/dist/modules/export/index.d.cts +8 -0
- package/dist/modules/export/index.d.ts +8 -0
- package/dist/modules/export/index.js +284 -0
- package/dist/modules/export/index.js.map +1 -0
- package/dist/modules/files/index.cjs +278 -0
- package/dist/modules/files/index.cjs.map +1 -0
- package/dist/modules/files/index.d.cts +8 -0
- package/dist/modules/files/index.d.ts +8 -0
- package/dist/modules/files/index.js +229 -0
- package/dist/modules/files/index.js.map +1 -0
- package/dist/modules/groups/index.cjs +451 -0
- package/dist/modules/groups/index.cjs.map +1 -0
- package/dist/modules/groups/index.d.cts +8 -0
- package/dist/modules/groups/index.d.ts +8 -0
- package/dist/modules/groups/index.js +402 -0
- package/dist/modules/groups/index.js.map +1 -0
- package/dist/modules/health/index.cjs +159 -0
- package/dist/modules/health/index.cjs.map +1 -0
- package/dist/modules/health/index.d.cts +8 -0
- package/dist/modules/health/index.d.ts +8 -0
- package/dist/modules/health/index.js +36 -0
- package/dist/modules/health/index.js.map +1 -0
- package/dist/modules/integrations/index.cjs +316 -0
- package/dist/modules/integrations/index.cjs.map +1 -0
- package/dist/modules/integrations/index.d.cts +8 -0
- package/dist/modules/integrations/index.d.ts +8 -0
- package/dist/modules/integrations/index.js +267 -0
- package/dist/modules/integrations/index.js.map +1 -0
- package/dist/modules/notifications/index.cjs +222 -0
- package/dist/modules/notifications/index.cjs.map +1 -0
- package/dist/modules/notifications/index.d.cts +8 -0
- package/dist/modules/notifications/index.d.ts +8 -0
- package/dist/modules/notifications/index.js +173 -0
- package/dist/modules/notifications/index.js.map +1 -0
- package/dist/modules/organizations/index.cjs +267 -0
- package/dist/modules/organizations/index.cjs.map +1 -0
- package/dist/modules/organizations/index.d.cts +8 -0
- package/dist/modules/organizations/index.d.ts +8 -0
- package/dist/modules/organizations/index.js +218 -0
- package/dist/modules/organizations/index.js.map +1 -0
- package/dist/modules/products/index.cjs +736 -0
- package/dist/modules/products/index.cjs.map +1 -0
- package/dist/modules/products/index.d.cts +8 -0
- package/dist/modules/products/index.d.ts +8 -0
- package/dist/modules/products/index.js +687 -0
- package/dist/modules/products/index.js.map +1 -0
- package/dist/modules/rbac/index.cjs +378 -0
- package/dist/modules/rbac/index.cjs.map +1 -0
- package/dist/modules/rbac/index.d.cts +8 -0
- package/dist/modules/rbac/index.d.ts +8 -0
- package/dist/modules/rbac/index.js +329 -0
- package/dist/modules/rbac/index.js.map +1 -0
- package/dist/modules/sandbox/index.cjs +318 -0
- package/dist/modules/sandbox/index.cjs.map +1 -0
- package/dist/modules/sandbox/index.d.cts +8 -0
- package/dist/modules/sandbox/index.d.ts +8 -0
- package/dist/modules/sandbox/index.js +225 -0
- package/dist/modules/sandbox/index.js.map +1 -0
- package/dist/modules/scheduler/index.cjs +267 -0
- package/dist/modules/scheduler/index.cjs.map +1 -0
- package/dist/modules/scheduler/index.d.cts +8 -0
- package/dist/modules/scheduler/index.d.ts +8 -0
- package/dist/modules/scheduler/index.js +218 -0
- package/dist/modules/scheduler/index.js.map +1 -0
- package/dist/modules/security/index.cjs +529 -0
- package/dist/modules/security/index.cjs.map +1 -0
- package/dist/modules/security/index.d.cts +8 -0
- package/dist/modules/security/index.d.ts +8 -0
- package/dist/modules/security/index.js +480 -0
- package/dist/modules/security/index.js.map +1 -0
- package/dist/modules/store/index.cjs +450 -0
- package/dist/modules/store/index.cjs.map +1 -0
- package/dist/modules/store/index.d.cts +8 -0
- package/dist/modules/store/index.d.ts +8 -0
- package/dist/modules/store/index.js +401 -0
- package/dist/modules/store/index.js.map +1 -0
- package/dist/modules/support/index.cjs +285 -0
- package/dist/modules/support/index.cjs.map +1 -0
- package/dist/modules/support/index.d.cts +8 -0
- package/dist/modules/support/index.d.ts +8 -0
- package/dist/modules/support/index.js +236 -0
- package/dist/modules/support/index.js.map +1 -0
- package/dist/modules/tags/index.cjs +421 -0
- package/dist/modules/tags/index.cjs.map +1 -0
- package/dist/modules/tags/index.d.cts +8 -0
- package/dist/modules/tags/index.d.ts +8 -0
- package/dist/modules/tags/index.js +372 -0
- package/dist/modules/tags/index.js.map +1 -0
- package/dist/modules/tours/index.cjs +225 -0
- package/dist/modules/tours/index.cjs.map +1 -0
- package/dist/modules/tours/index.d.cts +8 -0
- package/dist/modules/tours/index.d.ts +8 -0
- package/dist/modules/tours/index.js +176 -0
- package/dist/modules/tours/index.js.map +1 -0
- package/dist/modules/vibecontrols/index.cjs +5551 -0
- package/dist/modules/vibecontrols/index.cjs.map +1 -0
- package/dist/modules/vibecontrols/index.d.cts +8 -0
- package/dist/modules/vibecontrols/index.d.ts +8 -0
- package/dist/modules/vibecontrols/index.js +4380 -0
- package/dist/modules/vibecontrols/index.js.map +1 -0
- package/dist/modules/workspaces/index.cjs +552 -0
- package/dist/modules/workspaces/index.cjs.map +1 -0
- package/dist/modules/workspaces/index.d.cts +8 -0
- package/dist/modules/workspaces/index.d.ts +8 -0
- package/dist/modules/workspaces/index.js +503 -0
- package/dist/modules/workspaces/index.js.map +1 -0
- package/dist/tool-name-CQf_IqAj.d.cts +47 -0
- package/dist/tool-name-DlnrBsZ6.d.ts +47 -0
- package/dist/transports/index.cjs +183 -0
- package/dist/transports/index.cjs.map +1 -0
- package/dist/transports/index.d.cts +13 -0
- package/dist/transports/index.d.ts +13 -0
- package/dist/transports/index.js +3 -0
- package/dist/transports/index.js.map +1 -0
- package/package.json +125 -0
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
require('graphql-request');
|
|
5
|
+
require('cross-fetch');
|
|
6
|
+
require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
7
|
+
require('@modelcontextprotocol/sdk/types.js');
|
|
8
|
+
|
|
9
|
+
// src/modules/workspaces/tools.ts
|
|
10
|
+
|
|
11
|
+
// src/core/errors.ts
|
|
12
|
+
var McpInternalError = class extends Error {
|
|
13
|
+
cause;
|
|
14
|
+
constructor(message, cause) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = "McpInternalError";
|
|
17
|
+
this.cause = cause;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// src/core/result.ts
|
|
22
|
+
function jsonResult(data, structured) {
|
|
23
|
+
const result = {
|
|
24
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
25
|
+
};
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
function errorResult(message, hint) {
|
|
29
|
+
const text = hint ? `${message}
|
|
30
|
+
|
|
31
|
+
Hint: ${hint}` : message;
|
|
32
|
+
return { content: [{ type: "text", text }], isError: true };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/core/tool-name.ts
|
|
36
|
+
var MAX_TOOL_NAME_LENGTH = 63;
|
|
37
|
+
function assertSafeName(name, kind) {
|
|
38
|
+
if (name.length > MAX_TOOL_NAME_LENGTH) {
|
|
39
|
+
throw new McpInternalError(
|
|
40
|
+
`Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return name;
|
|
44
|
+
}
|
|
45
|
+
function mcpToolName(productName, ...parts) {
|
|
46
|
+
if (!productName) {
|
|
47
|
+
throw new McpInternalError("mcpToolName: productName is required");
|
|
48
|
+
}
|
|
49
|
+
const name = [productName, ...parts].filter(Boolean).join("_");
|
|
50
|
+
return assertSafeName(name);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/modules/workspaces/operations.ts
|
|
54
|
+
var GET_WORKSPACE = `
|
|
55
|
+
query GetWorkspace($id: ID!) {
|
|
56
|
+
workspace(id: $id) {
|
|
57
|
+
id name slug description tenantId organizationId status createdAt updatedAt
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
var CREATE_WORKSPACE = `
|
|
62
|
+
mutation CreateWorkspace($input: CreateWorkspaceInput!) {
|
|
63
|
+
createWorkspace(input: $input) {
|
|
64
|
+
id name slug status createdAt
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
var UPDATE_WORKSPACE = `
|
|
69
|
+
mutation UpdateWorkspace($id: ID!, $input: UpdateWorkspaceInput!) {
|
|
70
|
+
updateWorkspace(id: $id, input: $input) {
|
|
71
|
+
id name description status updatedAt
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
var DELETE_WORKSPACE = `
|
|
76
|
+
mutation DeleteWorkspace($id: ID!) {
|
|
77
|
+
deleteWorkspace(id: $id)
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
var LIST_WORKSPACE_MEMBERS = `
|
|
81
|
+
query ListWorkspaceMembers($workspaceId: ID!, $pagination: PaginationInput) {
|
|
82
|
+
workspaceMembers(workspaceId: $workspaceId, pagination: $pagination) {
|
|
83
|
+
items { id userId email role status joinedAt }
|
|
84
|
+
total hasMore
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
var ADD_WORKSPACE_MEMBER = `
|
|
89
|
+
mutation AddWorkspaceMember($input: AddWorkspaceMemberInput!) {
|
|
90
|
+
addWorkspaceMember(input: $input) {
|
|
91
|
+
id userId role status
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
var REMOVE_WORKSPACE_MEMBER = `
|
|
96
|
+
mutation RemoveWorkspaceMember($id: ID!) {
|
|
97
|
+
removeWorkspaceMember(id: $id)
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
var UPDATE_WORKSPACE_MEMBER_ROLES = `
|
|
101
|
+
mutation UpdateWorkspaceMemberRoles($input: UpdateWorkspaceMemberRolesInput!) {
|
|
102
|
+
updateWorkspaceMemberRoles(input: $input) {
|
|
103
|
+
id userId role
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
107
|
+
var LIST_PROJECTS = `
|
|
108
|
+
query ListProjects($filter: ProjectFilterInput, $pagination: PaginationInput) {
|
|
109
|
+
projects(filter: $filter, pagination: $pagination) {
|
|
110
|
+
items { id name workspaceId status createdAt }
|
|
111
|
+
total hasMore
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
var GET_PROJECT = `
|
|
116
|
+
query GetProject($id: ID!) {
|
|
117
|
+
project(id: $id) {
|
|
118
|
+
id name description workspaceId status createdAt updatedAt
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
var CREATE_PROJECT = `
|
|
123
|
+
mutation CreateProject($input: CreateProjectInput!) {
|
|
124
|
+
createProject(input: $input) {
|
|
125
|
+
id name workspaceId status
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
`;
|
|
129
|
+
var ACCEPT_INVITATION = `
|
|
130
|
+
mutation AcceptInvitation($id: ID!) {
|
|
131
|
+
acceptInvitation(id: $id) {
|
|
132
|
+
id status workspaceId
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
var WORKSPACE_ACTIVITY = `
|
|
137
|
+
query WorkspaceActivity($workspaceId: ID!, $limit: Int, $offset: Int) {
|
|
138
|
+
getWorkspaceActivities(workspaceId: $workspaceId, limit: $limit, offset: $offset) {
|
|
139
|
+
id action actorId summary createdAt
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
|
|
144
|
+
// src/modules/workspaces/tools.ts
|
|
145
|
+
var RoleEnum = zod.z.enum(["MEMBER", "ADMIN", "OWNER"]);
|
|
146
|
+
function registerWorkspaceTools(server, ctx, track) {
|
|
147
|
+
server.registerTool(
|
|
148
|
+
track(mcpToolName(ctx.productName, "workspace_current")),
|
|
149
|
+
{
|
|
150
|
+
title: "Current Workspace",
|
|
151
|
+
description: "Inspect the workspace currently bound to this MCP session (workspace ID, organization ID, and whether a workspace token is held).",
|
|
152
|
+
inputSchema: {}
|
|
153
|
+
},
|
|
154
|
+
async () => {
|
|
155
|
+
try {
|
|
156
|
+
const auth = ctx.auth.read();
|
|
157
|
+
const wid = auth?.workspaceId ?? null;
|
|
158
|
+
if (!wid) {
|
|
159
|
+
return jsonResult({
|
|
160
|
+
workspaceId: null,
|
|
161
|
+
organizationId: null,
|
|
162
|
+
hasWorkspaceToken: false,
|
|
163
|
+
message: "No workspace selected. Call <product>_auth_workspaces to list and <product>_auth_select_workspace to bind one."
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return jsonResult({
|
|
167
|
+
workspaceId: wid,
|
|
168
|
+
organizationId: auth?.organizationId ?? null,
|
|
169
|
+
hasWorkspaceToken: Boolean(auth?.workspaceToken)
|
|
170
|
+
});
|
|
171
|
+
} catch (error) {
|
|
172
|
+
ctx.logger.error("workspace_current failed", { error: String(error) });
|
|
173
|
+
return errorResult(
|
|
174
|
+
`Failed to read workspace context: ${error instanceof Error ? error.message : String(error)}`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
server.registerTool(
|
|
180
|
+
track(mcpToolName(ctx.productName, "workspace_get")),
|
|
181
|
+
{
|
|
182
|
+
title: "Get Workspace",
|
|
183
|
+
description: "Get a workspace by its ID (global layer).",
|
|
184
|
+
inputSchema: { id: zod.z.string().describe("Workspace ID") }
|
|
185
|
+
},
|
|
186
|
+
async ({ id }) => {
|
|
187
|
+
try {
|
|
188
|
+
const data = await ctx.gql.global.request(
|
|
189
|
+
GET_WORKSPACE,
|
|
190
|
+
{ id }
|
|
191
|
+
);
|
|
192
|
+
if (!data.workspace) {
|
|
193
|
+
return errorResult(`Workspace ${id} not found`);
|
|
194
|
+
}
|
|
195
|
+
return jsonResult(data.workspace);
|
|
196
|
+
} catch (error) {
|
|
197
|
+
ctx.logger.error("workspace_get failed", { error: String(error) });
|
|
198
|
+
return errorResult(
|
|
199
|
+
`Failed to get workspace: ${error instanceof Error ? error.message : String(error)}`
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
server.registerTool(
|
|
205
|
+
track(mcpToolName(ctx.productName, "workspace_create")),
|
|
206
|
+
{
|
|
207
|
+
title: "Create Workspace",
|
|
208
|
+
description: "Create a workspace (global layer).",
|
|
209
|
+
inputSchema: {
|
|
210
|
+
name: zod.z.string().describe("Workspace name"),
|
|
211
|
+
description: zod.z.string().optional().describe("Workspace description"),
|
|
212
|
+
tenantId: zod.z.string().optional().describe("Target tenant id"),
|
|
213
|
+
organizationId: zod.z.string().optional().describe("Owning organization id"),
|
|
214
|
+
slug: zod.z.string().optional().describe("URL-friendly slug")
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
async ({ name, description, tenantId, organizationId, slug }) => {
|
|
218
|
+
try {
|
|
219
|
+
const input = { name };
|
|
220
|
+
if (description !== void 0) input.description = description;
|
|
221
|
+
if (tenantId !== void 0) input.tenantId = tenantId;
|
|
222
|
+
if (organizationId !== void 0) input.organizationId = organizationId;
|
|
223
|
+
if (slug !== void 0) input.slug = slug;
|
|
224
|
+
const data = await ctx.gql.global.request(
|
|
225
|
+
CREATE_WORKSPACE,
|
|
226
|
+
{ input }
|
|
227
|
+
);
|
|
228
|
+
return jsonResult(data.createWorkspace);
|
|
229
|
+
} catch (error) {
|
|
230
|
+
ctx.logger.error("workspace_create failed", { error: String(error) });
|
|
231
|
+
return errorResult(
|
|
232
|
+
`Failed to create workspace: ${error instanceof Error ? error.message : String(error)}`
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
server.registerTool(
|
|
238
|
+
track(mcpToolName(ctx.productName, "workspace_update")),
|
|
239
|
+
{
|
|
240
|
+
title: "Update Workspace",
|
|
241
|
+
description: "Update a workspace (global layer). At least one field must be provided.",
|
|
242
|
+
inputSchema: {
|
|
243
|
+
id: zod.z.string().describe("Workspace ID"),
|
|
244
|
+
name: zod.z.string().optional().describe("Updated name"),
|
|
245
|
+
description: zod.z.string().optional().describe("Updated description"),
|
|
246
|
+
status: zod.z.string().optional().describe("Updated status (will be uppercased)")
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
async ({ id, name, description, status }) => {
|
|
250
|
+
try {
|
|
251
|
+
const input = {};
|
|
252
|
+
if (name !== void 0) input.name = name;
|
|
253
|
+
if (description !== void 0) input.description = description;
|
|
254
|
+
if (status !== void 0) input.status = status.toUpperCase();
|
|
255
|
+
if (Object.keys(input).length === 0) {
|
|
256
|
+
return errorResult(
|
|
257
|
+
"No updates specified \u2014 provide at least one of name/description/status"
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
const data = await ctx.gql.global.request(
|
|
261
|
+
UPDATE_WORKSPACE,
|
|
262
|
+
{ id, input }
|
|
263
|
+
);
|
|
264
|
+
return jsonResult(data.updateWorkspace);
|
|
265
|
+
} catch (error) {
|
|
266
|
+
ctx.logger.error("workspace_update failed", { error: String(error) });
|
|
267
|
+
return errorResult(
|
|
268
|
+
`Failed to update workspace: ${error instanceof Error ? error.message : String(error)}`
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
server.registerTool(
|
|
274
|
+
track(mcpToolName(ctx.productName, "workspace_delete")),
|
|
275
|
+
{
|
|
276
|
+
title: "Delete Workspace",
|
|
277
|
+
description: "Delete a workspace (workspace layer).",
|
|
278
|
+
inputSchema: { id: zod.z.string().describe("Workspace ID") }
|
|
279
|
+
},
|
|
280
|
+
async ({ id }) => {
|
|
281
|
+
try {
|
|
282
|
+
const data = await ctx.gql.workspace.request(
|
|
283
|
+
DELETE_WORKSPACE,
|
|
284
|
+
{ id }
|
|
285
|
+
);
|
|
286
|
+
return jsonResult({ deleted: data.deleteWorkspace, workspaceId: id });
|
|
287
|
+
} catch (error) {
|
|
288
|
+
ctx.logger.error("workspace_delete failed", { error: String(error) });
|
|
289
|
+
return errorResult(
|
|
290
|
+
`Failed to delete workspace: ${error instanceof Error ? error.message : String(error)}`
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
server.registerTool(
|
|
296
|
+
track(mcpToolName(ctx.productName, "workspace_members_list")),
|
|
297
|
+
{
|
|
298
|
+
title: "List Workspace Members",
|
|
299
|
+
description: "List members of a workspace.",
|
|
300
|
+
inputSchema: {
|
|
301
|
+
workspaceId: zod.z.string().describe("Workspace ID"),
|
|
302
|
+
limit: zod.z.number().optional().describe("Page size (default 100)"),
|
|
303
|
+
offset: zod.z.number().optional().describe("Offset for pagination")
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
async ({ workspaceId, limit, offset }) => {
|
|
307
|
+
try {
|
|
308
|
+
const data = await ctx.gql.workspace.request(LIST_WORKSPACE_MEMBERS, {
|
|
309
|
+
workspaceId,
|
|
310
|
+
pagination: { limit: limit ?? 100, offset: offset ?? 0 }
|
|
311
|
+
});
|
|
312
|
+
return jsonResult(data.workspaceMembers);
|
|
313
|
+
} catch (error) {
|
|
314
|
+
ctx.logger.error("workspace_members_list failed", { error: String(error) });
|
|
315
|
+
return errorResult(
|
|
316
|
+
`Failed to list workspace members: ${error instanceof Error ? error.message : String(error)}`
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
server.registerTool(
|
|
322
|
+
track(mcpToolName(ctx.productName, "workspace_members_add")),
|
|
323
|
+
{
|
|
324
|
+
title: "Add Workspace Member",
|
|
325
|
+
description: "Add a member to a workspace.",
|
|
326
|
+
inputSchema: {
|
|
327
|
+
workspaceId: zod.z.string().describe("Workspace ID"),
|
|
328
|
+
userId: zod.z.string().describe("User ID to add"),
|
|
329
|
+
role: RoleEnum.optional().describe("Membership role (default MEMBER)")
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
async ({ workspaceId, userId, role }) => {
|
|
333
|
+
try {
|
|
334
|
+
const input = {
|
|
335
|
+
workspaceId,
|
|
336
|
+
userId,
|
|
337
|
+
role: role ?? "MEMBER"
|
|
338
|
+
};
|
|
339
|
+
const data = await ctx.gql.workspace.request(
|
|
340
|
+
ADD_WORKSPACE_MEMBER,
|
|
341
|
+
{ input }
|
|
342
|
+
);
|
|
343
|
+
return jsonResult(data.addWorkspaceMember);
|
|
344
|
+
} catch (error) {
|
|
345
|
+
ctx.logger.error("workspace_members_add failed", { error: String(error) });
|
|
346
|
+
return errorResult(
|
|
347
|
+
`Failed to add workspace member: ${error instanceof Error ? error.message : String(error)}`
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
server.registerTool(
|
|
353
|
+
track(mcpToolName(ctx.productName, "workspace_members_remove")),
|
|
354
|
+
{
|
|
355
|
+
title: "Remove Workspace Member",
|
|
356
|
+
description: "Remove a member by membership id.",
|
|
357
|
+
inputSchema: { membershipId: zod.z.string().describe("Membership ID to remove") }
|
|
358
|
+
},
|
|
359
|
+
async ({ membershipId }) => {
|
|
360
|
+
try {
|
|
361
|
+
const data = await ctx.gql.workspace.request(
|
|
362
|
+
REMOVE_WORKSPACE_MEMBER,
|
|
363
|
+
{ id: membershipId }
|
|
364
|
+
);
|
|
365
|
+
return jsonResult({ removed: data.removeWorkspaceMember, membershipId });
|
|
366
|
+
} catch (error) {
|
|
367
|
+
ctx.logger.error("workspace_members_remove failed", { error: String(error) });
|
|
368
|
+
return errorResult(
|
|
369
|
+
`Failed to remove workspace member: ${error instanceof Error ? error.message : String(error)}`
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
server.registerTool(
|
|
375
|
+
track(mcpToolName(ctx.productName, "workspace_members_role")),
|
|
376
|
+
{
|
|
377
|
+
title: "Update Workspace Member Role",
|
|
378
|
+
description: "Update a workspace member role.",
|
|
379
|
+
inputSchema: {
|
|
380
|
+
workspaceId: zod.z.string().describe("Workspace ID"),
|
|
381
|
+
userId: zod.z.string().describe("User ID"),
|
|
382
|
+
role: RoleEnum.describe("New role")
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
async ({ workspaceId, userId, role }) => {
|
|
386
|
+
try {
|
|
387
|
+
const input = {
|
|
388
|
+
workspaceId,
|
|
389
|
+
userId,
|
|
390
|
+
roles: [role]
|
|
391
|
+
};
|
|
392
|
+
const data = await ctx.gql.workspace.request(UPDATE_WORKSPACE_MEMBER_ROLES, { input });
|
|
393
|
+
return jsonResult(data.updateWorkspaceMemberRoles);
|
|
394
|
+
} catch (error) {
|
|
395
|
+
ctx.logger.error("workspace_members_role failed", { error: String(error) });
|
|
396
|
+
return errorResult(
|
|
397
|
+
`Failed to update workspace member role: ${error instanceof Error ? error.message : String(error)}`
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
);
|
|
402
|
+
server.registerTool(
|
|
403
|
+
track(mcpToolName(ctx.productName, "workspace_projects_list")),
|
|
404
|
+
{
|
|
405
|
+
title: "List Projects",
|
|
406
|
+
description: "List projects, optionally filtered by workspace.",
|
|
407
|
+
inputSchema: {
|
|
408
|
+
workspaceId: zod.z.string().optional().describe("Filter by workspace ID"),
|
|
409
|
+
limit: zod.z.number().optional().describe("Page size (default 100)"),
|
|
410
|
+
offset: zod.z.number().optional().describe("Offset for pagination")
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
async ({ workspaceId, limit, offset }) => {
|
|
414
|
+
try {
|
|
415
|
+
const filter = {};
|
|
416
|
+
if (workspaceId !== void 0) filter.workspaceId = workspaceId;
|
|
417
|
+
const data = await ctx.gql.workspace.request(LIST_PROJECTS, {
|
|
418
|
+
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
419
|
+
pagination: { limit: limit ?? 100, offset: offset ?? 0 }
|
|
420
|
+
});
|
|
421
|
+
return jsonResult(data.projects);
|
|
422
|
+
} catch (error) {
|
|
423
|
+
ctx.logger.error("workspace_projects_list failed", { error: String(error) });
|
|
424
|
+
return errorResult(
|
|
425
|
+
`Failed to list projects: ${error instanceof Error ? error.message : String(error)}`
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
);
|
|
430
|
+
server.registerTool(
|
|
431
|
+
track(mcpToolName(ctx.productName, "workspace_projects_get")),
|
|
432
|
+
{
|
|
433
|
+
title: "Get Project",
|
|
434
|
+
description: "Get a project by ID.",
|
|
435
|
+
inputSchema: { id: zod.z.string().describe("Project ID") }
|
|
436
|
+
},
|
|
437
|
+
async ({ id }) => {
|
|
438
|
+
try {
|
|
439
|
+
const data = await ctx.gql.workspace.request(
|
|
440
|
+
GET_PROJECT,
|
|
441
|
+
{ id }
|
|
442
|
+
);
|
|
443
|
+
if (!data.project) {
|
|
444
|
+
return errorResult(`Project ${id} not found`);
|
|
445
|
+
}
|
|
446
|
+
return jsonResult(data.project);
|
|
447
|
+
} catch (error) {
|
|
448
|
+
ctx.logger.error("workspace_projects_get failed", { error: String(error) });
|
|
449
|
+
return errorResult(
|
|
450
|
+
`Failed to get project: ${error instanceof Error ? error.message : String(error)}`
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
);
|
|
455
|
+
server.registerTool(
|
|
456
|
+
track(mcpToolName(ctx.productName, "workspace_projects_create")),
|
|
457
|
+
{
|
|
458
|
+
title: "Create Project",
|
|
459
|
+
description: "Create a project inside a workspace.",
|
|
460
|
+
inputSchema: {
|
|
461
|
+
workspaceId: zod.z.string().describe("Workspace ID"),
|
|
462
|
+
name: zod.z.string().describe("Project name"),
|
|
463
|
+
description: zod.z.string().optional().describe("Project description")
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
async ({ workspaceId, name, description }) => {
|
|
467
|
+
try {
|
|
468
|
+
const input = { workspaceId, name };
|
|
469
|
+
if (description !== void 0) input.description = description;
|
|
470
|
+
const data = await ctx.gql.workspace.request(
|
|
471
|
+
CREATE_PROJECT,
|
|
472
|
+
{ input }
|
|
473
|
+
);
|
|
474
|
+
return jsonResult(data.createProject);
|
|
475
|
+
} catch (error) {
|
|
476
|
+
ctx.logger.error("workspace_projects_create failed", { error: String(error) });
|
|
477
|
+
return errorResult(
|
|
478
|
+
`Failed to create project: ${error instanceof Error ? error.message : String(error)}`
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
);
|
|
483
|
+
server.registerTool(
|
|
484
|
+
track(mcpToolName(ctx.productName, "workspace_invite_accept")),
|
|
485
|
+
{
|
|
486
|
+
title: "Accept Workspace Invitation",
|
|
487
|
+
description: "Accept a workspace invitation by invitation ID.",
|
|
488
|
+
inputSchema: { invitationId: zod.z.string().describe("Invitation ID") }
|
|
489
|
+
},
|
|
490
|
+
async ({ invitationId }) => {
|
|
491
|
+
try {
|
|
492
|
+
const data = await ctx.gql.workspace.request(ACCEPT_INVITATION, { id: invitationId });
|
|
493
|
+
return jsonResult(data.acceptInvitation);
|
|
494
|
+
} catch (error) {
|
|
495
|
+
ctx.logger.error("workspace_invite_accept failed", { error: String(error) });
|
|
496
|
+
return errorResult(
|
|
497
|
+
`Failed to accept invitation: ${error instanceof Error ? error.message : String(error)}`
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
server.registerTool(
|
|
503
|
+
track(mcpToolName(ctx.productName, "workspace_activity")),
|
|
504
|
+
{
|
|
505
|
+
title: "Workspace Activity Log",
|
|
506
|
+
description: "Workspace activity log (audit events) for a given workspace.",
|
|
507
|
+
inputSchema: {
|
|
508
|
+
workspaceId: zod.z.string().describe("Workspace ID"),
|
|
509
|
+
limit: zod.z.number().optional().describe("Page size (default 100)"),
|
|
510
|
+
offset: zod.z.number().optional().describe("Offset for pagination")
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
async ({ workspaceId, limit, offset }) => {
|
|
514
|
+
try {
|
|
515
|
+
const data = await ctx.gql.workspace.request(WORKSPACE_ACTIVITY, {
|
|
516
|
+
workspaceId,
|
|
517
|
+
limit: limit ?? 100,
|
|
518
|
+
offset: offset ?? 0
|
|
519
|
+
});
|
|
520
|
+
return jsonResult(data.getWorkspaceActivities);
|
|
521
|
+
} catch (error) {
|
|
522
|
+
ctx.logger.error("workspace_activity failed", { error: String(error) });
|
|
523
|
+
return errorResult(
|
|
524
|
+
`Failed to fetch workspace activity: ${error instanceof Error ? error.message : String(error)}`
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// src/modules/workspaces/index.ts
|
|
532
|
+
var workspacesModule = {
|
|
533
|
+
id: "workspaces",
|
|
534
|
+
version: "0.0.1",
|
|
535
|
+
displayName: "Workspaces",
|
|
536
|
+
dependsOn: ["auth"],
|
|
537
|
+
capabilities: { tools: {} },
|
|
538
|
+
register(server, ctx) {
|
|
539
|
+
const tools = [];
|
|
540
|
+
const track = (n) => {
|
|
541
|
+
tools.push(n);
|
|
542
|
+
return n;
|
|
543
|
+
};
|
|
544
|
+
registerWorkspaceTools(server, ctx, track);
|
|
545
|
+
return { tools, resources: [], prompts: [] };
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
var workspaces_default = workspacesModule;
|
|
549
|
+
|
|
550
|
+
module.exports = workspaces_default;
|
|
551
|
+
//# sourceMappingURL=index.cjs.map
|
|
552
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/result.ts","../../../src/core/tool-name.ts","../../../src/modules/workspaces/operations.ts","../../../src/modules/workspaces/tools.ts","../../../src/modules/workspaces/index.ts"],"names":["z"],"mappings":";;;;;;;;;;;AA8BO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EACjB,KAAA;AAAA,EAEzB,WAAA,CAAY,SAAiB,KAAA,EAAiB;AAC5C,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf;AACF,CAAA;;;ACCO,SAAS,UAAA,CAAW,MAAe,UAAA,EAAkD;AAC1F,EAAA,MAAM,MAAA,GAAqB;AAAA,IACzB,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,IAAA,EAAM,IAAA,EAAM,CAAC,CAAA,EAAG;AAAA,GACjE;AAIA,EAAA,OAAO,MAAA;AACT;AAaO,SAAS,WAAA,CAAY,SAAiB,IAAA,EAA2B;AACtE,EAAA,MAAM,IAAA,GAAO,IAAA,GAAO,CAAA,EAAG,OAAO;;AAAA,MAAA,EAAa,IAAI,CAAA,CAAA,GAAK,OAAA;AACpD,EAAA,OAAO,EAAE,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,QAAQ,IAAA,EAAM,CAAA,EAAG,OAAA,EAAS,IAAA,EAAK;AAC5D;;;ACnDA,IAAM,oBAAA,GAAuB,EAAA;AAE7B,SAAS,cAAA,CAAe,MAAc,IAAA,EAA8C;AAClF,EAAA,IAAuB,IAAA,CAAK,MAAA,GAAS,oBAAA,EAAsB;AACzD,IAAA,MAAM,IAAI,gBAAA;AAAA,MACR,CAAA,WA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,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,kBAAA,GAAQ","file":"index.cjs","sourcesContent":["/**\n * Error classes for MCP SDK.\n *\n * Modules MUST throw these instead of throwing raw Errors. The registerTool\n * wrapper in result.ts catches and maps them to MCP-protocol-compliant\n * `{ isError: true, content: [...] }` responses.\n *\n * Throwing past the wrapper to the protocol surfaces as JSON-RPC -32603 to\n * the client and is a protocol bug.\n */\n\nexport class McpUserError extends Error {\n public readonly hint: string | undefined;\n\n constructor(message: string, opts?: { hint?: string }) {\n super(message);\n this.name = 'McpUserError';\n this.hint = opts?.hint;\n }\n}\n\nexport class McpAuthError extends McpUserError {\n constructor(message: string, opts?: { hint?: string }) {\n super(message, {\n hint: opts?.hint ?? 'Run the auth_login tool to authenticate.',\n });\n this.name = 'McpAuthError';\n }\n}\n\nexport class McpInternalError extends Error {\n public override readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'McpInternalError';\n this.cause = cause;\n }\n}\n","/**\n * MCP tool result helpers + central handler.\n *\n * Modules NEVER call server.registerTool directly — they use registerTool()\n * from this module so the central try/catch wraps the handler and:\n * - maps thrown McpUserError / McpAuthError / McpInternalError to\n * MCP-protocol-compliant `{ isError: true, content: [...] }` shapes\n * - threads `_meta.progressToken` into ctx.progress for long ops\n * - emits a structured log line on every error\n * - never leaks `cause` from McpInternalError to the client\n *\n * This is the analog of cli-sdk's createProgram() central error handler.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ZodRawShape } from 'zod';\nimport type { McpContext } from './context.js';\nimport { McpAuthError, McpInternalError, McpUserError } from './errors.js';\n\nexport interface ToolTextContent {\n type: 'text';\n text: string;\n [k: string]: unknown;\n}\n\nexport interface ToolResult {\n content: ToolTextContent[];\n isError?: boolean;\n structuredContent?: Record<string, unknown>;\n [k: string]: unknown;\n}\n\nexport interface ToolMeta {\n progressToken?: string | number;\n}\n\n/**\n * Build a successful tool result with JSON content (pretty-printed).\n */\nexport function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult {\n const result: ToolResult = {\n content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],\n };\n if (structured !== undefined) {\n result.structuredContent = structured;\n }\n return result;\n}\n\n/**\n * Build a successful tool result with plain text content.\n */\nexport function textResult(text: string): ToolResult {\n return { content: [{ type: 'text', text }] };\n}\n\n/**\n * Build an error tool result. Honors MCP's `{ isError: true, content }` shape.\n * Optional hint is appended on a new line so the LLM can react.\n */\nexport function errorResult(message: string, hint?: string): ToolResult {\n const text = hint ? `${message}\\n\\nHint: ${hint}` : message;\n return { content: [{ type: 'text', text }], isError: true };\n}\n\nexport interface ToolMetadata {\n title: string;\n description: string;\n inputSchema?: ZodRawShape;\n}\n\nexport type ToolHandler<TArgs = Record<string, unknown>> = (\n args: TArgs,\n ctx: McpContext,\n meta: ToolMeta,\n) => Promise<unknown>;\n\n/**\n * Register a tool with the central error wrapper.\n *\n * The handler returns a plain value or void. The wrapper:\n * - wraps non-undefined returns in jsonResult()\n * - if the value already looks like a ToolResult (has `content`), passes through\n * - catches McpAuthError / McpUserError / McpInternalError / generic Error\n * - logs every error via ctx.logger.error\n */\nexport function registerTool<TArgs extends Record<string, unknown>>(\n server: McpServer,\n ctx: McpContext,\n name: string,\n metadata: ToolMetadata,\n handler: ToolHandler<TArgs>,\n): void {\n const sdkConfig = {\n title: metadata.title,\n description: metadata.description,\n ...(metadata.inputSchema ? { inputSchema: metadata.inputSchema } : {}),\n };\n\n // The MCP SDK's registerTool signature is `(name, config, handler)`. The\n // handler arity depends on whether inputSchema is present (1-arg without,\n // 2-arg with). We accept a unified handler shape and dispatch at runtime.\n // The SDK's typing is strict and conditional on the inputSchema generic;\n // bypass with a cast since runtime acceptance is unconditional.\n const wrapped = async (...callbackArgs: unknown[]): Promise<ToolResult> => {\n const hasArgs = callbackArgs.length === 2;\n const args = (hasArgs ? callbackArgs[0] : {}) as TArgs;\n const extra = (hasArgs ? callbackArgs[1] : callbackArgs[0]) as\n | { _meta?: { progressToken?: string | number } }\n | undefined;\n\n const progressToken = extra?._meta?.progressToken;\n const meta: ToolMeta = progressToken !== undefined ? { progressToken } : {};\n\n try {\n const result = await handler(args, ctx, meta);\n if (isToolResult(result)) return result;\n if (result === undefined) return textResult('OK');\n return jsonResult(result);\n } catch (error) {\n return mapErrorToResult(error, ctx, name);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (server as any).registerTool(name, sdkConfig, wrapped);\n}\n\nfunction isToolResult(value: unknown): value is ToolResult {\n return (\n !!value &&\n typeof value === 'object' &&\n 'content' in value &&\n Array.isArray((value as ToolResult).content)\n );\n}\n\nfunction mapErrorToResult(error: unknown, ctx: McpContext, toolName: string): ToolResult {\n if (error instanceof McpAuthError) {\n ctx.logger.warn(`${toolName}: auth required`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpUserError) {\n ctx.logger.info(`${toolName}: user error`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpInternalError) {\n ctx.logger.error(`${toolName}: internal error`, {\n message: error.message,\n cause: stringifyCause(error.cause),\n });\n return errorResult(`Internal error in ${toolName}.`);\n }\n const message = error instanceof Error ? error.message : String(error);\n ctx.logger.error(`${toolName}: unhandled error`, { message });\n return errorResult(`${toolName}: ${message}`);\n}\n\nfunction stringifyCause(cause: unknown): string | undefined {\n if (cause === undefined || cause === null) return undefined;\n if (cause instanceof Error) return cause.message;\n try {\n return JSON.stringify(cause);\n } catch {\n return String(cause);\n }\n}\n","/**\n * Tool / resource / prompt naming helpers.\n *\n * Mandatory product prefix avoids collisions when Claude Desktop runs\n * multiple MCP servers concurrently (typical setup is ~6).\n *\n * Tool names are capped at 63 characters — Claude Desktop pre-1.x\n * truncated at 64 in some versions.\n */\n\nimport { McpInternalError } from './errors.js';\n\nconst MAX_TOOL_NAME_LENGTH = 63;\n\nfunction assertSafeName(name: string, kind: 'tool' | 'resource' | 'prompt'): string {\n if (kind === 'tool' && name.length > MAX_TOOL_NAME_LENGTH) {\n throw new McpInternalError(\n `Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`,\n );\n }\n return name;\n}\n\n/**\n * Build a tool name. Format: `<productName>_<...parts>` (snake_case).\n * Example: mcpToolName('vibecontrols', 'vibes', 'list') -> 'vibecontrols_vibes_list'\n */\nexport function mcpToolName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpToolName: productName is required');\n }\n const name = [productName, ...parts].filter(Boolean).join('_');\n return assertSafeName(name, 'tool');\n}\n\n/**\n * Build a resource URI. Format: `<productName>://<...parts>`.\n * Example: mcpResourceUri('vibecontrols', 'schema') -> 'vibecontrols://schema'\n */\nexport function mcpResourceUri(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpResourceUri: productName is required');\n }\n return `${productName}://${parts.filter(Boolean).join('/')}`;\n}\n\n/**\n * Build a prompt name. Format: `<productName>-<...parts>` (kebab-case).\n * Example: mcpPromptName('vibecontrols', 'setup') -> 'vibecontrols-setup'\n */\nexport function mcpPromptName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpPromptName: productName is required');\n }\n return [productName, ...parts].filter(Boolean).join('-');\n}\n\nexport const TOOL_NAME_LIMIT = MAX_TOOL_NAME_LENGTH;\n","/**\n * Workspaces module GraphQL operations — full CRUD + members + projects +\n * activity + invitations.\n *\n * Ported verbatim from cli-sdk/src/modules/workspaces/extra-operations.ts\n * (the Phase 3 expansion of the Phase 2 thin context-only commands).\n */\n\nexport const GET_WORKSPACE = `\n query GetWorkspace($id: ID!) {\n workspace(id: $id) {\n id name slug description tenantId organizationId status createdAt updatedAt\n }\n }\n`;\n\nexport const CREATE_WORKSPACE = `\n mutation CreateWorkspace($input: CreateWorkspaceInput!) {\n createWorkspace(input: $input) {\n id name slug status createdAt\n }\n }\n`;\n\nexport const UPDATE_WORKSPACE = `\n mutation UpdateWorkspace($id: ID!, $input: UpdateWorkspaceInput!) {\n updateWorkspace(id: $id, input: $input) {\n id name description status updatedAt\n }\n }\n`;\n\nexport const DELETE_WORKSPACE = `\n mutation DeleteWorkspace($id: ID!) {\n deleteWorkspace(id: $id)\n }\n`;\n\nexport const LIST_WORKSPACE_MEMBERS = `\n query ListWorkspaceMembers($workspaceId: ID!, $pagination: PaginationInput) {\n workspaceMembers(workspaceId: $workspaceId, pagination: $pagination) {\n items { id userId email role status joinedAt }\n total hasMore\n }\n }\n`;\n\nexport const ADD_WORKSPACE_MEMBER = `\n mutation AddWorkspaceMember($input: AddWorkspaceMemberInput!) {\n addWorkspaceMember(input: $input) {\n id userId role status\n }\n }\n`;\n\nexport const REMOVE_WORKSPACE_MEMBER = `\n mutation RemoveWorkspaceMember($id: ID!) {\n removeWorkspaceMember(id: $id)\n }\n`;\n\nexport const UPDATE_WORKSPACE_MEMBER_ROLES = `\n mutation UpdateWorkspaceMemberRoles($input: UpdateWorkspaceMemberRolesInput!) {\n updateWorkspaceMemberRoles(input: $input) {\n id userId role\n }\n }\n`;\n\nexport const LIST_PROJECTS = `\n query ListProjects($filter: ProjectFilterInput, $pagination: PaginationInput) {\n projects(filter: $filter, pagination: $pagination) {\n items { id name workspaceId status createdAt }\n total hasMore\n }\n }\n`;\n\nexport const GET_PROJECT = `\n query GetProject($id: ID!) {\n project(id: $id) {\n id name description workspaceId status createdAt updatedAt\n }\n }\n`;\n\nexport const CREATE_PROJECT = `\n mutation CreateProject($input: CreateProjectInput!) {\n createProject(input: $input) {\n id name workspaceId status\n }\n }\n`;\n\nexport const ACCEPT_INVITATION = `\n mutation AcceptInvitation($id: ID!) {\n acceptInvitation(id: $id) {\n id status workspaceId\n }\n }\n`;\n\nexport const WORKSPACE_ACTIVITY = `\n query WorkspaceActivity($workspaceId: ID!, $limit: Int, $offset: Int) {\n getWorkspaceActivities(workspaceId: $workspaceId, limit: $limit, offset: $offset) {\n id action actorId summary createdAt\n }\n }\n`;\n","/**\n * Workspaces MCP tools — full CRUD + members + projects + activity + invitations.\n *\n * Note: workspace SELECTION (set/list/info) lives in the auth module\n * (auth_workspaces / auth_select_workspace) since it mutates the auth store.\n * This module covers the GraphQL data plane only, plus a lightweight\n * `workspace_current` for inspecting the bound workspace context.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport * as ops from './operations.js';\n\ninterface WorkspaceRow {\n id: string;\n name: string;\n slug?: string;\n status?: string;\n createdAt?: string;\n}\n\ninterface MemberRow {\n id: string;\n userId: string;\n email?: string;\n role?: string;\n status?: string;\n joinedAt?: string;\n}\n\ninterface ProjectRow {\n id: string;\n name: string;\n workspaceId: string;\n status?: string;\n createdAt?: string;\n}\n\nconst RoleEnum = z.enum(['MEMBER', 'ADMIN', 'OWNER']);\n\nexport function registerWorkspaceTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n // ── Current workspace context ───────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_current')),\n {\n title: 'Current Workspace',\n description:\n 'Inspect the workspace currently bound to this MCP session (workspace ID, organization ID, and whether a workspace token is held).',\n inputSchema: {},\n },\n async () => {\n try {\n const auth = ctx.auth.read();\n const wid = auth?.workspaceId ?? null;\n if (!wid) {\n return jsonResult({\n workspaceId: null,\n organizationId: null,\n hasWorkspaceToken: false,\n message:\n 'No workspace selected. Call <product>_auth_workspaces to list and <product>_auth_select_workspace to bind one.',\n });\n }\n return jsonResult({\n workspaceId: wid,\n organizationId: auth?.organizationId ?? null,\n hasWorkspaceToken: Boolean(auth?.workspaceToken),\n });\n } catch (error) {\n ctx.logger.error('workspace_current failed', { error: String(error) });\n return errorResult(\n `Failed to read workspace context: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── CRUD ────────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_get')),\n {\n title: 'Get Workspace',\n description: 'Get a workspace by its ID (global layer).',\n inputSchema: { id: z.string().describe('Workspace ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ workspace: WorkspaceRow | null }>(\n ops.GET_WORKSPACE,\n { id },\n );\n if (!data.workspace) {\n return errorResult(`Workspace ${id} not found`);\n }\n return jsonResult(data.workspace);\n } catch (error) {\n ctx.logger.error('workspace_get failed', { error: String(error) });\n return errorResult(\n `Failed to get workspace: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_create')),\n {\n title: 'Create Workspace',\n description: 'Create a workspace (global layer).',\n inputSchema: {\n name: z.string().describe('Workspace name'),\n description: z.string().optional().describe('Workspace description'),\n tenantId: z.string().optional().describe('Target tenant id'),\n organizationId: z.string().optional().describe('Owning organization id'),\n slug: z.string().optional().describe('URL-friendly slug'),\n },\n },\n async ({ name, description, tenantId, organizationId, slug }) => {\n try {\n const input: Record<string, unknown> = { name };\n if (description !== undefined) input.description = description;\n if (tenantId !== undefined) input.tenantId = tenantId;\n if (organizationId !== undefined) input.organizationId = organizationId;\n if (slug !== undefined) input.slug = slug;\n\n const data = await ctx.gql.global.request<{ createWorkspace: WorkspaceRow }>(\n ops.CREATE_WORKSPACE,\n { input },\n );\n return jsonResult(data.createWorkspace);\n } catch (error) {\n ctx.logger.error('workspace_create failed', { error: String(error) });\n return errorResult(\n `Failed to create workspace: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_update')),\n {\n title: 'Update Workspace',\n description: 'Update a workspace (global layer). At least one field must be provided.',\n inputSchema: {\n id: z.string().describe('Workspace ID'),\n name: z.string().optional().describe('Updated name'),\n description: z.string().optional().describe('Updated description'),\n status: z.string().optional().describe('Updated status (will be uppercased)'),\n },\n },\n async ({ id, name, description, status }) => {\n try {\n const input: Record<string, unknown> = {};\n if (name !== undefined) input.name = name;\n if (description !== undefined) input.description = description;\n if (status !== undefined) input.status = status.toUpperCase();\n if (Object.keys(input).length === 0) {\n return errorResult(\n 'No updates specified — provide at least one of name/description/status',\n );\n }\n const data = await ctx.gql.global.request<{ updateWorkspace: WorkspaceRow }>(\n ops.UPDATE_WORKSPACE,\n { id, input },\n );\n return jsonResult(data.updateWorkspace);\n } catch (error) {\n ctx.logger.error('workspace_update failed', { error: String(error) });\n return errorResult(\n `Failed to update workspace: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_delete')),\n {\n title: 'Delete Workspace',\n description: 'Delete a workspace (workspace layer).',\n inputSchema: { id: z.string().describe('Workspace ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.workspace.request<{ deleteWorkspace: boolean }>(\n ops.DELETE_WORKSPACE,\n { id },\n );\n return jsonResult({ deleted: data.deleteWorkspace, workspaceId: id });\n } catch (error) {\n ctx.logger.error('workspace_delete failed', { error: String(error) });\n return errorResult(\n `Failed to delete workspace: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Members ─────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_members_list')),\n {\n title: 'List Workspace Members',\n description: 'List members of a workspace.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID'),\n limit: z.number().optional().describe('Page size (default 100)'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ workspaceId, limit, offset }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n workspaceMembers: { items: MemberRow[]; total: number; hasMore: boolean };\n }>(ops.LIST_WORKSPACE_MEMBERS, {\n workspaceId,\n pagination: { limit: limit ?? 100, offset: offset ?? 0 },\n });\n return jsonResult(data.workspaceMembers);\n } catch (error) {\n ctx.logger.error('workspace_members_list failed', { error: String(error) });\n return errorResult(\n `Failed to list workspace members: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_members_add')),\n {\n title: 'Add Workspace Member',\n description: 'Add a member to a workspace.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID'),\n userId: z.string().describe('User ID to add'),\n role: RoleEnum.optional().describe('Membership role (default MEMBER)'),\n },\n },\n async ({ workspaceId, userId, role }) => {\n try {\n const input: Record<string, unknown> = {\n workspaceId,\n userId,\n role: role ?? 'MEMBER',\n };\n const data = await ctx.gql.workspace.request<{ addWorkspaceMember: MemberRow }>(\n ops.ADD_WORKSPACE_MEMBER,\n { input },\n );\n return jsonResult(data.addWorkspaceMember);\n } catch (error) {\n ctx.logger.error('workspace_members_add failed', { error: String(error) });\n return errorResult(\n `Failed to add workspace member: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_members_remove')),\n {\n title: 'Remove Workspace Member',\n description: 'Remove a member by membership id.',\n inputSchema: { membershipId: z.string().describe('Membership ID to remove') },\n },\n async ({ membershipId }) => {\n try {\n const data = await ctx.gql.workspace.request<{ removeWorkspaceMember: boolean }>(\n ops.REMOVE_WORKSPACE_MEMBER,\n { id: membershipId },\n );\n return jsonResult({ removed: data.removeWorkspaceMember, membershipId });\n } catch (error) {\n ctx.logger.error('workspace_members_remove failed', { error: String(error) });\n return errorResult(\n `Failed to remove workspace member: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_members_role')),\n {\n title: 'Update Workspace Member Role',\n description: 'Update a workspace member role.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID'),\n userId: z.string().describe('User ID'),\n role: RoleEnum.describe('New role'),\n },\n },\n async ({ workspaceId, userId, role }) => {\n try {\n const input: Record<string, unknown> = {\n workspaceId,\n userId,\n roles: [role],\n };\n const data = await ctx.gql.workspace.request<{\n updateWorkspaceMemberRoles: { id: string; userId: string; role: string };\n }>(ops.UPDATE_WORKSPACE_MEMBER_ROLES, { input });\n return jsonResult(data.updateWorkspaceMemberRoles);\n } catch (error) {\n ctx.logger.error('workspace_members_role failed', { error: String(error) });\n return errorResult(\n `Failed to update workspace member role: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Projects ────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_projects_list')),\n {\n title: 'List Projects',\n description: 'List projects, optionally filtered by workspace.',\n inputSchema: {\n workspaceId: z.string().optional().describe('Filter by workspace ID'),\n limit: z.number().optional().describe('Page size (default 100)'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ workspaceId, limit, offset }) => {\n try {\n const filter: Record<string, unknown> = {};\n if (workspaceId !== undefined) filter.workspaceId = workspaceId;\n\n const data = await ctx.gql.workspace.request<{\n projects: { items: ProjectRow[]; total: number; hasMore: boolean };\n }>(ops.LIST_PROJECTS, {\n filter: Object.keys(filter).length > 0 ? filter : undefined,\n pagination: { limit: limit ?? 100, offset: offset ?? 0 },\n });\n return jsonResult(data.projects);\n } catch (error) {\n ctx.logger.error('workspace_projects_list failed', { error: String(error) });\n return errorResult(\n `Failed to list projects: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_projects_get')),\n {\n title: 'Get Project',\n description: 'Get a project by ID.',\n inputSchema: { id: z.string().describe('Project ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.workspace.request<{ project: ProjectRow | null }>(\n ops.GET_PROJECT,\n { id },\n );\n if (!data.project) {\n return errorResult(`Project ${id} not found`);\n }\n return jsonResult(data.project);\n } catch (error) {\n ctx.logger.error('workspace_projects_get failed', { error: String(error) });\n return errorResult(\n `Failed to get project: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_projects_create')),\n {\n title: 'Create Project',\n description: 'Create a project inside a workspace.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID'),\n name: z.string().describe('Project name'),\n description: z.string().optional().describe('Project description'),\n },\n },\n async ({ workspaceId, name, description }) => {\n try {\n const input: Record<string, unknown> = { workspaceId, name };\n if (description !== undefined) input.description = description;\n\n const data = await ctx.gql.workspace.request<{ createProject: ProjectRow }>(\n ops.CREATE_PROJECT,\n { input },\n );\n return jsonResult(data.createProject);\n } catch (error) {\n ctx.logger.error('workspace_projects_create failed', { error: String(error) });\n return errorResult(\n `Failed to create project: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Invitations ─────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_invite_accept')),\n {\n title: 'Accept Workspace Invitation',\n description: 'Accept a workspace invitation by invitation ID.',\n inputSchema: { invitationId: z.string().describe('Invitation ID') },\n },\n async ({ invitationId }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n acceptInvitation: { id: string; status: string; workspaceId: string };\n }>(ops.ACCEPT_INVITATION, { id: invitationId });\n return jsonResult(data.acceptInvitation);\n } catch (error) {\n ctx.logger.error('workspace_invite_accept failed', { error: String(error) });\n return errorResult(\n `Failed to accept invitation: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Activity ────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_activity')),\n {\n title: 'Workspace Activity Log',\n description: 'Workspace activity log (audit events) for a given workspace.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID'),\n limit: z.number().optional().describe('Page size (default 100)'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ workspaceId, limit, offset }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n getWorkspaceActivities: Array<Record<string, unknown>>;\n }>(ops.WORKSPACE_ACTIVITY, {\n workspaceId,\n limit: limit ?? 100,\n offset: offset ?? 0,\n });\n return jsonResult(data.getWorkspaceActivities);\n } catch (error) {\n ctx.logger.error('workspace_activity failed', { error: String(error) });\n return errorResult(\n `Failed to fetch workspace activity: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Workspaces module — full CRUD + members + projects + activity + invitations.\n *\n * Surface mirrors cli-sdk/src/modules/workspaces/extra-commands.ts.\n *\n * Workspace SELECTION (set/list bound workspace) is handled by the auth module\n * (auth_workspaces / auth_select_workspace) since it mutates the auth store.\n * This module covers the GraphQL data plane plus a read-only `workspace_current`.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerWorkspaceTools } from './tools.js';\n\nconst workspacesModule: McpModule = {\n id: 'workspaces',\n version: '0.0.1',\n displayName: 'Workspaces',\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 registerWorkspaceTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default workspacesModule;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { c as McpModule } from '../../module-DFQBZNK6.cjs';
|
|
2
|
+
import '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import '../../context-1jV4NsLv.cjs';
|
|
4
|
+
import 'graphql-request';
|
|
5
|
+
|
|
6
|
+
declare const workspacesModule: McpModule;
|
|
7
|
+
|
|
8
|
+
export { workspacesModule as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { c as McpModule } from '../../module-DBcfA-i3.js';
|
|
2
|
+
import '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import '../../context-1jV4NsLv.js';
|
|
4
|
+
import 'graphql-request';
|
|
5
|
+
|
|
6
|
+
declare const workspacesModule: McpModule;
|
|
7
|
+
|
|
8
|
+
export { workspacesModule as default };
|