@artyfacts/mcp-server 1.0.2 → 1.0.4
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/chunk-MO7NJ56L.js +579 -0
- package/dist/chunk-VCIOVYRM.js +556 -0
- package/dist/index.cjs +59 -16
- package/dist/index.js +1 -1
- package/dist/server.cjs +59 -16
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/src/server.ts +62 -16
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
// src/server.ts
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import {
|
|
5
|
+
CallToolRequestSchema,
|
|
6
|
+
ListToolsRequestSchema
|
|
7
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
+
var ARTYFACTS_TOOLS = [
|
|
9
|
+
// Organization tools
|
|
10
|
+
{
|
|
11
|
+
name: "get_organization",
|
|
12
|
+
description: "Get details about the current organization",
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {},
|
|
16
|
+
required: []
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
// Project tools
|
|
20
|
+
{
|
|
21
|
+
name: "list_projects",
|
|
22
|
+
description: "List all projects in the organization",
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {
|
|
26
|
+
limit: { type: "number", description: "Max results (default 50)" },
|
|
27
|
+
offset: { type: "number", description: "Pagination offset" }
|
|
28
|
+
},
|
|
29
|
+
required: []
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "get_project",
|
|
34
|
+
description: "Get details about a specific project",
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
project_id: { type: "string", description: "Project ID" }
|
|
39
|
+
},
|
|
40
|
+
required: ["project_id"]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
// Artifact tools
|
|
44
|
+
{
|
|
45
|
+
name: "list_artifacts",
|
|
46
|
+
description: "List artifacts, optionally filtered by project",
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: {
|
|
50
|
+
project_id: { type: "string", description: "Filter by project" },
|
|
51
|
+
type: { type: "string", description: "Filter by type (goal, spec, research, etc.)" },
|
|
52
|
+
status: { type: "string", description: "Filter by status" },
|
|
53
|
+
limit: { type: "number", description: "Max results" }
|
|
54
|
+
},
|
|
55
|
+
required: []
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "get_artifact",
|
|
60
|
+
description: "Get a specific artifact by ID",
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
artifact_id: { type: "string", description: "Artifact ID" }
|
|
65
|
+
},
|
|
66
|
+
required: ["artifact_id"]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "create_artifact",
|
|
71
|
+
description: "Create a new artifact (document, goal, spec, etc.)",
|
|
72
|
+
inputSchema: {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: {
|
|
75
|
+
title: { type: "string", description: "Artifact title" },
|
|
76
|
+
type: { type: "string", description: "Artifact type: goal, spec, research, report, experiment, decision, doc" },
|
|
77
|
+
content: { type: "string", description: "Markdown content" },
|
|
78
|
+
parent_id: { type: "string", description: "Parent artifact ID for nested artifacts" },
|
|
79
|
+
tags: { type: "array", items: { type: "string" }, description: "Tags for categorization" }
|
|
80
|
+
},
|
|
81
|
+
required: ["title", "type"]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "update_artifact",
|
|
86
|
+
description: "Update an existing artifact",
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: "object",
|
|
89
|
+
properties: {
|
|
90
|
+
artifact_id: { type: "string", description: "Artifact ID" },
|
|
91
|
+
title: { type: "string", description: "New title" },
|
|
92
|
+
content: { type: "string", description: "New content" },
|
|
93
|
+
status: { type: "string", description: "New status" }
|
|
94
|
+
},
|
|
95
|
+
required: ["artifact_id"]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
// Section tools
|
|
99
|
+
{
|
|
100
|
+
name: "list_sections",
|
|
101
|
+
description: "List sections of an artifact",
|
|
102
|
+
inputSchema: {
|
|
103
|
+
type: "object",
|
|
104
|
+
properties: {
|
|
105
|
+
artifact_id: { type: "string", description: "Artifact ID" }
|
|
106
|
+
},
|
|
107
|
+
required: ["artifact_id"]
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "get_section",
|
|
112
|
+
description: "Get a specific section",
|
|
113
|
+
inputSchema: {
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: {
|
|
116
|
+
artifact_id: { type: "string", description: "Artifact ID" },
|
|
117
|
+
section_id: { type: "string", description: "Section ID" }
|
|
118
|
+
},
|
|
119
|
+
required: ["artifact_id", "section_id"]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "create_section",
|
|
124
|
+
description: "Create a new section on an artifact",
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: "object",
|
|
127
|
+
properties: {
|
|
128
|
+
artifact_id: { type: "string", description: "Artifact ID" },
|
|
129
|
+
section_id: { type: "string", description: "Section identifier (slug)" },
|
|
130
|
+
heading: { type: "string", description: "Section heading" },
|
|
131
|
+
content: { type: "string", description: "Markdown content" },
|
|
132
|
+
type: { type: "string", description: "Type: content, task, decision, blocker" },
|
|
133
|
+
position: { type: "number", description: "Order position" }
|
|
134
|
+
},
|
|
135
|
+
required: ["artifact_id", "section_id", "heading", "content"]
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "update_section",
|
|
140
|
+
description: "Update an existing section",
|
|
141
|
+
inputSchema: {
|
|
142
|
+
type: "object",
|
|
143
|
+
properties: {
|
|
144
|
+
artifact_id: { type: "string", description: "Artifact ID" },
|
|
145
|
+
section_id: { type: "string", description: "Section ID" },
|
|
146
|
+
heading: { type: "string", description: "New heading" },
|
|
147
|
+
content: { type: "string", description: "New content" },
|
|
148
|
+
task_status: { type: "string", description: "Task status if type=task" }
|
|
149
|
+
},
|
|
150
|
+
required: ["artifact_id", "section_id"]
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "delete_section",
|
|
155
|
+
description: "Delete a section",
|
|
156
|
+
inputSchema: {
|
|
157
|
+
type: "object",
|
|
158
|
+
properties: {
|
|
159
|
+
artifact_id: { type: "string", description: "Artifact ID" },
|
|
160
|
+
section_id: { type: "string", description: "Section ID" }
|
|
161
|
+
},
|
|
162
|
+
required: ["artifact_id", "section_id"]
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
// Task tools
|
|
166
|
+
{
|
|
167
|
+
name: "list_tasks",
|
|
168
|
+
description: "List tasks (sections with type=task)",
|
|
169
|
+
inputSchema: {
|
|
170
|
+
type: "object",
|
|
171
|
+
properties: {
|
|
172
|
+
artifact_id: { type: "string", description: "Filter by artifact" },
|
|
173
|
+
status: { type: "string", description: "Filter by status: pending, in_progress, done, blocked" },
|
|
174
|
+
assignee: { type: "string", description: "Filter by assignee agent" }
|
|
175
|
+
},
|
|
176
|
+
required: []
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: "claim_task",
|
|
181
|
+
description: "Claim a task for the current agent",
|
|
182
|
+
inputSchema: {
|
|
183
|
+
type: "object",
|
|
184
|
+
properties: {
|
|
185
|
+
task_id: { type: "string", description: "Task ID (section UUID)" }
|
|
186
|
+
},
|
|
187
|
+
required: ["task_id"]
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "complete_task",
|
|
192
|
+
description: "Mark a task as complete",
|
|
193
|
+
inputSchema: {
|
|
194
|
+
type: "object",
|
|
195
|
+
properties: {
|
|
196
|
+
task_id: { type: "string", description: "Task ID" },
|
|
197
|
+
output_url: { type: "string", description: "URL to deliverable (PR, doc, etc.)" },
|
|
198
|
+
summary: { type: "string", description: "Completion summary" }
|
|
199
|
+
},
|
|
200
|
+
required: ["task_id"]
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "block_task",
|
|
205
|
+
description: "Mark a task as blocked",
|
|
206
|
+
inputSchema: {
|
|
207
|
+
type: "object",
|
|
208
|
+
properties: {
|
|
209
|
+
task_id: { type: "string", description: "Task ID" },
|
|
210
|
+
reason: { type: "string", description: "Why it is blocked" },
|
|
211
|
+
blocker_type: { type: "string", description: "Type: decision, dependency, resource, external" }
|
|
212
|
+
},
|
|
213
|
+
required: ["task_id", "reason"]
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
// Agent tools
|
|
217
|
+
{
|
|
218
|
+
name: "list_agents",
|
|
219
|
+
description: "List all agents in the organization",
|
|
220
|
+
inputSchema: {
|
|
221
|
+
type: "object",
|
|
222
|
+
properties: {
|
|
223
|
+
status: { type: "string", description: "Filter by status: active, inactive" }
|
|
224
|
+
},
|
|
225
|
+
required: []
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: "get_agent",
|
|
230
|
+
description: "Get details about an agent",
|
|
231
|
+
inputSchema: {
|
|
232
|
+
type: "object",
|
|
233
|
+
properties: {
|
|
234
|
+
agent_id: { type: "string", description: "Agent ID" }
|
|
235
|
+
},
|
|
236
|
+
required: ["agent_id"]
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: "create_agent",
|
|
241
|
+
description: "Register a new agent",
|
|
242
|
+
inputSchema: {
|
|
243
|
+
type: "object",
|
|
244
|
+
properties: {
|
|
245
|
+
agentId: { type: "string", description: 'Unique agent ID (e.g., "engineering-agent", "qa-agent")' },
|
|
246
|
+
name: { type: "string", description: "Agent display name" },
|
|
247
|
+
type: { type: "string", description: "Type: pm, engineering, qa, research, content, design" },
|
|
248
|
+
description: { type: "string", description: "What this agent does" },
|
|
249
|
+
capabilities: { type: "array", items: { type: "string" }, description: "Agent capabilities" },
|
|
250
|
+
config: { type: "object", description: "Agent configuration" }
|
|
251
|
+
},
|
|
252
|
+
required: ["agentId", "name", "type"]
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: "update_agent",
|
|
257
|
+
description: "Update an agent",
|
|
258
|
+
inputSchema: {
|
|
259
|
+
type: "object",
|
|
260
|
+
properties: {
|
|
261
|
+
agent_id: { type: "string", description: "Agent ID" },
|
|
262
|
+
name: { type: "string", description: "New name" },
|
|
263
|
+
status: { type: "string", description: "New status" },
|
|
264
|
+
config: { type: "object", description: "Updated config" }
|
|
265
|
+
},
|
|
266
|
+
required: ["agent_id"]
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
// Blocker tools
|
|
270
|
+
{
|
|
271
|
+
name: "list_blockers",
|
|
272
|
+
description: "List blockers (decisions, dependencies needing resolution)",
|
|
273
|
+
inputSchema: {
|
|
274
|
+
type: "object",
|
|
275
|
+
properties: {
|
|
276
|
+
artifact_id: { type: "string", description: "Filter by artifact" },
|
|
277
|
+
status: { type: "string", description: "Filter by status: open, resolved" }
|
|
278
|
+
},
|
|
279
|
+
required: []
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: "create_blocker",
|
|
284
|
+
description: "Create a blocker (decision request, dependency, etc.)",
|
|
285
|
+
inputSchema: {
|
|
286
|
+
type: "object",
|
|
287
|
+
properties: {
|
|
288
|
+
artifact_id: { type: "string", description: "Artifact ID" },
|
|
289
|
+
kind: { type: "string", description: "Kind: decision, dependency, resource, external" },
|
|
290
|
+
title: { type: "string", description: "Blocker title" },
|
|
291
|
+
description: { type: "string", description: "Details" },
|
|
292
|
+
options: { type: "array", description: "Options for decisions" },
|
|
293
|
+
blocked_tasks: { type: "array", items: { type: "string" }, description: "Task IDs blocked by this" }
|
|
294
|
+
},
|
|
295
|
+
required: ["artifact_id", "kind", "title"]
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: "resolve_blocker",
|
|
300
|
+
description: "Resolve a blocker",
|
|
301
|
+
inputSchema: {
|
|
302
|
+
type: "object",
|
|
303
|
+
properties: {
|
|
304
|
+
blocker_id: { type: "string", description: "Blocker ID" },
|
|
305
|
+
resolution: { type: "string", description: "How it was resolved" },
|
|
306
|
+
selected_option: { type: "string", description: "Selected option (for decisions)" }
|
|
307
|
+
},
|
|
308
|
+
required: ["blocker_id", "resolution"]
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
// Search tools
|
|
312
|
+
{
|
|
313
|
+
name: "search_artifacts",
|
|
314
|
+
description: "Search artifacts by text query",
|
|
315
|
+
inputSchema: {
|
|
316
|
+
type: "object",
|
|
317
|
+
properties: {
|
|
318
|
+
query: { type: "string", description: "Search query" },
|
|
319
|
+
type: { type: "string", description: "Filter by type" },
|
|
320
|
+
limit: { type: "number", description: "Max results" }
|
|
321
|
+
},
|
|
322
|
+
required: ["query"]
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
// Context tools
|
|
326
|
+
{
|
|
327
|
+
name: "get_task_context",
|
|
328
|
+
description: "Get full context for a task (org, project, artifact, related sections)",
|
|
329
|
+
inputSchema: {
|
|
330
|
+
type: "object",
|
|
331
|
+
properties: {
|
|
332
|
+
task_id: { type: "string", description: "Task ID" }
|
|
333
|
+
},
|
|
334
|
+
required: ["task_id"]
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
];
|
|
338
|
+
var ArtyfactsApiClient = class {
|
|
339
|
+
constructor(baseUrl, apiKey) {
|
|
340
|
+
this.baseUrl = baseUrl;
|
|
341
|
+
this.apiKey = apiKey;
|
|
342
|
+
}
|
|
343
|
+
async request(method, path, body) {
|
|
344
|
+
const url = `${this.baseUrl}${path}`;
|
|
345
|
+
const response = await fetch(url, {
|
|
346
|
+
method,
|
|
347
|
+
headers: {
|
|
348
|
+
"Authorization": `Bearer ${this.apiKey}`,
|
|
349
|
+
"Content-Type": "application/json"
|
|
350
|
+
},
|
|
351
|
+
body: body ? JSON.stringify(body) : void 0
|
|
352
|
+
});
|
|
353
|
+
if (!response.ok) {
|
|
354
|
+
const error = await response.json().catch(() => ({ error: "Request failed" }));
|
|
355
|
+
throw new Error(error.error || `HTTP ${response.status}: ${response.statusText}`);
|
|
356
|
+
}
|
|
357
|
+
return response.json();
|
|
358
|
+
}
|
|
359
|
+
get(path) {
|
|
360
|
+
return this.request("GET", path);
|
|
361
|
+
}
|
|
362
|
+
post(path, body) {
|
|
363
|
+
return this.request("POST", path, body);
|
|
364
|
+
}
|
|
365
|
+
patch(path, body) {
|
|
366
|
+
return this.request("PATCH", path, body);
|
|
367
|
+
}
|
|
368
|
+
delete(path) {
|
|
369
|
+
return this.request("DELETE", path);
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
var toolHandlers = {
|
|
373
|
+
// Organization
|
|
374
|
+
get_organization: (client) => client.get("/org"),
|
|
375
|
+
// Projects
|
|
376
|
+
list_projects: (client, args) => {
|
|
377
|
+
const params = new URLSearchParams();
|
|
378
|
+
if (args.limit) params.set("limit", String(args.limit));
|
|
379
|
+
if (args.offset) params.set("offset", String(args.offset));
|
|
380
|
+
return client.get(`/projects?${params}`);
|
|
381
|
+
},
|
|
382
|
+
get_project: (client, args) => client.get(`/projects/${args.project_id}`),
|
|
383
|
+
// Artifacts
|
|
384
|
+
list_artifacts: (client, args) => {
|
|
385
|
+
const params = new URLSearchParams();
|
|
386
|
+
if (args.project_id) params.set("project_id", String(args.project_id));
|
|
387
|
+
if (args.type) params.set("type", String(args.type));
|
|
388
|
+
if (args.status) params.set("status", String(args.status));
|
|
389
|
+
if (args.limit) params.set("limit", String(args.limit));
|
|
390
|
+
return client.get(`/artifacts?${params}`);
|
|
391
|
+
},
|
|
392
|
+
get_artifact: (client, args) => client.get(`/artifacts/${args.artifact_id}`),
|
|
393
|
+
create_artifact: (client, args) => {
|
|
394
|
+
const envelope = {
|
|
395
|
+
aah_version: "0.3",
|
|
396
|
+
artifact: {
|
|
397
|
+
id: args.id || `artifact-${Date.now()}`,
|
|
398
|
+
title: args.title,
|
|
399
|
+
type: args.type || "document/sectioned",
|
|
400
|
+
artifact_type: args.artifact_type || args.type || "doc",
|
|
401
|
+
parent_id: args.parent_id,
|
|
402
|
+
tags: args.tags
|
|
403
|
+
},
|
|
404
|
+
content: args.content ? {
|
|
405
|
+
media_type: "text/markdown",
|
|
406
|
+
body: args.content
|
|
407
|
+
} : void 0,
|
|
408
|
+
source: {
|
|
409
|
+
agent_id: "mcp-agent"
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
return client.post("/artifacts", envelope);
|
|
413
|
+
},
|
|
414
|
+
update_artifact: (client, args) => {
|
|
415
|
+
const { artifact_id, ...body } = args;
|
|
416
|
+
return client.patch(`/artifacts/${artifact_id}`, body);
|
|
417
|
+
},
|
|
418
|
+
// Sections
|
|
419
|
+
list_sections: (client, args) => client.get(`/artifacts/${args.artifact_id}/sections`),
|
|
420
|
+
get_section: (client, args) => client.get(`/artifacts/${args.artifact_id}/sections/${args.section_id}`),
|
|
421
|
+
create_section: (client, args) => {
|
|
422
|
+
const { artifact_id, section_id, ...rest } = args;
|
|
423
|
+
const body = { id: section_id, ...rest };
|
|
424
|
+
return client.post(`/artifacts/${artifact_id}/sections`, body);
|
|
425
|
+
},
|
|
426
|
+
update_section: (client, args) => {
|
|
427
|
+
const { artifact_id, section_id, ...body } = args;
|
|
428
|
+
return client.patch(`/artifacts/${artifact_id}/sections/${section_id}`, body);
|
|
429
|
+
},
|
|
430
|
+
delete_section: (client, args) => client.delete(`/artifacts/${args.artifact_id}/sections/${args.section_id}`),
|
|
431
|
+
// Tasks
|
|
432
|
+
list_tasks: (client, args) => {
|
|
433
|
+
const params = new URLSearchParams();
|
|
434
|
+
if (args.artifact_id) params.set("artifact_id", String(args.artifact_id));
|
|
435
|
+
if (args.status) params.set("status", String(args.status));
|
|
436
|
+
if (args.assignee) params.set("assignee", String(args.assignee));
|
|
437
|
+
return client.get(`/tasks?${params}`);
|
|
438
|
+
},
|
|
439
|
+
claim_task: (client, args) => client.post(`/tasks/${args.task_id}/claim`),
|
|
440
|
+
complete_task: (client, args) => {
|
|
441
|
+
const { task_id, ...body } = args;
|
|
442
|
+
return client.post(`/tasks/${task_id}/complete`, body);
|
|
443
|
+
},
|
|
444
|
+
block_task: (client, args) => {
|
|
445
|
+
const { task_id, ...body } = args;
|
|
446
|
+
return client.post(`/tasks/${task_id}/block`, body);
|
|
447
|
+
},
|
|
448
|
+
// Agents
|
|
449
|
+
list_agents: (client, args) => {
|
|
450
|
+
const params = new URLSearchParams();
|
|
451
|
+
if (args.status) params.set("status", String(args.status));
|
|
452
|
+
return client.get(`/agents?${params}`);
|
|
453
|
+
},
|
|
454
|
+
get_agent: (client, args) => client.get(`/agents/${args.agent_id}`),
|
|
455
|
+
create_agent: (client, args) => client.post("/agents", args),
|
|
456
|
+
update_agent: (client, args) => {
|
|
457
|
+
const { agent_id, ...body } = args;
|
|
458
|
+
return client.patch(`/agents/${agent_id}`, body);
|
|
459
|
+
},
|
|
460
|
+
// Blockers
|
|
461
|
+
list_blockers: (client, args) => {
|
|
462
|
+
const params = new URLSearchParams();
|
|
463
|
+
if (args.artifact_id) params.set("artifact_id", String(args.artifact_id));
|
|
464
|
+
if (args.status) params.set("status", String(args.status));
|
|
465
|
+
return client.get(`/blockers?${params}`);
|
|
466
|
+
},
|
|
467
|
+
create_blocker: (client, args) => {
|
|
468
|
+
const { artifact_id, ...body } = args;
|
|
469
|
+
return client.post(`/artifacts/${artifact_id}/blockers`, body);
|
|
470
|
+
},
|
|
471
|
+
resolve_blocker: (client, args) => {
|
|
472
|
+
const { blocker_id, ...body } = args;
|
|
473
|
+
return client.post(`/blockers/${blocker_id}/resolve`, body);
|
|
474
|
+
},
|
|
475
|
+
// Search
|
|
476
|
+
search_artifacts: (client, args) => {
|
|
477
|
+
const params = new URLSearchParams();
|
|
478
|
+
params.set("q", String(args.query));
|
|
479
|
+
if (args.type) params.set("type", String(args.type));
|
|
480
|
+
if (args.limit) params.set("limit", String(args.limit));
|
|
481
|
+
return client.get(`/search?${params}`);
|
|
482
|
+
},
|
|
483
|
+
// Context
|
|
484
|
+
get_task_context: (client, args) => client.get(`/tasks/${args.task_id}/context`)
|
|
485
|
+
};
|
|
486
|
+
var ArtyfactsMcpServer = class {
|
|
487
|
+
server;
|
|
488
|
+
client;
|
|
489
|
+
config;
|
|
490
|
+
constructor(config) {
|
|
491
|
+
this.config = config;
|
|
492
|
+
this.client = new ArtyfactsApiClient(
|
|
493
|
+
config.baseUrl || "https://artyfacts.dev/api/v1",
|
|
494
|
+
config.apiKey
|
|
495
|
+
);
|
|
496
|
+
this.server = new Server(
|
|
497
|
+
{
|
|
498
|
+
name: config.name || "artyfacts-mcp",
|
|
499
|
+
version: config.version || "1.0.0"
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
capabilities: {
|
|
503
|
+
tools: {}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
this.setupHandlers();
|
|
508
|
+
}
|
|
509
|
+
setupHandlers() {
|
|
510
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
511
|
+
return { tools: ARTYFACTS_TOOLS };
|
|
512
|
+
});
|
|
513
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
514
|
+
const { name, arguments: args } = request.params;
|
|
515
|
+
const handler = toolHandlers[name];
|
|
516
|
+
if (!handler) {
|
|
517
|
+
return {
|
|
518
|
+
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
519
|
+
isError: true
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
try {
|
|
523
|
+
const result = await handler(this.client, args || {});
|
|
524
|
+
return {
|
|
525
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
526
|
+
};
|
|
527
|
+
} catch (error) {
|
|
528
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
529
|
+
return {
|
|
530
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
531
|
+
isError: true
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
async start() {
|
|
537
|
+
const transport = new StdioServerTransport();
|
|
538
|
+
await this.server.connect(transport);
|
|
539
|
+
console.error(`Artyfacts MCP server running (${ARTYFACTS_TOOLS.length} tools)`);
|
|
540
|
+
}
|
|
541
|
+
getServer() {
|
|
542
|
+
return this.server;
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
function createMcpServer(config) {
|
|
546
|
+
return new ArtyfactsMcpServer(config);
|
|
547
|
+
}
|
|
548
|
+
async function startServer(server) {
|
|
549
|
+
await server.start();
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export {
|
|
553
|
+
ArtyfactsMcpServer,
|
|
554
|
+
createMcpServer,
|
|
555
|
+
startServer
|
|
556
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -93,18 +93,17 @@ var ARTYFACTS_TOOLS = [
|
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
name: "create_artifact",
|
|
96
|
-
description: "Create a new artifact",
|
|
96
|
+
description: "Create a new artifact (document, goal, spec, etc.)",
|
|
97
97
|
inputSchema: {
|
|
98
98
|
type: "object",
|
|
99
99
|
properties: {
|
|
100
100
|
title: { type: "string", description: "Artifact title" },
|
|
101
|
-
type: { type: "string", description: "
|
|
101
|
+
type: { type: "string", description: "Artifact type: goal, spec, research, report, experiment, decision, doc" },
|
|
102
102
|
content: { type: "string", description: "Markdown content" },
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
tags: { type: "array", items: { type: "string" }, description: "Tags" }
|
|
103
|
+
parent_id: { type: "string", description: "Parent artifact ID for nested artifacts" },
|
|
104
|
+
tags: { type: "array", items: { type: "string" }, description: "Tags for categorization" }
|
|
106
105
|
},
|
|
107
|
-
required: ["title"]
|
|
106
|
+
required: ["title", "type"]
|
|
108
107
|
}
|
|
109
108
|
},
|
|
110
109
|
{
|
|
@@ -158,7 +157,7 @@ var ARTYFACTS_TOOLS = [
|
|
|
158
157
|
type: { type: "string", description: "Type: content, task, decision, blocker" },
|
|
159
158
|
position: { type: "number", description: "Order position" }
|
|
160
159
|
},
|
|
161
|
-
required: ["artifact_id", "section_id", "heading"]
|
|
160
|
+
required: ["artifact_id", "section_id", "heading", "content"]
|
|
162
161
|
}
|
|
163
162
|
},
|
|
164
163
|
{
|
|
@@ -264,18 +263,27 @@ var ARTYFACTS_TOOLS = [
|
|
|
264
263
|
},
|
|
265
264
|
{
|
|
266
265
|
name: "create_agent",
|
|
267
|
-
description: "Register a new agent",
|
|
266
|
+
description: "Register a new AI agent with role, capabilities, and permissions",
|
|
268
267
|
inputSchema: {
|
|
269
268
|
type: "object",
|
|
270
269
|
properties: {
|
|
271
270
|
agentId: { type: "string", description: 'Unique agent ID (e.g., "engineering-agent", "qa-agent")' },
|
|
272
271
|
name: { type: "string", description: "Agent display name" },
|
|
273
|
-
|
|
274
|
-
description: { type: "string", description: "What this agent does" },
|
|
275
|
-
capabilities: { type: "array", items: { type: "string" }, description:
|
|
276
|
-
|
|
272
|
+
role: { type: "string", description: "Role: pm, engineering, qa, research, content, design" },
|
|
273
|
+
description: { type: "string", description: "What this agent does - detailed description" },
|
|
274
|
+
capabilities: { type: "array", items: { type: "string" }, description: 'List of capabilities (e.g., ["code-review", "testing", "debugging"])' },
|
|
275
|
+
permissions: {
|
|
276
|
+
type: "object",
|
|
277
|
+
description: "Permission settings",
|
|
278
|
+
properties: {
|
|
279
|
+
write: { type: "boolean", description: "Can create/edit artifacts" },
|
|
280
|
+
delete: { type: "boolean", description: "Can delete artifacts" },
|
|
281
|
+
delegate_tasks: { type: "boolean", description: "Can assign tasks to other agents" }
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
systemPrompt: { type: "string", description: "System prompt for the agent" }
|
|
277
285
|
},
|
|
278
|
-
required: ["agentId", "name", "
|
|
286
|
+
required: ["agentId", "name", "role", "description"]
|
|
279
287
|
}
|
|
280
288
|
},
|
|
281
289
|
{
|
|
@@ -416,7 +424,27 @@ var toolHandlers = {
|
|
|
416
424
|
return client.get(`/artifacts?${params}`);
|
|
417
425
|
},
|
|
418
426
|
get_artifact: (client, args) => client.get(`/artifacts/${args.artifact_id}`),
|
|
419
|
-
create_artifact: (client, args) =>
|
|
427
|
+
create_artifact: (client, args) => {
|
|
428
|
+
const envelope = {
|
|
429
|
+
aah_version: "0.3",
|
|
430
|
+
artifact: {
|
|
431
|
+
id: args.id || `artifact-${Date.now()}`,
|
|
432
|
+
title: args.title,
|
|
433
|
+
type: args.type || "document/sectioned",
|
|
434
|
+
artifact_type: args.artifact_type || args.type || "doc",
|
|
435
|
+
parent_id: args.parent_id,
|
|
436
|
+
tags: args.tags
|
|
437
|
+
},
|
|
438
|
+
content: args.content ? {
|
|
439
|
+
media_type: "text/markdown",
|
|
440
|
+
body: args.content
|
|
441
|
+
} : void 0,
|
|
442
|
+
source: {
|
|
443
|
+
agent_id: "mcp-agent"
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
return client.post("/artifacts", envelope);
|
|
447
|
+
},
|
|
420
448
|
update_artifact: (client, args) => {
|
|
421
449
|
const { artifact_id, ...body } = args;
|
|
422
450
|
return client.patch(`/artifacts/${artifact_id}`, body);
|
|
@@ -425,7 +453,8 @@ var toolHandlers = {
|
|
|
425
453
|
list_sections: (client, args) => client.get(`/artifacts/${args.artifact_id}/sections`),
|
|
426
454
|
get_section: (client, args) => client.get(`/artifacts/${args.artifact_id}/sections/${args.section_id}`),
|
|
427
455
|
create_section: (client, args) => {
|
|
428
|
-
const { artifact_id, ...
|
|
456
|
+
const { artifact_id, section_id, ...rest } = args;
|
|
457
|
+
const body = { id: section_id, ...rest };
|
|
429
458
|
return client.post(`/artifacts/${artifact_id}/sections`, body);
|
|
430
459
|
},
|
|
431
460
|
update_section: (client, args) => {
|
|
@@ -457,7 +486,21 @@ var toolHandlers = {
|
|
|
457
486
|
return client.get(`/agents?${params}`);
|
|
458
487
|
},
|
|
459
488
|
get_agent: (client, args) => client.get(`/agents/${args.agent_id}`),
|
|
460
|
-
create_agent: (client, args) =>
|
|
489
|
+
create_agent: (client, args) => {
|
|
490
|
+
const body = {
|
|
491
|
+
agentId: args.agentId,
|
|
492
|
+
name: args.name,
|
|
493
|
+
role: args.role,
|
|
494
|
+
description: args.description,
|
|
495
|
+
permissions: args.permissions || { write: true, delete: false, delegate_tasks: false },
|
|
496
|
+
metadata: {
|
|
497
|
+
capabilities: args.capabilities || [],
|
|
498
|
+
systemPrompt: args.systemPrompt,
|
|
499
|
+
createdVia: "mcp"
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
return client.post("/agents", body);
|
|
503
|
+
},
|
|
461
504
|
update_agent: (client, args) => {
|
|
462
505
|
const { agent_id, ...body } = args;
|
|
463
506
|
return client.patch(`/agents/${agent_id}`, body);
|