@letpeoplework/lighthouse-mcp-core 0.4.2 → 0.6.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/dist/{index.mjs → index.cjs} +253 -107
- package/dist/{index.d.mts → index.d.cts} +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +226 -133
- package/package.json +6 -2
|
@@ -1,173 +1,249 @@
|
|
|
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
|
+
|
|
1
20
|
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
createMcpCoreRuntime: () => createMcpCoreRuntime,
|
|
24
|
+
getMcpCorePackageContract: () => getMcpCorePackageContract,
|
|
25
|
+
registerMcpTools: () => registerMcpTools
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
var import_toon = require("@toon-format/toon");
|
|
29
|
+
var import_zod = require("zod");
|
|
2
30
|
var getMcpCorePackageContract = () => ({
|
|
3
31
|
name: "@letpeoplework/lighthouse-mcp-core",
|
|
4
32
|
dependsOn: "@letpeoplework/lighthouse-client",
|
|
5
33
|
transports: ["stdio", "streamable-http"]
|
|
6
34
|
});
|
|
35
|
+
var emptyInputSchema = {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {},
|
|
38
|
+
additionalProperties: false
|
|
39
|
+
};
|
|
40
|
+
var idInputSchema = {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: {
|
|
43
|
+
id: {
|
|
44
|
+
type: "integer",
|
|
45
|
+
description: "Unique numeric identifier."
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
required: ["id"],
|
|
49
|
+
additionalProperties: false
|
|
50
|
+
};
|
|
51
|
+
var dateRangeProperties = {
|
|
52
|
+
startDate: {
|
|
53
|
+
type: "string",
|
|
54
|
+
description: "Inclusive start date in ISO format (YYYY-MM-DD)."
|
|
55
|
+
},
|
|
56
|
+
endDate: {
|
|
57
|
+
type: "string",
|
|
58
|
+
description: "Inclusive end date in ISO format (YYYY-MM-DD)."
|
|
59
|
+
}
|
|
60
|
+
};
|
|
7
61
|
var toolDefinitions = [
|
|
8
62
|
{
|
|
9
63
|
name: "lighthouse.health.check",
|
|
10
|
-
description: "
|
|
11
|
-
inputSchema:
|
|
12
|
-
type: "object",
|
|
13
|
-
properties: {},
|
|
14
|
-
additionalProperties: false
|
|
15
|
-
}
|
|
64
|
+
description: "Check connectivity to Lighthouse and return whether the configured endpoint is reachable.",
|
|
65
|
+
inputSchema: emptyInputSchema
|
|
16
66
|
},
|
|
17
67
|
{
|
|
18
68
|
name: "lighthouse.version.get",
|
|
19
|
-
description: "
|
|
20
|
-
inputSchema:
|
|
21
|
-
type: "object",
|
|
22
|
-
properties: {},
|
|
23
|
-
additionalProperties: false
|
|
24
|
-
}
|
|
69
|
+
description: "Retrieve the Lighthouse server version from the version endpoint.",
|
|
70
|
+
inputSchema: emptyInputSchema
|
|
25
71
|
},
|
|
26
72
|
{
|
|
27
73
|
name: "lighthouse.worktracking.list",
|
|
28
|
-
description: "List work-tracking system connections.",
|
|
29
|
-
inputSchema:
|
|
30
|
-
type: "object",
|
|
31
|
-
properties: {},
|
|
32
|
-
additionalProperties: false
|
|
33
|
-
}
|
|
74
|
+
description: "List configured work-tracking system connections in Lighthouse.",
|
|
75
|
+
inputSchema: emptyInputSchema
|
|
34
76
|
},
|
|
35
77
|
{
|
|
36
78
|
name: "lighthouse.worktracking.get",
|
|
37
|
-
description: "Get
|
|
38
|
-
inputSchema:
|
|
39
|
-
type: "object",
|
|
40
|
-
properties: {},
|
|
41
|
-
additionalProperties: false
|
|
42
|
-
}
|
|
79
|
+
description: "Get a single work-tracking system connection by ID.",
|
|
80
|
+
inputSchema: idInputSchema
|
|
43
81
|
},
|
|
44
82
|
{
|
|
45
83
|
name: "lighthouse.team.list",
|
|
46
|
-
description: "List teams.",
|
|
47
|
-
inputSchema:
|
|
48
|
-
type: "object",
|
|
49
|
-
properties: {},
|
|
50
|
-
additionalProperties: false
|
|
51
|
-
}
|
|
84
|
+
description: "List all teams available in Lighthouse.",
|
|
85
|
+
inputSchema: emptyInputSchema
|
|
52
86
|
},
|
|
53
87
|
{
|
|
54
88
|
name: "lighthouse.team.get",
|
|
55
|
-
description: "Get one team by
|
|
56
|
-
inputSchema:
|
|
57
|
-
type: "object",
|
|
58
|
-
properties: {},
|
|
59
|
-
additionalProperties: false
|
|
60
|
-
}
|
|
89
|
+
description: "Get full details for one team by ID.",
|
|
90
|
+
inputSchema: idInputSchema
|
|
61
91
|
},
|
|
62
92
|
{
|
|
63
93
|
name: "lighthouse.team.refresh",
|
|
64
|
-
description: "Trigger
|
|
65
|
-
inputSchema:
|
|
66
|
-
type: "object",
|
|
67
|
-
properties: {},
|
|
68
|
-
additionalProperties: false
|
|
69
|
-
}
|
|
94
|
+
description: "Trigger data refresh for a team by ID.",
|
|
95
|
+
inputSchema: idInputSchema
|
|
70
96
|
},
|
|
71
97
|
{
|
|
72
98
|
name: "lighthouse.portfolio.list",
|
|
73
|
-
description: "List portfolios.",
|
|
74
|
-
inputSchema:
|
|
75
|
-
type: "object",
|
|
76
|
-
properties: {},
|
|
77
|
-
additionalProperties: false
|
|
78
|
-
}
|
|
99
|
+
description: "List all portfolios in Lighthouse.",
|
|
100
|
+
inputSchema: emptyInputSchema
|
|
79
101
|
},
|
|
80
102
|
{
|
|
81
103
|
name: "lighthouse.portfolio.get",
|
|
82
|
-
description: "Get one portfolio by
|
|
83
|
-
inputSchema:
|
|
84
|
-
type: "object",
|
|
85
|
-
properties: {},
|
|
86
|
-
additionalProperties: false
|
|
87
|
-
}
|
|
104
|
+
description: "Get full details for one portfolio by ID.",
|
|
105
|
+
inputSchema: idInputSchema
|
|
88
106
|
},
|
|
89
107
|
{
|
|
90
108
|
name: "lighthouse.portfolio.refresh",
|
|
91
|
-
description: "Trigger
|
|
92
|
-
inputSchema:
|
|
93
|
-
type: "object",
|
|
94
|
-
properties: {},
|
|
95
|
-
additionalProperties: false
|
|
96
|
-
}
|
|
109
|
+
description: "Trigger data refresh for a portfolio by ID.",
|
|
110
|
+
inputSchema: idInputSchema
|
|
97
111
|
},
|
|
98
112
|
{
|
|
99
113
|
name: "lighthouse.team.metrics.throughput",
|
|
100
|
-
description: "Get throughput run-chart data for a team
|
|
114
|
+
description: "Get throughput run-chart data for a team by ID, optionally filtered by start and end dates.",
|
|
101
115
|
inputSchema: {
|
|
102
116
|
type: "object",
|
|
103
|
-
properties: {
|
|
117
|
+
properties: {
|
|
118
|
+
...idInputSchema.properties,
|
|
119
|
+
...dateRangeProperties
|
|
120
|
+
},
|
|
121
|
+
required: ["id"],
|
|
104
122
|
additionalProperties: false
|
|
105
123
|
}
|
|
106
124
|
},
|
|
107
125
|
{
|
|
108
126
|
name: "lighthouse.team.metrics.cycleTimePercentiles",
|
|
109
|
-
description: "Get cycle-time percentiles for a team
|
|
127
|
+
description: "Get cycle-time percentiles for a team by ID, optionally filtered by start and end dates.",
|
|
110
128
|
inputSchema: {
|
|
111
129
|
type: "object",
|
|
112
|
-
properties: {
|
|
130
|
+
properties: {
|
|
131
|
+
...idInputSchema.properties,
|
|
132
|
+
...dateRangeProperties
|
|
133
|
+
},
|
|
134
|
+
required: ["id"],
|
|
113
135
|
additionalProperties: false
|
|
114
136
|
}
|
|
115
137
|
},
|
|
116
138
|
{
|
|
117
139
|
name: "lighthouse.portfolio.metrics.throughput",
|
|
118
|
-
description: "Get throughput run-chart data for a portfolio
|
|
140
|
+
description: "Get throughput run-chart data for a portfolio by ID, optionally filtered by start and end dates.",
|
|
119
141
|
inputSchema: {
|
|
120
142
|
type: "object",
|
|
121
|
-
properties: {
|
|
143
|
+
properties: {
|
|
144
|
+
...idInputSchema.properties,
|
|
145
|
+
...dateRangeProperties
|
|
146
|
+
},
|
|
147
|
+
required: ["id"],
|
|
122
148
|
additionalProperties: false
|
|
123
149
|
}
|
|
124
150
|
},
|
|
125
151
|
{
|
|
126
152
|
name: "lighthouse.feature.get",
|
|
127
|
-
description: "Get
|
|
153
|
+
description: "Get feature details by numeric IDs or external reference IDs.",
|
|
128
154
|
inputSchema: {
|
|
129
155
|
type: "object",
|
|
130
|
-
properties: {
|
|
156
|
+
properties: {
|
|
157
|
+
ids: {
|
|
158
|
+
type: "array",
|
|
159
|
+
items: {
|
|
160
|
+
type: "integer"
|
|
161
|
+
},
|
|
162
|
+
description: "Feature IDs."
|
|
163
|
+
},
|
|
164
|
+
refs: {
|
|
165
|
+
type: "array",
|
|
166
|
+
items: {
|
|
167
|
+
type: "string"
|
|
168
|
+
},
|
|
169
|
+
description: "Feature reference identifiers."
|
|
170
|
+
}
|
|
171
|
+
},
|
|
131
172
|
additionalProperties: false
|
|
132
173
|
}
|
|
133
174
|
},
|
|
134
175
|
{
|
|
135
176
|
name: "lighthouse.feature.workitems",
|
|
136
|
-
description: "Get work items
|
|
137
|
-
inputSchema:
|
|
138
|
-
type: "object",
|
|
139
|
-
properties: {},
|
|
140
|
-
additionalProperties: false
|
|
141
|
-
}
|
|
177
|
+
description: "Get work items linked to a feature by ID.",
|
|
178
|
+
inputSchema: idInputSchema
|
|
142
179
|
},
|
|
143
180
|
{
|
|
144
181
|
name: "lighthouse.delivery.list",
|
|
145
|
-
description: "List deliveries for a portfolio
|
|
146
|
-
inputSchema:
|
|
147
|
-
type: "object",
|
|
148
|
-
properties: {},
|
|
149
|
-
additionalProperties: false
|
|
150
|
-
}
|
|
182
|
+
description: "List deliveries for a portfolio by portfolio ID.",
|
|
183
|
+
inputSchema: idInputSchema
|
|
151
184
|
},
|
|
152
185
|
{
|
|
153
186
|
name: "lighthouse.forecast.manual",
|
|
154
|
-
description: "Run a manual forecast for a team
|
|
187
|
+
description: "Run a manual forecast for a team by ID with optional remaining items and target date.",
|
|
155
188
|
inputSchema: {
|
|
156
189
|
type: "object",
|
|
157
|
-
properties: {
|
|
190
|
+
properties: {
|
|
191
|
+
...idInputSchema.properties,
|
|
192
|
+
remainingItems: {
|
|
193
|
+
type: "integer",
|
|
194
|
+
description: "Remaining items to forecast."
|
|
195
|
+
},
|
|
196
|
+
targetDate: {
|
|
197
|
+
type: "string",
|
|
198
|
+
description: "Optional target date in ISO format (YYYY-MM-DD)."
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
required: ["id"],
|
|
158
202
|
additionalProperties: false
|
|
159
203
|
}
|
|
160
204
|
},
|
|
161
205
|
{
|
|
162
206
|
name: "lighthouse.forecast.backtest",
|
|
163
|
-
description: "Run a backtest
|
|
207
|
+
description: "Run a forecast backtest for a team by ID using forecast and historical date ranges.",
|
|
164
208
|
inputSchema: {
|
|
165
209
|
type: "object",
|
|
166
|
-
properties: {
|
|
210
|
+
properties: {
|
|
211
|
+
...idInputSchema.properties,
|
|
212
|
+
startDate: {
|
|
213
|
+
type: "string",
|
|
214
|
+
description: "Forecast start date in ISO format (YYYY-MM-DD)."
|
|
215
|
+
},
|
|
216
|
+
endDate: {
|
|
217
|
+
type: "string",
|
|
218
|
+
description: "Forecast end date in ISO format (YYYY-MM-DD)."
|
|
219
|
+
},
|
|
220
|
+
historicalStartDate: {
|
|
221
|
+
type: "string",
|
|
222
|
+
description: "Historical sample start date in ISO format (YYYY-MM-DD)."
|
|
223
|
+
},
|
|
224
|
+
historicalEndDate: {
|
|
225
|
+
type: "string",
|
|
226
|
+
description: "Historical sample end date in ISO format (YYYY-MM-DD)."
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
required: [
|
|
230
|
+
"id",
|
|
231
|
+
"startDate",
|
|
232
|
+
"endDate",
|
|
233
|
+
"historicalStartDate",
|
|
234
|
+
"historicalEndDate"
|
|
235
|
+
],
|
|
167
236
|
additionalProperties: false
|
|
168
237
|
}
|
|
169
238
|
}
|
|
170
239
|
];
|
|
240
|
+
var encodePayload = (value) => {
|
|
241
|
+
try {
|
|
242
|
+
return (0, import_toon.encode)(value);
|
|
243
|
+
} catch {
|
|
244
|
+
return JSON.stringify(value);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
171
247
|
var getSuccessToolResult = (text) => ({
|
|
172
248
|
isError: false,
|
|
173
249
|
content: [
|
|
@@ -210,6 +286,53 @@ var getDateRange = (argumentsPayload) => {
|
|
|
210
286
|
}
|
|
211
287
|
return void 0;
|
|
212
288
|
};
|
|
289
|
+
var isoDateStringSchema = import_zod.z.string().regex(/^\d{4}-\d{2}-\d{2}$/u, "Expected ISO date in YYYY-MM-DD format.");
|
|
290
|
+
var toolInputSchemas = {
|
|
291
|
+
"lighthouse.health.check": import_zod.z.object({}),
|
|
292
|
+
"lighthouse.version.get": import_zod.z.object({}),
|
|
293
|
+
"lighthouse.worktracking.list": import_zod.z.object({}),
|
|
294
|
+
"lighthouse.worktracking.get": import_zod.z.object({ id: import_zod.z.number().int() }),
|
|
295
|
+
"lighthouse.team.list": import_zod.z.object({}),
|
|
296
|
+
"lighthouse.team.get": import_zod.z.object({ id: import_zod.z.number().int() }),
|
|
297
|
+
"lighthouse.team.refresh": import_zod.z.object({ id: import_zod.z.number().int() }),
|
|
298
|
+
"lighthouse.portfolio.list": import_zod.z.object({}),
|
|
299
|
+
"lighthouse.portfolio.get": import_zod.z.object({ id: import_zod.z.number().int() }),
|
|
300
|
+
"lighthouse.portfolio.refresh": import_zod.z.object({ id: import_zod.z.number().int() }),
|
|
301
|
+
"lighthouse.team.metrics.throughput": import_zod.z.object({
|
|
302
|
+
id: import_zod.z.number().int(),
|
|
303
|
+
startDate: isoDateStringSchema.optional(),
|
|
304
|
+
endDate: isoDateStringSchema.optional()
|
|
305
|
+
}),
|
|
306
|
+
"lighthouse.team.metrics.cycleTimePercentiles": import_zod.z.object({
|
|
307
|
+
id: import_zod.z.number().int(),
|
|
308
|
+
startDate: isoDateStringSchema.optional(),
|
|
309
|
+
endDate: isoDateStringSchema.optional()
|
|
310
|
+
}),
|
|
311
|
+
"lighthouse.portfolio.metrics.throughput": import_zod.z.object({
|
|
312
|
+
id: import_zod.z.number().int(),
|
|
313
|
+
startDate: isoDateStringSchema.optional(),
|
|
314
|
+
endDate: isoDateStringSchema.optional()
|
|
315
|
+
}),
|
|
316
|
+
"lighthouse.feature.get": import_zod.z.object({
|
|
317
|
+
ids: import_zod.z.array(import_zod.z.number().int()).optional(),
|
|
318
|
+
refs: import_zod.z.array(import_zod.z.string()).optional()
|
|
319
|
+
}),
|
|
320
|
+
"lighthouse.feature.workitems": import_zod.z.object({ id: import_zod.z.number().int() }),
|
|
321
|
+
"lighthouse.delivery.list": import_zod.z.object({ id: import_zod.z.number().int() }),
|
|
322
|
+
"lighthouse.forecast.manual": import_zod.z.object({
|
|
323
|
+
id: import_zod.z.number().int(),
|
|
324
|
+
remainingItems: import_zod.z.number().int().optional(),
|
|
325
|
+
targetDate: isoDateStringSchema.optional()
|
|
326
|
+
}),
|
|
327
|
+
"lighthouse.forecast.backtest": import_zod.z.object({
|
|
328
|
+
id: import_zod.z.number().int(),
|
|
329
|
+
startDate: isoDateStringSchema,
|
|
330
|
+
endDate: isoDateStringSchema,
|
|
331
|
+
historicalStartDate: isoDateStringSchema,
|
|
332
|
+
historicalEndDate: isoDateStringSchema
|
|
333
|
+
})
|
|
334
|
+
};
|
|
335
|
+
var isReadOnlyTool = (toolName) => !toolName.endsWith(".refresh");
|
|
213
336
|
var createMcpCoreRuntime = (dependencies) => ({
|
|
214
337
|
listTools: () => toolDefinitions,
|
|
215
338
|
callTool: async (name, argumentsPayload) => {
|
|
@@ -219,8 +342,9 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
219
342
|
if (health.category === "success") {
|
|
220
343
|
return getSuccessToolResult("connectivity: success");
|
|
221
344
|
}
|
|
345
|
+
const healthReasonSuffix = health.reason === void 0 ? "" : ` (${health.reason})`;
|
|
222
346
|
return getErrorToolResult(
|
|
223
|
-
`connectivity: ${health.category}${
|
|
347
|
+
`connectivity: ${health.category}${healthReasonSuffix}`
|
|
224
348
|
);
|
|
225
349
|
}
|
|
226
350
|
if (name === "lighthouse.version.get") {
|
|
@@ -236,7 +360,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
236
360
|
const connections = await client.listWorkTrackingConnections();
|
|
237
361
|
if (connections.ok) {
|
|
238
362
|
return getSuccessToolResult(
|
|
239
|
-
`worktracking: ${
|
|
363
|
+
`worktracking: ${encodePayload(connections.value)}`
|
|
240
364
|
);
|
|
241
365
|
}
|
|
242
366
|
return getErrorToolResult(
|
|
@@ -251,7 +375,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
251
375
|
const connection = await client.getWorkTrackingConnection(id);
|
|
252
376
|
if (connection.ok) {
|
|
253
377
|
return getSuccessToolResult(
|
|
254
|
-
`worktracking: ${
|
|
378
|
+
`worktracking: ${encodePayload(connection.value)}`
|
|
255
379
|
);
|
|
256
380
|
}
|
|
257
381
|
return getErrorToolResult(
|
|
@@ -261,7 +385,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
261
385
|
if (name === "lighthouse.team.list") {
|
|
262
386
|
const teams = await client.listTeams();
|
|
263
387
|
if (teams.ok) {
|
|
264
|
-
return getSuccessToolResult(`teams: ${
|
|
388
|
+
return getSuccessToolResult(`teams: ${encodePayload(teams.value)}`);
|
|
265
389
|
}
|
|
266
390
|
return getErrorToolResult(
|
|
267
391
|
`teams: ${teams.error.category} (${teams.error.reason})`
|
|
@@ -274,7 +398,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
274
398
|
}
|
|
275
399
|
const team = await client.getTeam(id);
|
|
276
400
|
if (team.ok) {
|
|
277
|
-
return getSuccessToolResult(`team: ${
|
|
401
|
+
return getSuccessToolResult(`team: ${encodePayload(team.value)}`);
|
|
278
402
|
}
|
|
279
403
|
return getErrorToolResult(
|
|
280
404
|
`team: ${team.error.category} (${team.error.reason})`
|
|
@@ -297,7 +421,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
297
421
|
const portfolios = await client.listPortfolios();
|
|
298
422
|
if (portfolios.ok) {
|
|
299
423
|
return getSuccessToolResult(
|
|
300
|
-
`portfolios: ${
|
|
424
|
+
`portfolios: ${encodePayload(portfolios.value)}`
|
|
301
425
|
);
|
|
302
426
|
}
|
|
303
427
|
return getErrorToolResult(
|
|
@@ -312,7 +436,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
312
436
|
const portfolio = await client.getPortfolio(id);
|
|
313
437
|
if (portfolio.ok) {
|
|
314
438
|
return getSuccessToolResult(
|
|
315
|
-
`portfolio: ${
|
|
439
|
+
`portfolio: ${encodePayload(portfolio.value)}`
|
|
316
440
|
);
|
|
317
441
|
}
|
|
318
442
|
return getErrorToolResult(
|
|
@@ -341,7 +465,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
341
465
|
const result = await client.getTeamThroughput(id, range);
|
|
342
466
|
if (result.ok) {
|
|
343
467
|
return getSuccessToolResult(
|
|
344
|
-
`team throughput: ${
|
|
468
|
+
`team throughput: ${encodePayload(result.value)}`
|
|
345
469
|
);
|
|
346
470
|
}
|
|
347
471
|
return getErrorToolResult(
|
|
@@ -357,7 +481,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
357
481
|
const result = await client.getTeamCycleTimePercentiles(id, range);
|
|
358
482
|
if (result.ok) {
|
|
359
483
|
return getSuccessToolResult(
|
|
360
|
-
`team cycleTimePercentiles: ${
|
|
484
|
+
`team cycleTimePercentiles: ${encodePayload(result.value)}`
|
|
361
485
|
);
|
|
362
486
|
}
|
|
363
487
|
return getErrorToolResult(
|
|
@@ -373,7 +497,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
373
497
|
const result = await client.getPortfolioThroughput(id, range);
|
|
374
498
|
if (result.ok) {
|
|
375
499
|
return getSuccessToolResult(
|
|
376
|
-
`portfolio throughput: ${
|
|
500
|
+
`portfolio throughput: ${encodePayload(result.value)}`
|
|
377
501
|
);
|
|
378
502
|
}
|
|
379
503
|
return getErrorToolResult(
|
|
@@ -389,7 +513,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
389
513
|
const result = await client.getFeaturesByIds(ids);
|
|
390
514
|
if (result.ok) {
|
|
391
515
|
return getSuccessToolResult(
|
|
392
|
-
`features: ${
|
|
516
|
+
`features: ${encodePayload(result.value)}`
|
|
393
517
|
);
|
|
394
518
|
}
|
|
395
519
|
return getErrorToolResult(
|
|
@@ -403,7 +527,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
403
527
|
const result = await client.getFeaturesByReferences(refs);
|
|
404
528
|
if (result.ok) {
|
|
405
529
|
return getSuccessToolResult(
|
|
406
|
-
`features: ${
|
|
530
|
+
`features: ${encodePayload(result.value)}`
|
|
407
531
|
);
|
|
408
532
|
}
|
|
409
533
|
return getErrorToolResult(
|
|
@@ -422,7 +546,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
422
546
|
const result = await client.getFeatureWorkItems(id);
|
|
423
547
|
if (result.ok) {
|
|
424
548
|
return getSuccessToolResult(
|
|
425
|
-
`feature workitems: ${
|
|
549
|
+
`feature workitems: ${encodePayload(result.value)}`
|
|
426
550
|
);
|
|
427
551
|
}
|
|
428
552
|
return getErrorToolResult(
|
|
@@ -439,7 +563,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
439
563
|
const result = await client.listDeliveries(id);
|
|
440
564
|
if (result.ok) {
|
|
441
565
|
return getSuccessToolResult(
|
|
442
|
-
`deliveries: ${
|
|
566
|
+
`deliveries: ${encodePayload(result.value)}`
|
|
443
567
|
);
|
|
444
568
|
}
|
|
445
569
|
return getErrorToolResult(
|
|
@@ -459,9 +583,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
459
583
|
targetDate
|
|
460
584
|
});
|
|
461
585
|
if (result.ok) {
|
|
462
|
-
return getSuccessToolResult(
|
|
463
|
-
`forecast: ${JSON.stringify(result.value)}`
|
|
464
|
-
);
|
|
586
|
+
return getSuccessToolResult(`forecast: ${encodePayload(result.value)}`);
|
|
465
587
|
}
|
|
466
588
|
return getErrorToolResult(
|
|
467
589
|
`forecast: ${result.error.category} (${result.error.reason})`
|
|
@@ -489,9 +611,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
489
611
|
historicalEndDate
|
|
490
612
|
});
|
|
491
613
|
if (result.ok) {
|
|
492
|
-
return getSuccessToolResult(
|
|
493
|
-
`backtest: ${JSON.stringify(result.value)}`
|
|
494
|
-
);
|
|
614
|
+
return getSuccessToolResult(`backtest: ${encodePayload(result.value)}`);
|
|
495
615
|
}
|
|
496
616
|
return getErrorToolResult(
|
|
497
617
|
`backtest: ${result.error.category} (${result.error.reason})`
|
|
@@ -500,7 +620,33 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
500
620
|
return getErrorToolResult(`Unknown tool: ${name}`);
|
|
501
621
|
}
|
|
502
622
|
});
|
|
503
|
-
|
|
504
|
-
createMcpCoreRuntime
|
|
505
|
-
|
|
623
|
+
var registerMcpTools = (server, dependencies) => {
|
|
624
|
+
const runtime = createMcpCoreRuntime(dependencies);
|
|
625
|
+
for (const tool of toolDefinitions) {
|
|
626
|
+
server.registerTool(
|
|
627
|
+
tool.name,
|
|
628
|
+
{
|
|
629
|
+
description: tool.description,
|
|
630
|
+
inputSchema: toolInputSchemas[tool.name],
|
|
631
|
+
annotations: {
|
|
632
|
+
readOnlyHint: isReadOnlyTool(tool.name),
|
|
633
|
+
idempotentHint: isReadOnlyTool(tool.name),
|
|
634
|
+
openWorldHint: false
|
|
635
|
+
}
|
|
636
|
+
},
|
|
637
|
+
async (argumentsPayload) => {
|
|
638
|
+
const result = await runtime.callTool(tool.name, argumentsPayload);
|
|
639
|
+
return {
|
|
640
|
+
...result,
|
|
641
|
+
content: [...result.content]
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
);
|
|
645
|
+
}
|
|
506
646
|
};
|
|
647
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
648
|
+
0 && (module.exports = {
|
|
649
|
+
createMcpCoreRuntime,
|
|
650
|
+
getMcpCorePackageContract,
|
|
651
|
+
registerMcpTools
|
|
652
|
+
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
|
|
1
3
|
type McpCorePackageContract = {
|
|
2
4
|
readonly name: "@letpeoplework/lighthouse-mcp-core";
|
|
3
5
|
readonly dependsOn: "@letpeoplework/lighthouse-client";
|
|
@@ -17,7 +19,8 @@ type McpToolDefinition = {
|
|
|
17
19
|
readonly description: string;
|
|
18
20
|
readonly inputSchema: {
|
|
19
21
|
readonly type: "object";
|
|
20
|
-
readonly properties: Record<string,
|
|
22
|
+
readonly properties: Record<string, unknown>;
|
|
23
|
+
readonly required?: readonly string[];
|
|
21
24
|
readonly additionalProperties: false;
|
|
22
25
|
};
|
|
23
26
|
};
|
|
@@ -262,5 +265,6 @@ type McpCoreRuntime = {
|
|
|
262
265
|
readonly callTool: (name: string, argumentsPayload: unknown) => Promise<McpToolResult>;
|
|
263
266
|
};
|
|
264
267
|
declare const createMcpCoreRuntime: (dependencies: McpCoreRuntimeDependencies) => McpCoreRuntime;
|
|
268
|
+
declare const registerMcpTools: (server: Pick<McpServer, "registerTool">, dependencies: McpCoreRuntimeDependencies) => void;
|
|
265
269
|
|
|
266
|
-
export { type McpCorePackageContract, type McpCoreRuntime, type McpCoreRuntimeDependencies, type McpToolDefinition, type McpToolResult, createMcpCoreRuntime, getMcpCorePackageContract };
|
|
270
|
+
export { type McpCorePackageContract, type McpCoreRuntime, type McpCoreRuntimeDependencies, type McpToolDefinition, type McpToolResult, createMcpCoreRuntime, getMcpCorePackageContract, registerMcpTools };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
|
|
1
3
|
type McpCorePackageContract = {
|
|
2
4
|
readonly name: "@letpeoplework/lighthouse-mcp-core";
|
|
3
5
|
readonly dependsOn: "@letpeoplework/lighthouse-client";
|
|
@@ -17,7 +19,8 @@ type McpToolDefinition = {
|
|
|
17
19
|
readonly description: string;
|
|
18
20
|
readonly inputSchema: {
|
|
19
21
|
readonly type: "object";
|
|
20
|
-
readonly properties: Record<string,
|
|
22
|
+
readonly properties: Record<string, unknown>;
|
|
23
|
+
readonly required?: readonly string[];
|
|
21
24
|
readonly additionalProperties: false;
|
|
22
25
|
};
|
|
23
26
|
};
|
|
@@ -262,5 +265,6 @@ type McpCoreRuntime = {
|
|
|
262
265
|
readonly callTool: (name: string, argumentsPayload: unknown) => Promise<McpToolResult>;
|
|
263
266
|
};
|
|
264
267
|
declare const createMcpCoreRuntime: (dependencies: McpCoreRuntimeDependencies) => McpCoreRuntime;
|
|
268
|
+
declare const registerMcpTools: (server: Pick<McpServer, "registerTool">, dependencies: McpCoreRuntimeDependencies) => void;
|
|
265
269
|
|
|
266
|
-
export { type McpCorePackageContract, type McpCoreRuntime, type McpCoreRuntimeDependencies, type McpToolDefinition, type McpToolResult, createMcpCoreRuntime, getMcpCorePackageContract };
|
|
270
|
+
export { type McpCorePackageContract, type McpCoreRuntime, type McpCoreRuntimeDependencies, type McpToolDefinition, type McpToolResult, createMcpCoreRuntime, getMcpCorePackageContract, registerMcpTools };
|
package/dist/index.js
CHANGED
|
@@ -1,198 +1,223 @@
|
|
|
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
1
|
// src/index.ts
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
createMcpCoreRuntime: () => createMcpCoreRuntime,
|
|
24
|
-
getMcpCorePackageContract: () => getMcpCorePackageContract
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
2
|
+
import { encode } from "@toon-format/toon";
|
|
3
|
+
import { z } from "zod";
|
|
27
4
|
var getMcpCorePackageContract = () => ({
|
|
28
5
|
name: "@letpeoplework/lighthouse-mcp-core",
|
|
29
6
|
dependsOn: "@letpeoplework/lighthouse-client",
|
|
30
7
|
transports: ["stdio", "streamable-http"]
|
|
31
8
|
});
|
|
9
|
+
var emptyInputSchema = {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {},
|
|
12
|
+
additionalProperties: false
|
|
13
|
+
};
|
|
14
|
+
var idInputSchema = {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: {
|
|
17
|
+
id: {
|
|
18
|
+
type: "integer",
|
|
19
|
+
description: "Unique numeric identifier."
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
required: ["id"],
|
|
23
|
+
additionalProperties: false
|
|
24
|
+
};
|
|
25
|
+
var dateRangeProperties = {
|
|
26
|
+
startDate: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: "Inclusive start date in ISO format (YYYY-MM-DD)."
|
|
29
|
+
},
|
|
30
|
+
endDate: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "Inclusive end date in ISO format (YYYY-MM-DD)."
|
|
33
|
+
}
|
|
34
|
+
};
|
|
32
35
|
var toolDefinitions = [
|
|
33
36
|
{
|
|
34
37
|
name: "lighthouse.health.check",
|
|
35
|
-
description: "
|
|
36
|
-
inputSchema:
|
|
37
|
-
type: "object",
|
|
38
|
-
properties: {},
|
|
39
|
-
additionalProperties: false
|
|
40
|
-
}
|
|
38
|
+
description: "Check connectivity to Lighthouse and return whether the configured endpoint is reachable.",
|
|
39
|
+
inputSchema: emptyInputSchema
|
|
41
40
|
},
|
|
42
41
|
{
|
|
43
42
|
name: "lighthouse.version.get",
|
|
44
|
-
description: "
|
|
45
|
-
inputSchema:
|
|
46
|
-
type: "object",
|
|
47
|
-
properties: {},
|
|
48
|
-
additionalProperties: false
|
|
49
|
-
}
|
|
43
|
+
description: "Retrieve the Lighthouse server version from the version endpoint.",
|
|
44
|
+
inputSchema: emptyInputSchema
|
|
50
45
|
},
|
|
51
46
|
{
|
|
52
47
|
name: "lighthouse.worktracking.list",
|
|
53
|
-
description: "List work-tracking system connections.",
|
|
54
|
-
inputSchema:
|
|
55
|
-
type: "object",
|
|
56
|
-
properties: {},
|
|
57
|
-
additionalProperties: false
|
|
58
|
-
}
|
|
48
|
+
description: "List configured work-tracking system connections in Lighthouse.",
|
|
49
|
+
inputSchema: emptyInputSchema
|
|
59
50
|
},
|
|
60
51
|
{
|
|
61
52
|
name: "lighthouse.worktracking.get",
|
|
62
|
-
description: "Get
|
|
63
|
-
inputSchema:
|
|
64
|
-
type: "object",
|
|
65
|
-
properties: {},
|
|
66
|
-
additionalProperties: false
|
|
67
|
-
}
|
|
53
|
+
description: "Get a single work-tracking system connection by ID.",
|
|
54
|
+
inputSchema: idInputSchema
|
|
68
55
|
},
|
|
69
56
|
{
|
|
70
57
|
name: "lighthouse.team.list",
|
|
71
|
-
description: "List teams.",
|
|
72
|
-
inputSchema:
|
|
73
|
-
type: "object",
|
|
74
|
-
properties: {},
|
|
75
|
-
additionalProperties: false
|
|
76
|
-
}
|
|
58
|
+
description: "List all teams available in Lighthouse.",
|
|
59
|
+
inputSchema: emptyInputSchema
|
|
77
60
|
},
|
|
78
61
|
{
|
|
79
62
|
name: "lighthouse.team.get",
|
|
80
|
-
description: "Get one team by
|
|
81
|
-
inputSchema:
|
|
82
|
-
type: "object",
|
|
83
|
-
properties: {},
|
|
84
|
-
additionalProperties: false
|
|
85
|
-
}
|
|
63
|
+
description: "Get full details for one team by ID.",
|
|
64
|
+
inputSchema: idInputSchema
|
|
86
65
|
},
|
|
87
66
|
{
|
|
88
67
|
name: "lighthouse.team.refresh",
|
|
89
|
-
description: "Trigger
|
|
90
|
-
inputSchema:
|
|
91
|
-
type: "object",
|
|
92
|
-
properties: {},
|
|
93
|
-
additionalProperties: false
|
|
94
|
-
}
|
|
68
|
+
description: "Trigger data refresh for a team by ID.",
|
|
69
|
+
inputSchema: idInputSchema
|
|
95
70
|
},
|
|
96
71
|
{
|
|
97
72
|
name: "lighthouse.portfolio.list",
|
|
98
|
-
description: "List portfolios.",
|
|
99
|
-
inputSchema:
|
|
100
|
-
type: "object",
|
|
101
|
-
properties: {},
|
|
102
|
-
additionalProperties: false
|
|
103
|
-
}
|
|
73
|
+
description: "List all portfolios in Lighthouse.",
|
|
74
|
+
inputSchema: emptyInputSchema
|
|
104
75
|
},
|
|
105
76
|
{
|
|
106
77
|
name: "lighthouse.portfolio.get",
|
|
107
|
-
description: "Get one portfolio by
|
|
108
|
-
inputSchema:
|
|
109
|
-
type: "object",
|
|
110
|
-
properties: {},
|
|
111
|
-
additionalProperties: false
|
|
112
|
-
}
|
|
78
|
+
description: "Get full details for one portfolio by ID.",
|
|
79
|
+
inputSchema: idInputSchema
|
|
113
80
|
},
|
|
114
81
|
{
|
|
115
82
|
name: "lighthouse.portfolio.refresh",
|
|
116
|
-
description: "Trigger
|
|
117
|
-
inputSchema:
|
|
118
|
-
type: "object",
|
|
119
|
-
properties: {},
|
|
120
|
-
additionalProperties: false
|
|
121
|
-
}
|
|
83
|
+
description: "Trigger data refresh for a portfolio by ID.",
|
|
84
|
+
inputSchema: idInputSchema
|
|
122
85
|
},
|
|
123
86
|
{
|
|
124
87
|
name: "lighthouse.team.metrics.throughput",
|
|
125
|
-
description: "Get throughput run-chart data for a team
|
|
88
|
+
description: "Get throughput run-chart data for a team by ID, optionally filtered by start and end dates.",
|
|
126
89
|
inputSchema: {
|
|
127
90
|
type: "object",
|
|
128
|
-
properties: {
|
|
91
|
+
properties: {
|
|
92
|
+
...idInputSchema.properties,
|
|
93
|
+
...dateRangeProperties
|
|
94
|
+
},
|
|
95
|
+
required: ["id"],
|
|
129
96
|
additionalProperties: false
|
|
130
97
|
}
|
|
131
98
|
},
|
|
132
99
|
{
|
|
133
100
|
name: "lighthouse.team.metrics.cycleTimePercentiles",
|
|
134
|
-
description: "Get cycle-time percentiles for a team
|
|
101
|
+
description: "Get cycle-time percentiles for a team by ID, optionally filtered by start and end dates.",
|
|
135
102
|
inputSchema: {
|
|
136
103
|
type: "object",
|
|
137
|
-
properties: {
|
|
104
|
+
properties: {
|
|
105
|
+
...idInputSchema.properties,
|
|
106
|
+
...dateRangeProperties
|
|
107
|
+
},
|
|
108
|
+
required: ["id"],
|
|
138
109
|
additionalProperties: false
|
|
139
110
|
}
|
|
140
111
|
},
|
|
141
112
|
{
|
|
142
113
|
name: "lighthouse.portfolio.metrics.throughput",
|
|
143
|
-
description: "Get throughput run-chart data for a portfolio
|
|
114
|
+
description: "Get throughput run-chart data for a portfolio by ID, optionally filtered by start and end dates.",
|
|
144
115
|
inputSchema: {
|
|
145
116
|
type: "object",
|
|
146
|
-
properties: {
|
|
117
|
+
properties: {
|
|
118
|
+
...idInputSchema.properties,
|
|
119
|
+
...dateRangeProperties
|
|
120
|
+
},
|
|
121
|
+
required: ["id"],
|
|
147
122
|
additionalProperties: false
|
|
148
123
|
}
|
|
149
124
|
},
|
|
150
125
|
{
|
|
151
126
|
name: "lighthouse.feature.get",
|
|
152
|
-
description: "Get
|
|
127
|
+
description: "Get feature details by numeric IDs or external reference IDs.",
|
|
153
128
|
inputSchema: {
|
|
154
129
|
type: "object",
|
|
155
|
-
properties: {
|
|
130
|
+
properties: {
|
|
131
|
+
ids: {
|
|
132
|
+
type: "array",
|
|
133
|
+
items: {
|
|
134
|
+
type: "integer"
|
|
135
|
+
},
|
|
136
|
+
description: "Feature IDs."
|
|
137
|
+
},
|
|
138
|
+
refs: {
|
|
139
|
+
type: "array",
|
|
140
|
+
items: {
|
|
141
|
+
type: "string"
|
|
142
|
+
},
|
|
143
|
+
description: "Feature reference identifiers."
|
|
144
|
+
}
|
|
145
|
+
},
|
|
156
146
|
additionalProperties: false
|
|
157
147
|
}
|
|
158
148
|
},
|
|
159
149
|
{
|
|
160
150
|
name: "lighthouse.feature.workitems",
|
|
161
|
-
description: "Get work items
|
|
162
|
-
inputSchema:
|
|
163
|
-
type: "object",
|
|
164
|
-
properties: {},
|
|
165
|
-
additionalProperties: false
|
|
166
|
-
}
|
|
151
|
+
description: "Get work items linked to a feature by ID.",
|
|
152
|
+
inputSchema: idInputSchema
|
|
167
153
|
},
|
|
168
154
|
{
|
|
169
155
|
name: "lighthouse.delivery.list",
|
|
170
|
-
description: "List deliveries for a portfolio
|
|
171
|
-
inputSchema:
|
|
172
|
-
type: "object",
|
|
173
|
-
properties: {},
|
|
174
|
-
additionalProperties: false
|
|
175
|
-
}
|
|
156
|
+
description: "List deliveries for a portfolio by portfolio ID.",
|
|
157
|
+
inputSchema: idInputSchema
|
|
176
158
|
},
|
|
177
159
|
{
|
|
178
160
|
name: "lighthouse.forecast.manual",
|
|
179
|
-
description: "Run a manual forecast for a team
|
|
161
|
+
description: "Run a manual forecast for a team by ID with optional remaining items and target date.",
|
|
180
162
|
inputSchema: {
|
|
181
163
|
type: "object",
|
|
182
|
-
properties: {
|
|
164
|
+
properties: {
|
|
165
|
+
...idInputSchema.properties,
|
|
166
|
+
remainingItems: {
|
|
167
|
+
type: "integer",
|
|
168
|
+
description: "Remaining items to forecast."
|
|
169
|
+
},
|
|
170
|
+
targetDate: {
|
|
171
|
+
type: "string",
|
|
172
|
+
description: "Optional target date in ISO format (YYYY-MM-DD)."
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
required: ["id"],
|
|
183
176
|
additionalProperties: false
|
|
184
177
|
}
|
|
185
178
|
},
|
|
186
179
|
{
|
|
187
180
|
name: "lighthouse.forecast.backtest",
|
|
188
|
-
description: "Run a backtest
|
|
181
|
+
description: "Run a forecast backtest for a team by ID using forecast and historical date ranges.",
|
|
189
182
|
inputSchema: {
|
|
190
183
|
type: "object",
|
|
191
|
-
properties: {
|
|
184
|
+
properties: {
|
|
185
|
+
...idInputSchema.properties,
|
|
186
|
+
startDate: {
|
|
187
|
+
type: "string",
|
|
188
|
+
description: "Forecast start date in ISO format (YYYY-MM-DD)."
|
|
189
|
+
},
|
|
190
|
+
endDate: {
|
|
191
|
+
type: "string",
|
|
192
|
+
description: "Forecast end date in ISO format (YYYY-MM-DD)."
|
|
193
|
+
},
|
|
194
|
+
historicalStartDate: {
|
|
195
|
+
type: "string",
|
|
196
|
+
description: "Historical sample start date in ISO format (YYYY-MM-DD)."
|
|
197
|
+
},
|
|
198
|
+
historicalEndDate: {
|
|
199
|
+
type: "string",
|
|
200
|
+
description: "Historical sample end date in ISO format (YYYY-MM-DD)."
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
required: [
|
|
204
|
+
"id",
|
|
205
|
+
"startDate",
|
|
206
|
+
"endDate",
|
|
207
|
+
"historicalStartDate",
|
|
208
|
+
"historicalEndDate"
|
|
209
|
+
],
|
|
192
210
|
additionalProperties: false
|
|
193
211
|
}
|
|
194
212
|
}
|
|
195
213
|
];
|
|
214
|
+
var encodePayload = (value) => {
|
|
215
|
+
try {
|
|
216
|
+
return encode(value);
|
|
217
|
+
} catch {
|
|
218
|
+
return JSON.stringify(value);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
196
221
|
var getSuccessToolResult = (text) => ({
|
|
197
222
|
isError: false,
|
|
198
223
|
content: [
|
|
@@ -235,6 +260,53 @@ var getDateRange = (argumentsPayload) => {
|
|
|
235
260
|
}
|
|
236
261
|
return void 0;
|
|
237
262
|
};
|
|
263
|
+
var isoDateStringSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}$/u, "Expected ISO date in YYYY-MM-DD format.");
|
|
264
|
+
var toolInputSchemas = {
|
|
265
|
+
"lighthouse.health.check": z.object({}),
|
|
266
|
+
"lighthouse.version.get": z.object({}),
|
|
267
|
+
"lighthouse.worktracking.list": z.object({}),
|
|
268
|
+
"lighthouse.worktracking.get": z.object({ id: z.number().int() }),
|
|
269
|
+
"lighthouse.team.list": z.object({}),
|
|
270
|
+
"lighthouse.team.get": z.object({ id: z.number().int() }),
|
|
271
|
+
"lighthouse.team.refresh": z.object({ id: z.number().int() }),
|
|
272
|
+
"lighthouse.portfolio.list": z.object({}),
|
|
273
|
+
"lighthouse.portfolio.get": z.object({ id: z.number().int() }),
|
|
274
|
+
"lighthouse.portfolio.refresh": z.object({ id: z.number().int() }),
|
|
275
|
+
"lighthouse.team.metrics.throughput": z.object({
|
|
276
|
+
id: z.number().int(),
|
|
277
|
+
startDate: isoDateStringSchema.optional(),
|
|
278
|
+
endDate: isoDateStringSchema.optional()
|
|
279
|
+
}),
|
|
280
|
+
"lighthouse.team.metrics.cycleTimePercentiles": z.object({
|
|
281
|
+
id: z.number().int(),
|
|
282
|
+
startDate: isoDateStringSchema.optional(),
|
|
283
|
+
endDate: isoDateStringSchema.optional()
|
|
284
|
+
}),
|
|
285
|
+
"lighthouse.portfolio.metrics.throughput": z.object({
|
|
286
|
+
id: z.number().int(),
|
|
287
|
+
startDate: isoDateStringSchema.optional(),
|
|
288
|
+
endDate: isoDateStringSchema.optional()
|
|
289
|
+
}),
|
|
290
|
+
"lighthouse.feature.get": z.object({
|
|
291
|
+
ids: z.array(z.number().int()).optional(),
|
|
292
|
+
refs: z.array(z.string()).optional()
|
|
293
|
+
}),
|
|
294
|
+
"lighthouse.feature.workitems": z.object({ id: z.number().int() }),
|
|
295
|
+
"lighthouse.delivery.list": z.object({ id: z.number().int() }),
|
|
296
|
+
"lighthouse.forecast.manual": z.object({
|
|
297
|
+
id: z.number().int(),
|
|
298
|
+
remainingItems: z.number().int().optional(),
|
|
299
|
+
targetDate: isoDateStringSchema.optional()
|
|
300
|
+
}),
|
|
301
|
+
"lighthouse.forecast.backtest": z.object({
|
|
302
|
+
id: z.number().int(),
|
|
303
|
+
startDate: isoDateStringSchema,
|
|
304
|
+
endDate: isoDateStringSchema,
|
|
305
|
+
historicalStartDate: isoDateStringSchema,
|
|
306
|
+
historicalEndDate: isoDateStringSchema
|
|
307
|
+
})
|
|
308
|
+
};
|
|
309
|
+
var isReadOnlyTool = (toolName) => !toolName.endsWith(".refresh");
|
|
238
310
|
var createMcpCoreRuntime = (dependencies) => ({
|
|
239
311
|
listTools: () => toolDefinitions,
|
|
240
312
|
callTool: async (name, argumentsPayload) => {
|
|
@@ -244,8 +316,9 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
244
316
|
if (health.category === "success") {
|
|
245
317
|
return getSuccessToolResult("connectivity: success");
|
|
246
318
|
}
|
|
319
|
+
const healthReasonSuffix = health.reason === void 0 ? "" : ` (${health.reason})`;
|
|
247
320
|
return getErrorToolResult(
|
|
248
|
-
`connectivity: ${health.category}${
|
|
321
|
+
`connectivity: ${health.category}${healthReasonSuffix}`
|
|
249
322
|
);
|
|
250
323
|
}
|
|
251
324
|
if (name === "lighthouse.version.get") {
|
|
@@ -261,7 +334,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
261
334
|
const connections = await client.listWorkTrackingConnections();
|
|
262
335
|
if (connections.ok) {
|
|
263
336
|
return getSuccessToolResult(
|
|
264
|
-
`worktracking: ${
|
|
337
|
+
`worktracking: ${encodePayload(connections.value)}`
|
|
265
338
|
);
|
|
266
339
|
}
|
|
267
340
|
return getErrorToolResult(
|
|
@@ -276,7 +349,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
276
349
|
const connection = await client.getWorkTrackingConnection(id);
|
|
277
350
|
if (connection.ok) {
|
|
278
351
|
return getSuccessToolResult(
|
|
279
|
-
`worktracking: ${
|
|
352
|
+
`worktracking: ${encodePayload(connection.value)}`
|
|
280
353
|
);
|
|
281
354
|
}
|
|
282
355
|
return getErrorToolResult(
|
|
@@ -286,7 +359,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
286
359
|
if (name === "lighthouse.team.list") {
|
|
287
360
|
const teams = await client.listTeams();
|
|
288
361
|
if (teams.ok) {
|
|
289
|
-
return getSuccessToolResult(`teams: ${
|
|
362
|
+
return getSuccessToolResult(`teams: ${encodePayload(teams.value)}`);
|
|
290
363
|
}
|
|
291
364
|
return getErrorToolResult(
|
|
292
365
|
`teams: ${teams.error.category} (${teams.error.reason})`
|
|
@@ -299,7 +372,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
299
372
|
}
|
|
300
373
|
const team = await client.getTeam(id);
|
|
301
374
|
if (team.ok) {
|
|
302
|
-
return getSuccessToolResult(`team: ${
|
|
375
|
+
return getSuccessToolResult(`team: ${encodePayload(team.value)}`);
|
|
303
376
|
}
|
|
304
377
|
return getErrorToolResult(
|
|
305
378
|
`team: ${team.error.category} (${team.error.reason})`
|
|
@@ -322,7 +395,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
322
395
|
const portfolios = await client.listPortfolios();
|
|
323
396
|
if (portfolios.ok) {
|
|
324
397
|
return getSuccessToolResult(
|
|
325
|
-
`portfolios: ${
|
|
398
|
+
`portfolios: ${encodePayload(portfolios.value)}`
|
|
326
399
|
);
|
|
327
400
|
}
|
|
328
401
|
return getErrorToolResult(
|
|
@@ -337,7 +410,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
337
410
|
const portfolio = await client.getPortfolio(id);
|
|
338
411
|
if (portfolio.ok) {
|
|
339
412
|
return getSuccessToolResult(
|
|
340
|
-
`portfolio: ${
|
|
413
|
+
`portfolio: ${encodePayload(portfolio.value)}`
|
|
341
414
|
);
|
|
342
415
|
}
|
|
343
416
|
return getErrorToolResult(
|
|
@@ -366,7 +439,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
366
439
|
const result = await client.getTeamThroughput(id, range);
|
|
367
440
|
if (result.ok) {
|
|
368
441
|
return getSuccessToolResult(
|
|
369
|
-
`team throughput: ${
|
|
442
|
+
`team throughput: ${encodePayload(result.value)}`
|
|
370
443
|
);
|
|
371
444
|
}
|
|
372
445
|
return getErrorToolResult(
|
|
@@ -382,7 +455,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
382
455
|
const result = await client.getTeamCycleTimePercentiles(id, range);
|
|
383
456
|
if (result.ok) {
|
|
384
457
|
return getSuccessToolResult(
|
|
385
|
-
`team cycleTimePercentiles: ${
|
|
458
|
+
`team cycleTimePercentiles: ${encodePayload(result.value)}`
|
|
386
459
|
);
|
|
387
460
|
}
|
|
388
461
|
return getErrorToolResult(
|
|
@@ -398,7 +471,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
398
471
|
const result = await client.getPortfolioThroughput(id, range);
|
|
399
472
|
if (result.ok) {
|
|
400
473
|
return getSuccessToolResult(
|
|
401
|
-
`portfolio throughput: ${
|
|
474
|
+
`portfolio throughput: ${encodePayload(result.value)}`
|
|
402
475
|
);
|
|
403
476
|
}
|
|
404
477
|
return getErrorToolResult(
|
|
@@ -414,7 +487,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
414
487
|
const result = await client.getFeaturesByIds(ids);
|
|
415
488
|
if (result.ok) {
|
|
416
489
|
return getSuccessToolResult(
|
|
417
|
-
`features: ${
|
|
490
|
+
`features: ${encodePayload(result.value)}`
|
|
418
491
|
);
|
|
419
492
|
}
|
|
420
493
|
return getErrorToolResult(
|
|
@@ -428,7 +501,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
428
501
|
const result = await client.getFeaturesByReferences(refs);
|
|
429
502
|
if (result.ok) {
|
|
430
503
|
return getSuccessToolResult(
|
|
431
|
-
`features: ${
|
|
504
|
+
`features: ${encodePayload(result.value)}`
|
|
432
505
|
);
|
|
433
506
|
}
|
|
434
507
|
return getErrorToolResult(
|
|
@@ -447,7 +520,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
447
520
|
const result = await client.getFeatureWorkItems(id);
|
|
448
521
|
if (result.ok) {
|
|
449
522
|
return getSuccessToolResult(
|
|
450
|
-
`feature workitems: ${
|
|
523
|
+
`feature workitems: ${encodePayload(result.value)}`
|
|
451
524
|
);
|
|
452
525
|
}
|
|
453
526
|
return getErrorToolResult(
|
|
@@ -464,7 +537,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
464
537
|
const result = await client.listDeliveries(id);
|
|
465
538
|
if (result.ok) {
|
|
466
539
|
return getSuccessToolResult(
|
|
467
|
-
`deliveries: ${
|
|
540
|
+
`deliveries: ${encodePayload(result.value)}`
|
|
468
541
|
);
|
|
469
542
|
}
|
|
470
543
|
return getErrorToolResult(
|
|
@@ -484,9 +557,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
484
557
|
targetDate
|
|
485
558
|
});
|
|
486
559
|
if (result.ok) {
|
|
487
|
-
return getSuccessToolResult(
|
|
488
|
-
`forecast: ${JSON.stringify(result.value)}`
|
|
489
|
-
);
|
|
560
|
+
return getSuccessToolResult(`forecast: ${encodePayload(result.value)}`);
|
|
490
561
|
}
|
|
491
562
|
return getErrorToolResult(
|
|
492
563
|
`forecast: ${result.error.category} (${result.error.reason})`
|
|
@@ -514,9 +585,7 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
514
585
|
historicalEndDate
|
|
515
586
|
});
|
|
516
587
|
if (result.ok) {
|
|
517
|
-
return getSuccessToolResult(
|
|
518
|
-
`backtest: ${JSON.stringify(result.value)}`
|
|
519
|
-
);
|
|
588
|
+
return getSuccessToolResult(`backtest: ${encodePayload(result.value)}`);
|
|
520
589
|
}
|
|
521
590
|
return getErrorToolResult(
|
|
522
591
|
`backtest: ${result.error.category} (${result.error.reason})`
|
|
@@ -525,8 +594,32 @@ var createMcpCoreRuntime = (dependencies) => ({
|
|
|
525
594
|
return getErrorToolResult(`Unknown tool: ${name}`);
|
|
526
595
|
}
|
|
527
596
|
});
|
|
528
|
-
|
|
529
|
-
|
|
597
|
+
var registerMcpTools = (server, dependencies) => {
|
|
598
|
+
const runtime = createMcpCoreRuntime(dependencies);
|
|
599
|
+
for (const tool of toolDefinitions) {
|
|
600
|
+
server.registerTool(
|
|
601
|
+
tool.name,
|
|
602
|
+
{
|
|
603
|
+
description: tool.description,
|
|
604
|
+
inputSchema: toolInputSchemas[tool.name],
|
|
605
|
+
annotations: {
|
|
606
|
+
readOnlyHint: isReadOnlyTool(tool.name),
|
|
607
|
+
idempotentHint: isReadOnlyTool(tool.name),
|
|
608
|
+
openWorldHint: false
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
async (argumentsPayload) => {
|
|
612
|
+
const result = await runtime.callTool(tool.name, argumentsPayload);
|
|
613
|
+
return {
|
|
614
|
+
...result,
|
|
615
|
+
content: [...result.content]
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
export {
|
|
530
622
|
createMcpCoreRuntime,
|
|
531
|
-
getMcpCorePackageContract
|
|
532
|
-
|
|
623
|
+
getMcpCorePackageContract,
|
|
624
|
+
registerMcpTools
|
|
625
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letpeoplework/lighthouse-mcp-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Shared MCP semantics for Lighthouse",
|
|
5
5
|
"repository": "https://github.com/LetPeopleWork/lighthouse-clients",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"main": "dist/index.cjs",
|
|
7
8
|
"module": "dist/index.js",
|
|
8
9
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +23,10 @@
|
|
|
22
23
|
"registry": "https://registry.npmjs.org/"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@
|
|
26
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
27
|
+
"@toon-format/toon": "^2.1.0",
|
|
28
|
+
"zod": "^3.24.1",
|
|
29
|
+
"@letpeoplework/lighthouse-client": "0.8.0"
|
|
26
30
|
},
|
|
27
31
|
"scripts": {
|
|
28
32
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|