@dominusnode/mcp-server 1.1.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -62
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +16 -6
- package/dist/src/config.js.map +1 -1
- package/dist/src/http-client.d.ts.map +1 -1
- package/dist/src/http-client.js +25 -5
- package/dist/src/http-client.js.map +1 -1
- package/dist/src/index.js +15 -6
- package/dist/src/index.js.map +1 -1
- package/dist/src/proxy-fetch.d.ts.map +1 -1
- package/dist/src/proxy-fetch.js +51 -13
- package/dist/src/proxy-fetch.js.map +1 -1
- package/dist/src/token-manager.d.ts.map +1 -1
- package/dist/src/token-manager.js.map +1 -1
- package/dist/src/tools/account.d.ts.map +1 -1
- package/dist/src/tools/account.js +266 -34
- package/dist/src/tools/account.js.map +1 -1
- package/dist/src/tools/agent-wallet.d.ts.map +1 -1
- package/dist/src/tools/agent-wallet.js +164 -36
- package/dist/src/tools/agent-wallet.js.map +1 -1
- package/dist/src/tools/crypto.d.ts.map +1 -1
- package/dist/src/tools/crypto.js +57 -11
- package/dist/src/tools/crypto.js.map +1 -1
- package/dist/src/tools/fetch.d.ts.map +1 -1
- package/dist/src/tools/fetch.js +32 -10
- package/dist/src/tools/fetch.js.map +1 -1
- package/dist/src/tools/keys.d.ts.map +1 -1
- package/dist/src/tools/keys.js +49 -10
- package/dist/src/tools/keys.js.map +1 -1
- package/dist/src/tools/mpp.d.ts +4 -0
- package/dist/src/tools/mpp.d.ts.map +1 -0
- package/dist/src/tools/mpp.js +235 -0
- package/dist/src/tools/mpp.js.map +1 -0
- package/dist/src/tools/paypal.d.ts.map +1 -1
- package/dist/src/tools/paypal.js +20 -4
- package/dist/src/tools/paypal.js.map +1 -1
- package/dist/src/tools/plans.d.ts.map +1 -1
- package/dist/src/tools/plans.js +23 -4
- package/dist/src/tools/plans.js.map +1 -1
- package/dist/src/tools/proxy.d.ts.map +1 -1
- package/dist/src/tools/proxy.js +15 -3
- package/dist/src/tools/proxy.js.map +1 -1
- package/dist/src/tools/sessions.d.ts.map +1 -1
- package/dist/src/tools/sessions.js +14 -2
- package/dist/src/tools/sessions.js.map +1 -1
- package/dist/src/tools/slots.d.ts.map +1 -1
- package/dist/src/tools/slots.js +37 -6
- package/dist/src/tools/slots.js.map +1 -1
- package/dist/src/tools/stripe.d.ts.map +1 -1
- package/dist/src/tools/stripe.js +20 -4
- package/dist/src/tools/stripe.js.map +1 -1
- package/dist/src/tools/teams.d.ts.map +1 -1
- package/dist/src/tools/teams.js +266 -66
- package/dist/src/tools/teams.js.map +1 -1
- package/dist/src/tools/usage.d.ts.map +1 -1
- package/dist/src/tools/usage.js +42 -9
- package/dist/src/tools/usage.js.map +1 -1
- package/dist/src/tools/wallet-auth.d.ts.map +1 -1
- package/dist/src/tools/wallet-auth.js +75 -13
- package/dist/src/tools/wallet-auth.js.map +1 -1
- package/dist/src/tools/wallet.d.ts.map +1 -1
- package/dist/src/tools/wallet.js +21 -4
- package/dist/src/tools/wallet.js.map +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/src/tools/teams.js
CHANGED
|
@@ -5,7 +5,8 @@ const TEAMS_RATE_WINDOW_MS = 60_000;
|
|
|
5
5
|
const teamsTimestamps = [];
|
|
6
6
|
function checkTeamsRateLimit() {
|
|
7
7
|
const now = Date.now();
|
|
8
|
-
while (teamsTimestamps.length > 0 &&
|
|
8
|
+
while (teamsTimestamps.length > 0 &&
|
|
9
|
+
now - teamsTimestamps[0] > TEAMS_RATE_WINDOW_MS) {
|
|
9
10
|
teamsTimestamps.shift();
|
|
10
11
|
}
|
|
11
12
|
if (teamsTimestamps.length > 100)
|
|
@@ -18,13 +19,24 @@ function checkTeamsRateLimit() {
|
|
|
18
19
|
export function registerTeamsTools(server, httpClient) {
|
|
19
20
|
server.tool("dominusnode_create_team", "Create a new team. Teams share a wallet and API keys. Optionally set a max member limit.", {
|
|
20
21
|
name: z.string().min(1).max(100).describe("Team name"),
|
|
21
|
-
max_members: z
|
|
22
|
+
max_members: z
|
|
23
|
+
.number()
|
|
24
|
+
.int()
|
|
25
|
+
.min(1)
|
|
26
|
+
.max(100)
|
|
27
|
+
.optional()
|
|
28
|
+
.describe("Maximum number of team members (default: no limit)"),
|
|
22
29
|
}, async (args) => {
|
|
23
30
|
try {
|
|
24
31
|
if (!checkTeamsRateLimit()) {
|
|
25
32
|
return {
|
|
26
33
|
isError: true,
|
|
27
|
-
content: [
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: "text",
|
|
37
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
38
|
+
},
|
|
39
|
+
],
|
|
28
40
|
};
|
|
29
41
|
}
|
|
30
42
|
const body = { name: args.name };
|
|
@@ -51,7 +63,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
51
63
|
catch (err) {
|
|
52
64
|
return {
|
|
53
65
|
isError: true,
|
|
54
|
-
content: [
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: "text",
|
|
69
|
+
text: `Error creating team: ${err instanceof Error ? err.message : String(err)}`,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
55
72
|
};
|
|
56
73
|
}
|
|
57
74
|
});
|
|
@@ -60,13 +77,15 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
60
77
|
const data = await httpClient.get("/api/teams");
|
|
61
78
|
if (data.teams.length === 0) {
|
|
62
79
|
return {
|
|
63
|
-
content: [
|
|
80
|
+
content: [
|
|
81
|
+
{
|
|
82
|
+
type: "text",
|
|
83
|
+
text: "No teams found. Use dominusnode_create_team to create one.",
|
|
84
|
+
},
|
|
85
|
+
],
|
|
64
86
|
};
|
|
65
87
|
}
|
|
66
|
-
const lines = [
|
|
67
|
-
`Teams (${data.teams.length})`,
|
|
68
|
-
``,
|
|
69
|
-
];
|
|
88
|
+
const lines = [`Teams (${data.teams.length})`, ``];
|
|
70
89
|
for (const t of data.teams) {
|
|
71
90
|
lines.push(` ${t.name} (${t.id.slice(0, 8)}...)`);
|
|
72
91
|
lines.push(` Role: ${t.role} | Balance: $${(t.balanceCents / 100).toFixed(2)}`);
|
|
@@ -77,7 +96,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
77
96
|
catch (err) {
|
|
78
97
|
return {
|
|
79
98
|
isError: true,
|
|
80
|
-
content: [
|
|
99
|
+
content: [
|
|
100
|
+
{
|
|
101
|
+
type: "text",
|
|
102
|
+
text: `Error listing teams: ${err instanceof Error ? err.message : String(err)}`,
|
|
103
|
+
},
|
|
104
|
+
],
|
|
81
105
|
};
|
|
82
106
|
}
|
|
83
107
|
});
|
|
@@ -104,20 +128,36 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
104
128
|
catch (err) {
|
|
105
129
|
return {
|
|
106
130
|
isError: true,
|
|
107
|
-
content: [
|
|
131
|
+
content: [
|
|
132
|
+
{
|
|
133
|
+
type: "text",
|
|
134
|
+
text: `Error fetching team details: ${err instanceof Error ? err.message : String(err)}`,
|
|
135
|
+
},
|
|
136
|
+
],
|
|
108
137
|
};
|
|
109
138
|
}
|
|
110
139
|
});
|
|
111
140
|
server.tool("dominusnode_team_update", "Update a team's name or max member limit. Only team owners and admins can update team settings.", {
|
|
112
141
|
team_id: z.string().regex(UUID_RE).describe("Team ID"),
|
|
113
142
|
name: z.string().min(1).max(100).optional().describe("New team name"),
|
|
114
|
-
max_members: z
|
|
143
|
+
max_members: z
|
|
144
|
+
.number()
|
|
145
|
+
.int()
|
|
146
|
+
.min(1)
|
|
147
|
+
.max(100)
|
|
148
|
+
.optional()
|
|
149
|
+
.describe("New maximum member limit"),
|
|
115
150
|
}, async (args) => {
|
|
116
151
|
try {
|
|
117
152
|
if (!checkTeamsRateLimit()) {
|
|
118
153
|
return {
|
|
119
154
|
isError: true,
|
|
120
|
-
content: [
|
|
155
|
+
content: [
|
|
156
|
+
{
|
|
157
|
+
type: "text",
|
|
158
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
121
161
|
};
|
|
122
162
|
}
|
|
123
163
|
const body = {};
|
|
@@ -128,7 +168,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
128
168
|
if (Object.keys(body).length === 0) {
|
|
129
169
|
return {
|
|
130
170
|
isError: true,
|
|
131
|
-
content: [
|
|
171
|
+
content: [
|
|
172
|
+
{
|
|
173
|
+
type: "text",
|
|
174
|
+
text: "No updates provided. Specify name and/or max_members to update.",
|
|
175
|
+
},
|
|
176
|
+
],
|
|
132
177
|
};
|
|
133
178
|
}
|
|
134
179
|
const data = await httpClient.patch(`/api/teams/${encodeURIComponent(args.team_id)}`, body);
|
|
@@ -145,20 +190,35 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
145
190
|
catch (err) {
|
|
146
191
|
return {
|
|
147
192
|
isError: true,
|
|
148
|
-
content: [
|
|
193
|
+
content: [
|
|
194
|
+
{
|
|
195
|
+
type: "text",
|
|
196
|
+
text: `Error updating team: ${err instanceof Error ? err.message : String(err)}`,
|
|
197
|
+
},
|
|
198
|
+
],
|
|
149
199
|
};
|
|
150
200
|
}
|
|
151
201
|
});
|
|
152
202
|
server.tool("dominusnode_team_update_member_role", "Change a team member's role. Only team owners can change roles. Cannot change the owner's role or your own role.", {
|
|
153
203
|
team_id: z.string().regex(UUID_RE).describe("Team ID"),
|
|
154
|
-
user_id: z
|
|
155
|
-
|
|
204
|
+
user_id: z
|
|
205
|
+
.string()
|
|
206
|
+
.regex(UUID_RE)
|
|
207
|
+
.describe("User ID of the member to update"),
|
|
208
|
+
role: z
|
|
209
|
+
.enum(["member", "admin"])
|
|
210
|
+
.describe("New role: 'admin' or 'member'"),
|
|
156
211
|
}, async (args) => {
|
|
157
212
|
try {
|
|
158
213
|
if (!checkTeamsRateLimit()) {
|
|
159
214
|
return {
|
|
160
215
|
isError: true,
|
|
161
|
-
content: [
|
|
216
|
+
content: [
|
|
217
|
+
{
|
|
218
|
+
type: "text",
|
|
219
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
220
|
+
},
|
|
221
|
+
],
|
|
162
222
|
};
|
|
163
223
|
}
|
|
164
224
|
const data = await httpClient.patch(`/api/teams/${encodeURIComponent(args.team_id)}/members/${encodeURIComponent(args.user_id)}`, {
|
|
@@ -170,20 +230,33 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
170
230
|
catch (err) {
|
|
171
231
|
return {
|
|
172
232
|
isError: true,
|
|
173
|
-
content: [
|
|
233
|
+
content: [
|
|
234
|
+
{
|
|
235
|
+
type: "text",
|
|
236
|
+
text: `Error updating member role: ${err instanceof Error ? err.message : String(err)}`,
|
|
237
|
+
},
|
|
238
|
+
],
|
|
174
239
|
};
|
|
175
240
|
}
|
|
176
241
|
});
|
|
177
242
|
server.tool("dominusnode_team_add_member", "Add a member to a team by their email address. Optionally assign a role (default: member).", {
|
|
178
243
|
team_id: z.string().regex(UUID_RE).describe("Team ID"),
|
|
179
244
|
email: z.string().email().describe("Email address of the user to add"),
|
|
180
|
-
role: z
|
|
245
|
+
role: z
|
|
246
|
+
.enum(["member", "admin"])
|
|
247
|
+
.optional()
|
|
248
|
+
.describe("Role to assign: 'admin' or 'member'. Default: 'member'"),
|
|
181
249
|
}, async (args) => {
|
|
182
250
|
try {
|
|
183
251
|
if (!checkTeamsRateLimit()) {
|
|
184
252
|
return {
|
|
185
253
|
isError: true,
|
|
186
|
-
content: [
|
|
254
|
+
content: [
|
|
255
|
+
{
|
|
256
|
+
type: "text",
|
|
257
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
258
|
+
},
|
|
259
|
+
],
|
|
187
260
|
};
|
|
188
261
|
}
|
|
189
262
|
const body = { email: args.email };
|
|
@@ -197,19 +270,32 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
197
270
|
catch (err) {
|
|
198
271
|
return {
|
|
199
272
|
isError: true,
|
|
200
|
-
content: [
|
|
273
|
+
content: [
|
|
274
|
+
{
|
|
275
|
+
type: "text",
|
|
276
|
+
text: `Error adding member: ${err instanceof Error ? err.message : String(err)}`,
|
|
277
|
+
},
|
|
278
|
+
],
|
|
201
279
|
};
|
|
202
280
|
}
|
|
203
281
|
});
|
|
204
282
|
server.tool("dominusnode_team_remove_member", "Remove a member from a team by their user ID.", {
|
|
205
283
|
team_id: z.string().regex(UUID_RE).describe("Team ID"),
|
|
206
|
-
user_id: z
|
|
284
|
+
user_id: z
|
|
285
|
+
.string()
|
|
286
|
+
.regex(UUID_RE)
|
|
287
|
+
.describe("User ID of the member to remove"),
|
|
207
288
|
}, async (args) => {
|
|
208
289
|
try {
|
|
209
290
|
if (!checkTeamsRateLimit()) {
|
|
210
291
|
return {
|
|
211
292
|
isError: true,
|
|
212
|
-
content: [
|
|
293
|
+
content: [
|
|
294
|
+
{
|
|
295
|
+
type: "text",
|
|
296
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
297
|
+
},
|
|
298
|
+
],
|
|
213
299
|
};
|
|
214
300
|
}
|
|
215
301
|
await httpClient.delete(`/api/teams/${encodeURIComponent(args.team_id)}/members/${encodeURIComponent(args.user_id)}`);
|
|
@@ -219,19 +305,34 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
219
305
|
catch (err) {
|
|
220
306
|
return {
|
|
221
307
|
isError: true,
|
|
222
|
-
content: [
|
|
308
|
+
content: [
|
|
309
|
+
{
|
|
310
|
+
type: "text",
|
|
311
|
+
text: `Error removing member: ${err instanceof Error ? err.message : String(err)}`,
|
|
312
|
+
},
|
|
313
|
+
],
|
|
223
314
|
};
|
|
224
315
|
}
|
|
225
316
|
});
|
|
226
317
|
server.tool("dominusnode_team_fund", "Transfer funds from your personal wallet to a team wallet. Minimum $1, maximum $10,000.", {
|
|
227
318
|
team_id: z.string().regex(UUID_RE).describe("Team ID to fund"),
|
|
228
|
-
amount_cents: z
|
|
319
|
+
amount_cents: z
|
|
320
|
+
.number()
|
|
321
|
+
.int()
|
|
322
|
+
.min(100)
|
|
323
|
+
.max(1000000)
|
|
324
|
+
.describe("Amount in cents to transfer (min $1, max $10,000)"),
|
|
229
325
|
}, async (args) => {
|
|
230
326
|
try {
|
|
231
327
|
if (!checkTeamsRateLimit()) {
|
|
232
328
|
return {
|
|
233
329
|
isError: true,
|
|
234
|
-
content: [
|
|
330
|
+
content: [
|
|
331
|
+
{
|
|
332
|
+
type: "text",
|
|
333
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
334
|
+
},
|
|
335
|
+
],
|
|
235
336
|
};
|
|
236
337
|
}
|
|
237
338
|
const data = await httpClient.post(`/api/teams/${encodeURIComponent(args.team_id)}/wallet/fund`, {
|
|
@@ -254,19 +355,33 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
254
355
|
catch (err) {
|
|
255
356
|
return {
|
|
256
357
|
isError: true,
|
|
257
|
-
content: [
|
|
358
|
+
content: [
|
|
359
|
+
{
|
|
360
|
+
type: "text",
|
|
361
|
+
text: `Error funding team: ${err instanceof Error ? err.message : String(err)}`,
|
|
362
|
+
},
|
|
363
|
+
],
|
|
258
364
|
};
|
|
259
365
|
}
|
|
260
366
|
});
|
|
261
367
|
server.tool("dominusnode_team_create_key", "Create a shared API key for a team. All team members can use team keys for proxy access.", {
|
|
262
368
|
team_id: z.string().regex(UUID_RE).describe("Team ID"),
|
|
263
|
-
label: z
|
|
369
|
+
label: z
|
|
370
|
+
.string()
|
|
371
|
+
.min(1)
|
|
372
|
+
.max(100)
|
|
373
|
+
.describe("Label for the API key (e.g., 'production', 'staging')"),
|
|
264
374
|
}, async (args) => {
|
|
265
375
|
try {
|
|
266
376
|
if (!checkTeamsRateLimit()) {
|
|
267
377
|
return {
|
|
268
378
|
isError: true,
|
|
269
|
-
content: [
|
|
379
|
+
content: [
|
|
380
|
+
{
|
|
381
|
+
type: "text",
|
|
382
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
383
|
+
},
|
|
384
|
+
],
|
|
270
385
|
};
|
|
271
386
|
}
|
|
272
387
|
const data = await httpClient.post(`/api/teams/${encodeURIComponent(args.team_id)}/keys`, {
|
|
@@ -290,7 +405,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
290
405
|
catch (err) {
|
|
291
406
|
return {
|
|
292
407
|
isError: true,
|
|
293
|
-
content: [
|
|
408
|
+
content: [
|
|
409
|
+
{
|
|
410
|
+
type: "text",
|
|
411
|
+
text: `Error creating team key: ${err instanceof Error ? err.message : String(err)}`,
|
|
412
|
+
},
|
|
413
|
+
],
|
|
294
414
|
};
|
|
295
415
|
}
|
|
296
416
|
});
|
|
@@ -302,7 +422,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
302
422
|
if (!checkTeamsRateLimit()) {
|
|
303
423
|
return {
|
|
304
424
|
isError: true,
|
|
305
|
-
content: [
|
|
425
|
+
content: [
|
|
426
|
+
{
|
|
427
|
+
type: "text",
|
|
428
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
429
|
+
},
|
|
430
|
+
],
|
|
306
431
|
};
|
|
307
432
|
}
|
|
308
433
|
await httpClient.delete(`/api/teams/${encodeURIComponent(args.team_id)}/keys/${encodeURIComponent(args.key_id)}`);
|
|
@@ -312,25 +437,38 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
312
437
|
catch (err) {
|
|
313
438
|
return {
|
|
314
439
|
isError: true,
|
|
315
|
-
content: [
|
|
440
|
+
content: [
|
|
441
|
+
{
|
|
442
|
+
type: "text",
|
|
443
|
+
text: `Error revoking team key: ${err instanceof Error ? err.message : String(err)}`,
|
|
444
|
+
},
|
|
445
|
+
],
|
|
316
446
|
};
|
|
317
447
|
}
|
|
318
448
|
});
|
|
319
449
|
server.tool("dominusnode_team_usage", "Get the team wallet transaction history (funding, usage charges, refunds).", {
|
|
320
450
|
team_id: z.string().regex(UUID_RE).describe("Team ID"),
|
|
321
|
-
limit: z
|
|
451
|
+
limit: z
|
|
452
|
+
.number()
|
|
453
|
+
.int()
|
|
454
|
+
.min(1)
|
|
455
|
+
.max(100)
|
|
456
|
+
.default(20)
|
|
457
|
+
.describe("Number of transactions to return"),
|
|
322
458
|
}, async (args) => {
|
|
323
459
|
try {
|
|
324
460
|
const data = await httpClient.get(`/api/teams/${encodeURIComponent(args.team_id)}/wallet/transactions?limit=${args.limit}`);
|
|
325
461
|
if (data.transactions.length === 0) {
|
|
326
462
|
return {
|
|
327
|
-
content: [
|
|
463
|
+
content: [
|
|
464
|
+
{
|
|
465
|
+
type: "text",
|
|
466
|
+
text: "No transactions found for this team. Use dominusnode_team_fund to add funds.",
|
|
467
|
+
},
|
|
468
|
+
],
|
|
328
469
|
};
|
|
329
470
|
}
|
|
330
|
-
const lines = [
|
|
331
|
-
`Team Transactions (${data.transactions.length})`,
|
|
332
|
-
``,
|
|
333
|
-
];
|
|
471
|
+
const lines = [`Team Transactions (${data.transactions.length})`, ``];
|
|
334
472
|
for (const tx of data.transactions) {
|
|
335
473
|
const sign = tx.type === "fund" || tx.type === "refund" ? "+" : "-";
|
|
336
474
|
lines.push(` ${sign}$${(tx.amountCents / 100).toFixed(2)} [${tx.type}] ${tx.description}`);
|
|
@@ -341,7 +479,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
341
479
|
catch (err) {
|
|
342
480
|
return {
|
|
343
481
|
isError: true,
|
|
344
|
-
content: [
|
|
482
|
+
content: [
|
|
483
|
+
{
|
|
484
|
+
type: "text",
|
|
485
|
+
text: `Error fetching team transactions: ${err instanceof Error ? err.message : String(err)}`,
|
|
486
|
+
},
|
|
487
|
+
],
|
|
345
488
|
};
|
|
346
489
|
}
|
|
347
490
|
});
|
|
@@ -352,13 +495,15 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
352
495
|
const data = await httpClient.get(`/api/teams/${encodeURIComponent(args.team_id)}/members`);
|
|
353
496
|
if (data.members.length === 0) {
|
|
354
497
|
return {
|
|
355
|
-
content: [
|
|
498
|
+
content: [
|
|
499
|
+
{
|
|
500
|
+
type: "text",
|
|
501
|
+
text: "No members found for this team. Use dominusnode_team_add_member or dominusnode_team_invite_member to add members.",
|
|
502
|
+
},
|
|
503
|
+
],
|
|
356
504
|
};
|
|
357
505
|
}
|
|
358
|
-
const lines = [
|
|
359
|
-
`Team Members (${data.members.length})`,
|
|
360
|
-
``,
|
|
361
|
-
];
|
|
506
|
+
const lines = [`Team Members (${data.members.length})`, ``];
|
|
362
507
|
for (const m of data.members) {
|
|
363
508
|
lines.push(` ${m.email} (${m.userId.slice(0, 8)}...)`);
|
|
364
509
|
lines.push(` Role: ${m.role} | Joined: ${m.joinedAt}`);
|
|
@@ -369,20 +514,36 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
369
514
|
catch (err) {
|
|
370
515
|
return {
|
|
371
516
|
isError: true,
|
|
372
|
-
content: [
|
|
517
|
+
content: [
|
|
518
|
+
{
|
|
519
|
+
type: "text",
|
|
520
|
+
text: `Error listing team members: ${err instanceof Error ? err.message : String(err)}`,
|
|
521
|
+
},
|
|
522
|
+
],
|
|
373
523
|
};
|
|
374
524
|
}
|
|
375
525
|
});
|
|
376
526
|
server.tool("dominusnode_team_invite_member", "Send an email invitation to join a team. The invited user will receive an email with a link to accept. Only team owners and admins can send invites.", {
|
|
377
527
|
team_id: z.string().regex(UUID_RE).describe("Team ID"),
|
|
378
|
-
email: z
|
|
379
|
-
|
|
528
|
+
email: z
|
|
529
|
+
.string()
|
|
530
|
+
.email()
|
|
531
|
+
.describe("Email address of the person to invite"),
|
|
532
|
+
role: z
|
|
533
|
+
.enum(["member", "admin"])
|
|
534
|
+
.default("member")
|
|
535
|
+
.describe("Role to assign when they accept: 'admin' or 'member'. Default: 'member'"),
|
|
380
536
|
}, async (args) => {
|
|
381
537
|
try {
|
|
382
538
|
if (!checkTeamsRateLimit()) {
|
|
383
539
|
return {
|
|
384
540
|
isError: true,
|
|
385
|
-
content: [
|
|
541
|
+
content: [
|
|
542
|
+
{
|
|
543
|
+
type: "text",
|
|
544
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
545
|
+
},
|
|
546
|
+
],
|
|
386
547
|
};
|
|
387
548
|
}
|
|
388
549
|
const data = await httpClient.post(`/api/teams/${encodeURIComponent(args.team_id)}/invites`, {
|
|
@@ -406,7 +567,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
406
567
|
catch (err) {
|
|
407
568
|
return {
|
|
408
569
|
isError: true,
|
|
409
|
-
content: [
|
|
570
|
+
content: [
|
|
571
|
+
{
|
|
572
|
+
type: "text",
|
|
573
|
+
text: `Error sending invite: ${err instanceof Error ? err.message : String(err)}`,
|
|
574
|
+
},
|
|
575
|
+
],
|
|
410
576
|
};
|
|
411
577
|
}
|
|
412
578
|
});
|
|
@@ -417,13 +583,15 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
417
583
|
const data = await httpClient.get(`/api/teams/${encodeURIComponent(args.team_id)}/invites`);
|
|
418
584
|
if (data.invites.length === 0) {
|
|
419
585
|
return {
|
|
420
|
-
content: [
|
|
586
|
+
content: [
|
|
587
|
+
{
|
|
588
|
+
type: "text",
|
|
589
|
+
text: "No pending invites for this team. Use dominusnode_team_invite_member to send invitations.",
|
|
590
|
+
},
|
|
591
|
+
],
|
|
421
592
|
};
|
|
422
593
|
}
|
|
423
|
-
const lines = [
|
|
424
|
-
`Pending Invites (${data.invites.length})`,
|
|
425
|
-
``,
|
|
426
|
-
];
|
|
594
|
+
const lines = [`Pending Invites (${data.invites.length})`, ``];
|
|
427
595
|
for (const inv of data.invites) {
|
|
428
596
|
lines.push(` ${inv.email} — ${inv.role}`);
|
|
429
597
|
lines.push(` Invite ID: ${inv.id}`);
|
|
@@ -435,7 +603,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
435
603
|
catch (err) {
|
|
436
604
|
return {
|
|
437
605
|
isError: true,
|
|
438
|
-
content: [
|
|
606
|
+
content: [
|
|
607
|
+
{
|
|
608
|
+
type: "text",
|
|
609
|
+
text: `Error listing invites: ${err instanceof Error ? err.message : String(err)}`,
|
|
610
|
+
},
|
|
611
|
+
],
|
|
439
612
|
};
|
|
440
613
|
}
|
|
441
614
|
});
|
|
@@ -447,7 +620,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
447
620
|
if (!checkTeamsRateLimit()) {
|
|
448
621
|
return {
|
|
449
622
|
isError: true,
|
|
450
|
-
content: [
|
|
623
|
+
content: [
|
|
624
|
+
{
|
|
625
|
+
type: "text",
|
|
626
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
627
|
+
},
|
|
628
|
+
],
|
|
451
629
|
};
|
|
452
630
|
}
|
|
453
631
|
await httpClient.delete(`/api/teams/${encodeURIComponent(args.team_id)}/invites/${encodeURIComponent(args.invite_id)}`);
|
|
@@ -457,7 +635,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
457
635
|
catch (err) {
|
|
458
636
|
return {
|
|
459
637
|
isError: true,
|
|
460
|
-
content: [
|
|
638
|
+
content: [
|
|
639
|
+
{
|
|
640
|
+
type: "text",
|
|
641
|
+
text: `Error cancelling invite: ${err instanceof Error ? err.message : String(err)}`,
|
|
642
|
+
},
|
|
643
|
+
],
|
|
461
644
|
};
|
|
462
645
|
}
|
|
463
646
|
});
|
|
@@ -468,13 +651,15 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
468
651
|
const data = await httpClient.get(`/api/teams/${encodeURIComponent(args.team_id)}/keys`);
|
|
469
652
|
if (data.keys.length === 0) {
|
|
470
653
|
return {
|
|
471
|
-
content: [
|
|
654
|
+
content: [
|
|
655
|
+
{
|
|
656
|
+
type: "text",
|
|
657
|
+
text: "No API keys found for this team. Use dominusnode_team_create_key to create one.",
|
|
658
|
+
},
|
|
659
|
+
],
|
|
472
660
|
};
|
|
473
661
|
}
|
|
474
|
-
const lines = [
|
|
475
|
-
`Team API Keys (${data.keys.length})`,
|
|
476
|
-
``,
|
|
477
|
-
];
|
|
662
|
+
const lines = [`Team API Keys (${data.keys.length})`, ``];
|
|
478
663
|
for (const k of data.keys) {
|
|
479
664
|
lines.push(` ${k.prefix}... — ${k.label}`);
|
|
480
665
|
lines.push(` Key ID: ${k.id} | Created: ${k.createdAt}`);
|
|
@@ -485,7 +670,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
485
670
|
catch (err) {
|
|
486
671
|
return {
|
|
487
672
|
isError: true,
|
|
488
|
-
content: [
|
|
673
|
+
content: [
|
|
674
|
+
{
|
|
675
|
+
type: "text",
|
|
676
|
+
text: `Error listing team keys: ${err instanceof Error ? err.message : String(err)}`,
|
|
677
|
+
},
|
|
678
|
+
],
|
|
489
679
|
};
|
|
490
680
|
}
|
|
491
681
|
});
|
|
@@ -496,7 +686,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
496
686
|
if (!checkTeamsRateLimit()) {
|
|
497
687
|
return {
|
|
498
688
|
isError: true,
|
|
499
|
-
content: [
|
|
689
|
+
content: [
|
|
690
|
+
{
|
|
691
|
+
type: "text",
|
|
692
|
+
text: "Rate limit exceeded: maximum 20 team operations per minute. Please wait before retrying.",
|
|
693
|
+
},
|
|
694
|
+
],
|
|
500
695
|
};
|
|
501
696
|
}
|
|
502
697
|
const data = await httpClient.delete(`/api/teams/${encodeURIComponent(args.team_id)}`);
|
|
@@ -512,7 +707,12 @@ export function registerTeamsTools(server, httpClient) {
|
|
|
512
707
|
catch (err) {
|
|
513
708
|
return {
|
|
514
709
|
isError: true,
|
|
515
|
-
content: [
|
|
710
|
+
content: [
|
|
711
|
+
{
|
|
712
|
+
type: "text",
|
|
713
|
+
text: `Error deleting team: ${err instanceof Error ? err.message : String(err)}`,
|
|
714
|
+
},
|
|
715
|
+
],
|
|
516
716
|
};
|
|
517
717
|
}
|
|
518
718
|
});
|