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