@letpeoplework/lighthouse-mcp-core 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 LetPeopleWork
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,129 @@
1
+ type McpCorePackageContract = {
2
+ readonly name: "@letpeoplework/lighthouse-mcp-core";
3
+ readonly dependsOn: "@letpeoplework/lighthouse-client";
4
+ readonly transports: readonly ["stdio", "streamable-http"];
5
+ };
6
+ declare const getMcpCorePackageContract: () => McpCorePackageContract;
7
+ type McpToolContent = {
8
+ readonly type: "text";
9
+ readonly text: string;
10
+ };
11
+ type McpToolResult = {
12
+ readonly isError: boolean;
13
+ readonly content: readonly McpToolContent[];
14
+ };
15
+ type McpToolDefinition = {
16
+ readonly name: "lighthouse.health.check" | "lighthouse.version.get" | "lighthouse.worktracking.list" | "lighthouse.worktracking.get" | "lighthouse.team.list" | "lighthouse.team.get" | "lighthouse.team.refresh" | "lighthouse.portfolio.list" | "lighthouse.portfolio.get" | "lighthouse.portfolio.refresh";
17
+ readonly description: string;
18
+ readonly inputSchema: {
19
+ readonly type: "object";
20
+ readonly properties: Record<string, never>;
21
+ readonly additionalProperties: false;
22
+ };
23
+ };
24
+ type McpRuntimeClient = {
25
+ readonly checkConnectivity: () => Promise<{
26
+ readonly category: "success" | "unreachable" | "misconfigured" | "unauthorized" | "dependency-failure" | "unexpected";
27
+ readonly reason?: string;
28
+ }>;
29
+ readonly getVersion: () => Promise<{
30
+ readonly ok: true;
31
+ readonly value: string;
32
+ } | {
33
+ readonly ok: false;
34
+ readonly error: {
35
+ readonly category: string;
36
+ readonly reason: string;
37
+ };
38
+ }>;
39
+ readonly listWorkTrackingConnections: () => Promise<{
40
+ readonly ok: true;
41
+ readonly value: readonly unknown[];
42
+ } | {
43
+ readonly ok: false;
44
+ readonly error: {
45
+ readonly category: string;
46
+ readonly reason: string;
47
+ };
48
+ }>;
49
+ readonly getWorkTrackingConnection: (id: number) => Promise<{
50
+ readonly ok: true;
51
+ readonly value: unknown;
52
+ } | {
53
+ readonly ok: false;
54
+ readonly error: {
55
+ readonly category: string;
56
+ readonly reason: string;
57
+ };
58
+ }>;
59
+ readonly listTeams: () => Promise<{
60
+ readonly ok: true;
61
+ readonly value: readonly unknown[];
62
+ } | {
63
+ readonly ok: false;
64
+ readonly error: {
65
+ readonly category: string;
66
+ readonly reason: string;
67
+ };
68
+ }>;
69
+ readonly getTeam: (id: number) => Promise<{
70
+ readonly ok: true;
71
+ readonly value: unknown;
72
+ } | {
73
+ readonly ok: false;
74
+ readonly error: {
75
+ readonly category: string;
76
+ readonly reason: string;
77
+ };
78
+ }>;
79
+ readonly refreshTeam: (id: number) => Promise<{
80
+ readonly ok: true;
81
+ readonly value: unknown;
82
+ } | {
83
+ readonly ok: false;
84
+ readonly error: {
85
+ readonly category: string;
86
+ readonly reason: string;
87
+ };
88
+ }>;
89
+ readonly listPortfolios: () => Promise<{
90
+ readonly ok: true;
91
+ readonly value: readonly unknown[];
92
+ } | {
93
+ readonly ok: false;
94
+ readonly error: {
95
+ readonly category: string;
96
+ readonly reason: string;
97
+ };
98
+ }>;
99
+ readonly getPortfolio: (id: number) => Promise<{
100
+ readonly ok: true;
101
+ readonly value: unknown;
102
+ } | {
103
+ readonly ok: false;
104
+ readonly error: {
105
+ readonly category: string;
106
+ readonly reason: string;
107
+ };
108
+ }>;
109
+ readonly refreshPortfolio: (id: number) => Promise<{
110
+ readonly ok: true;
111
+ readonly value: unknown;
112
+ } | {
113
+ readonly ok: false;
114
+ readonly error: {
115
+ readonly category: string;
116
+ readonly reason: string;
117
+ };
118
+ }>;
119
+ };
120
+ type McpCoreRuntimeDependencies = {
121
+ readonly createClient: () => McpRuntimeClient;
122
+ };
123
+ type McpCoreRuntime = {
124
+ readonly listTools: () => readonly McpToolDefinition[];
125
+ readonly callTool: (name: string, argumentsPayload: unknown) => Promise<McpToolResult>;
126
+ };
127
+ declare const createMcpCoreRuntime: (dependencies: McpCoreRuntimeDependencies) => McpCoreRuntime;
128
+
129
+ export { type McpCorePackageContract, type McpCoreRuntime, type McpCoreRuntimeDependencies, type McpToolDefinition, type McpToolResult, createMcpCoreRuntime, getMcpCorePackageContract };
@@ -0,0 +1,129 @@
1
+ type McpCorePackageContract = {
2
+ readonly name: "@letpeoplework/lighthouse-mcp-core";
3
+ readonly dependsOn: "@letpeoplework/lighthouse-client";
4
+ readonly transports: readonly ["stdio", "streamable-http"];
5
+ };
6
+ declare const getMcpCorePackageContract: () => McpCorePackageContract;
7
+ type McpToolContent = {
8
+ readonly type: "text";
9
+ readonly text: string;
10
+ };
11
+ type McpToolResult = {
12
+ readonly isError: boolean;
13
+ readonly content: readonly McpToolContent[];
14
+ };
15
+ type McpToolDefinition = {
16
+ readonly name: "lighthouse.health.check" | "lighthouse.version.get" | "lighthouse.worktracking.list" | "lighthouse.worktracking.get" | "lighthouse.team.list" | "lighthouse.team.get" | "lighthouse.team.refresh" | "lighthouse.portfolio.list" | "lighthouse.portfolio.get" | "lighthouse.portfolio.refresh";
17
+ readonly description: string;
18
+ readonly inputSchema: {
19
+ readonly type: "object";
20
+ readonly properties: Record<string, never>;
21
+ readonly additionalProperties: false;
22
+ };
23
+ };
24
+ type McpRuntimeClient = {
25
+ readonly checkConnectivity: () => Promise<{
26
+ readonly category: "success" | "unreachable" | "misconfigured" | "unauthorized" | "dependency-failure" | "unexpected";
27
+ readonly reason?: string;
28
+ }>;
29
+ readonly getVersion: () => Promise<{
30
+ readonly ok: true;
31
+ readonly value: string;
32
+ } | {
33
+ readonly ok: false;
34
+ readonly error: {
35
+ readonly category: string;
36
+ readonly reason: string;
37
+ };
38
+ }>;
39
+ readonly listWorkTrackingConnections: () => Promise<{
40
+ readonly ok: true;
41
+ readonly value: readonly unknown[];
42
+ } | {
43
+ readonly ok: false;
44
+ readonly error: {
45
+ readonly category: string;
46
+ readonly reason: string;
47
+ };
48
+ }>;
49
+ readonly getWorkTrackingConnection: (id: number) => Promise<{
50
+ readonly ok: true;
51
+ readonly value: unknown;
52
+ } | {
53
+ readonly ok: false;
54
+ readonly error: {
55
+ readonly category: string;
56
+ readonly reason: string;
57
+ };
58
+ }>;
59
+ readonly listTeams: () => Promise<{
60
+ readonly ok: true;
61
+ readonly value: readonly unknown[];
62
+ } | {
63
+ readonly ok: false;
64
+ readonly error: {
65
+ readonly category: string;
66
+ readonly reason: string;
67
+ };
68
+ }>;
69
+ readonly getTeam: (id: number) => Promise<{
70
+ readonly ok: true;
71
+ readonly value: unknown;
72
+ } | {
73
+ readonly ok: false;
74
+ readonly error: {
75
+ readonly category: string;
76
+ readonly reason: string;
77
+ };
78
+ }>;
79
+ readonly refreshTeam: (id: number) => Promise<{
80
+ readonly ok: true;
81
+ readonly value: unknown;
82
+ } | {
83
+ readonly ok: false;
84
+ readonly error: {
85
+ readonly category: string;
86
+ readonly reason: string;
87
+ };
88
+ }>;
89
+ readonly listPortfolios: () => Promise<{
90
+ readonly ok: true;
91
+ readonly value: readonly unknown[];
92
+ } | {
93
+ readonly ok: false;
94
+ readonly error: {
95
+ readonly category: string;
96
+ readonly reason: string;
97
+ };
98
+ }>;
99
+ readonly getPortfolio: (id: number) => Promise<{
100
+ readonly ok: true;
101
+ readonly value: unknown;
102
+ } | {
103
+ readonly ok: false;
104
+ readonly error: {
105
+ readonly category: string;
106
+ readonly reason: string;
107
+ };
108
+ }>;
109
+ readonly refreshPortfolio: (id: number) => Promise<{
110
+ readonly ok: true;
111
+ readonly value: unknown;
112
+ } | {
113
+ readonly ok: false;
114
+ readonly error: {
115
+ readonly category: string;
116
+ readonly reason: string;
117
+ };
118
+ }>;
119
+ };
120
+ type McpCoreRuntimeDependencies = {
121
+ readonly createClient: () => McpRuntimeClient;
122
+ };
123
+ type McpCoreRuntime = {
124
+ readonly listTools: () => readonly McpToolDefinition[];
125
+ readonly callTool: (name: string, argumentsPayload: unknown) => Promise<McpToolResult>;
126
+ };
127
+ declare const createMcpCoreRuntime: (dependencies: McpCoreRuntimeDependencies) => McpCoreRuntime;
128
+
129
+ export { type McpCorePackageContract, type McpCoreRuntime, type McpCoreRuntimeDependencies, type McpToolDefinition, type McpToolResult, createMcpCoreRuntime, getMcpCorePackageContract };
package/dist/index.js ADDED
@@ -0,0 +1,281 @@
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
+ createMcpCoreRuntime: () => createMcpCoreRuntime,
24
+ getMcpCorePackageContract: () => getMcpCorePackageContract
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+ var getMcpCorePackageContract = () => ({
28
+ name: "@letpeoplework/lighthouse-mcp-core",
29
+ dependsOn: "@letpeoplework/lighthouse-client",
30
+ transports: ["stdio", "streamable-http"]
31
+ });
32
+ var toolDefinitions = [
33
+ {
34
+ name: "lighthouse.health.check",
35
+ description: "Validate Lighthouse API connectivity.",
36
+ inputSchema: {
37
+ type: "object",
38
+ properties: {},
39
+ additionalProperties: false
40
+ }
41
+ },
42
+ {
43
+ name: "lighthouse.version.get",
44
+ description: "Get Lighthouse version from /api/v1/version.",
45
+ inputSchema: {
46
+ type: "object",
47
+ properties: {},
48
+ additionalProperties: false
49
+ }
50
+ },
51
+ {
52
+ name: "lighthouse.worktracking.list",
53
+ description: "List work-tracking system connections.",
54
+ inputSchema: {
55
+ type: "object",
56
+ properties: {},
57
+ additionalProperties: false
58
+ }
59
+ },
60
+ {
61
+ name: "lighthouse.worktracking.get",
62
+ description: "Get one work-tracking system connection by id.",
63
+ inputSchema: {
64
+ type: "object",
65
+ properties: {},
66
+ additionalProperties: false
67
+ }
68
+ },
69
+ {
70
+ name: "lighthouse.team.list",
71
+ description: "List teams.",
72
+ inputSchema: {
73
+ type: "object",
74
+ properties: {},
75
+ additionalProperties: false
76
+ }
77
+ },
78
+ {
79
+ name: "lighthouse.team.get",
80
+ description: "Get one team by id.",
81
+ inputSchema: {
82
+ type: "object",
83
+ properties: {},
84
+ additionalProperties: false
85
+ }
86
+ },
87
+ {
88
+ name: "lighthouse.team.refresh",
89
+ description: "Trigger a refresh for one team.",
90
+ inputSchema: {
91
+ type: "object",
92
+ properties: {},
93
+ additionalProperties: false
94
+ }
95
+ },
96
+ {
97
+ name: "lighthouse.portfolio.list",
98
+ description: "List portfolios.",
99
+ inputSchema: {
100
+ type: "object",
101
+ properties: {},
102
+ additionalProperties: false
103
+ }
104
+ },
105
+ {
106
+ name: "lighthouse.portfolio.get",
107
+ description: "Get one portfolio by id.",
108
+ inputSchema: {
109
+ type: "object",
110
+ properties: {},
111
+ additionalProperties: false
112
+ }
113
+ },
114
+ {
115
+ name: "lighthouse.portfolio.refresh",
116
+ description: "Trigger a refresh for one portfolio.",
117
+ inputSchema: {
118
+ type: "object",
119
+ properties: {},
120
+ additionalProperties: false
121
+ }
122
+ }
123
+ ];
124
+ var getSuccessToolResult = (text) => ({
125
+ isError: false,
126
+ content: [
127
+ {
128
+ type: "text",
129
+ text
130
+ }
131
+ ]
132
+ });
133
+ var getErrorToolResult = (text) => ({
134
+ isError: true,
135
+ content: [
136
+ {
137
+ type: "text",
138
+ text
139
+ }
140
+ ]
141
+ });
142
+ var getNumericId = (argumentsPayload) => {
143
+ if (typeof argumentsPayload !== "object" || argumentsPayload === null || Array.isArray(argumentsPayload)) {
144
+ return null;
145
+ }
146
+ const value = argumentsPayload.id;
147
+ if (typeof value === "number" && Number.isInteger(value)) {
148
+ return value;
149
+ }
150
+ return null;
151
+ };
152
+ var createMcpCoreRuntime = (dependencies) => ({
153
+ listTools: () => toolDefinitions,
154
+ callTool: async (name, argumentsPayload) => {
155
+ const client = dependencies.createClient();
156
+ if (name === "lighthouse.health.check") {
157
+ const health = await client.checkConnectivity();
158
+ if (health.category === "success") {
159
+ return getSuccessToolResult("connectivity: success");
160
+ }
161
+ return getErrorToolResult(
162
+ `connectivity: ${health.category}${health.reason !== void 0 ? ` (${health.reason})` : ""}`
163
+ );
164
+ }
165
+ if (name === "lighthouse.version.get") {
166
+ const version = await client.getVersion();
167
+ if (version.ok) {
168
+ return getSuccessToolResult(`version: ${version.value}`);
169
+ }
170
+ return getErrorToolResult(
171
+ `version: ${version.error.category} (${version.error.reason})`
172
+ );
173
+ }
174
+ if (name === "lighthouse.worktracking.list") {
175
+ const connections = await client.listWorkTrackingConnections();
176
+ if (connections.ok) {
177
+ return getSuccessToolResult(
178
+ `worktracking: ${JSON.stringify(connections.value)}`
179
+ );
180
+ }
181
+ return getErrorToolResult(
182
+ `worktracking: ${connections.error.category} (${connections.error.reason})`
183
+ );
184
+ }
185
+ if (name === "lighthouse.worktracking.get") {
186
+ const id = getNumericId(argumentsPayload);
187
+ if (id === null) {
188
+ return getErrorToolResult("worktracking: invalid id");
189
+ }
190
+ const connection = await client.getWorkTrackingConnection(id);
191
+ if (connection.ok) {
192
+ return getSuccessToolResult(
193
+ `worktracking: ${JSON.stringify(connection.value)}`
194
+ );
195
+ }
196
+ return getErrorToolResult(
197
+ `worktracking: ${connection.error.category} (${connection.error.reason})`
198
+ );
199
+ }
200
+ if (name === "lighthouse.team.list") {
201
+ const teams = await client.listTeams();
202
+ if (teams.ok) {
203
+ return getSuccessToolResult(`teams: ${JSON.stringify(teams.value)}`);
204
+ }
205
+ return getErrorToolResult(
206
+ `teams: ${teams.error.category} (${teams.error.reason})`
207
+ );
208
+ }
209
+ if (name === "lighthouse.team.get") {
210
+ const id = getNumericId(argumentsPayload);
211
+ if (id === null) {
212
+ return getErrorToolResult("team: invalid id");
213
+ }
214
+ const team = await client.getTeam(id);
215
+ if (team.ok) {
216
+ return getSuccessToolResult(`team: ${JSON.stringify(team.value)}`);
217
+ }
218
+ return getErrorToolResult(
219
+ `team: ${team.error.category} (${team.error.reason})`
220
+ );
221
+ }
222
+ if (name === "lighthouse.team.refresh") {
223
+ const id = getNumericId(argumentsPayload);
224
+ if (id === null) {
225
+ return getErrorToolResult("team: invalid id");
226
+ }
227
+ const result = await client.refreshTeam(id);
228
+ if (result.ok) {
229
+ return getSuccessToolResult(`team refreshed: ${id}`);
230
+ }
231
+ return getErrorToolResult(
232
+ `team refresh: ${result.error.category} (${result.error.reason})`
233
+ );
234
+ }
235
+ if (name === "lighthouse.portfolio.list") {
236
+ const portfolios = await client.listPortfolios();
237
+ if (portfolios.ok) {
238
+ return getSuccessToolResult(
239
+ `portfolios: ${JSON.stringify(portfolios.value)}`
240
+ );
241
+ }
242
+ return getErrorToolResult(
243
+ `portfolios: ${portfolios.error.category} (${portfolios.error.reason})`
244
+ );
245
+ }
246
+ if (name === "lighthouse.portfolio.get") {
247
+ const id = getNumericId(argumentsPayload);
248
+ if (id === null) {
249
+ return getErrorToolResult("portfolio: invalid id");
250
+ }
251
+ const portfolio = await client.getPortfolio(id);
252
+ if (portfolio.ok) {
253
+ return getSuccessToolResult(
254
+ `portfolio: ${JSON.stringify(portfolio.value)}`
255
+ );
256
+ }
257
+ return getErrorToolResult(
258
+ `portfolio: ${portfolio.error.category} (${portfolio.error.reason})`
259
+ );
260
+ }
261
+ if (name === "lighthouse.portfolio.refresh") {
262
+ const id = getNumericId(argumentsPayload);
263
+ if (id === null) {
264
+ return getErrorToolResult("portfolio: invalid id");
265
+ }
266
+ const result = await client.refreshPortfolio(id);
267
+ if (result.ok) {
268
+ return getSuccessToolResult(`portfolio refreshed: ${id}`);
269
+ }
270
+ return getErrorToolResult(
271
+ `portfolio refresh: ${result.error.category} (${result.error.reason})`
272
+ );
273
+ }
274
+ return getErrorToolResult(`Unknown tool: ${name}`);
275
+ }
276
+ });
277
+ // Annotate the CommonJS export names for ESM import in node:
278
+ 0 && (module.exports = {
279
+ createMcpCoreRuntime,
280
+ getMcpCorePackageContract
281
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,255 @@
1
+ // src/index.ts
2
+ var getMcpCorePackageContract = () => ({
3
+ name: "@letpeoplework/lighthouse-mcp-core",
4
+ dependsOn: "@letpeoplework/lighthouse-client",
5
+ transports: ["stdio", "streamable-http"]
6
+ });
7
+ var toolDefinitions = [
8
+ {
9
+ name: "lighthouse.health.check",
10
+ description: "Validate Lighthouse API connectivity.",
11
+ inputSchema: {
12
+ type: "object",
13
+ properties: {},
14
+ additionalProperties: false
15
+ }
16
+ },
17
+ {
18
+ name: "lighthouse.version.get",
19
+ description: "Get Lighthouse version from /api/v1/version.",
20
+ inputSchema: {
21
+ type: "object",
22
+ properties: {},
23
+ additionalProperties: false
24
+ }
25
+ },
26
+ {
27
+ name: "lighthouse.worktracking.list",
28
+ description: "List work-tracking system connections.",
29
+ inputSchema: {
30
+ type: "object",
31
+ properties: {},
32
+ additionalProperties: false
33
+ }
34
+ },
35
+ {
36
+ name: "lighthouse.worktracking.get",
37
+ description: "Get one work-tracking system connection by id.",
38
+ inputSchema: {
39
+ type: "object",
40
+ properties: {},
41
+ additionalProperties: false
42
+ }
43
+ },
44
+ {
45
+ name: "lighthouse.team.list",
46
+ description: "List teams.",
47
+ inputSchema: {
48
+ type: "object",
49
+ properties: {},
50
+ additionalProperties: false
51
+ }
52
+ },
53
+ {
54
+ name: "lighthouse.team.get",
55
+ description: "Get one team by id.",
56
+ inputSchema: {
57
+ type: "object",
58
+ properties: {},
59
+ additionalProperties: false
60
+ }
61
+ },
62
+ {
63
+ name: "lighthouse.team.refresh",
64
+ description: "Trigger a refresh for one team.",
65
+ inputSchema: {
66
+ type: "object",
67
+ properties: {},
68
+ additionalProperties: false
69
+ }
70
+ },
71
+ {
72
+ name: "lighthouse.portfolio.list",
73
+ description: "List portfolios.",
74
+ inputSchema: {
75
+ type: "object",
76
+ properties: {},
77
+ additionalProperties: false
78
+ }
79
+ },
80
+ {
81
+ name: "lighthouse.portfolio.get",
82
+ description: "Get one portfolio by id.",
83
+ inputSchema: {
84
+ type: "object",
85
+ properties: {},
86
+ additionalProperties: false
87
+ }
88
+ },
89
+ {
90
+ name: "lighthouse.portfolio.refresh",
91
+ description: "Trigger a refresh for one portfolio.",
92
+ inputSchema: {
93
+ type: "object",
94
+ properties: {},
95
+ additionalProperties: false
96
+ }
97
+ }
98
+ ];
99
+ var getSuccessToolResult = (text) => ({
100
+ isError: false,
101
+ content: [
102
+ {
103
+ type: "text",
104
+ text
105
+ }
106
+ ]
107
+ });
108
+ var getErrorToolResult = (text) => ({
109
+ isError: true,
110
+ content: [
111
+ {
112
+ type: "text",
113
+ text
114
+ }
115
+ ]
116
+ });
117
+ var getNumericId = (argumentsPayload) => {
118
+ if (typeof argumentsPayload !== "object" || argumentsPayload === null || Array.isArray(argumentsPayload)) {
119
+ return null;
120
+ }
121
+ const value = argumentsPayload.id;
122
+ if (typeof value === "number" && Number.isInteger(value)) {
123
+ return value;
124
+ }
125
+ return null;
126
+ };
127
+ var createMcpCoreRuntime = (dependencies) => ({
128
+ listTools: () => toolDefinitions,
129
+ callTool: async (name, argumentsPayload) => {
130
+ const client = dependencies.createClient();
131
+ if (name === "lighthouse.health.check") {
132
+ const health = await client.checkConnectivity();
133
+ if (health.category === "success") {
134
+ return getSuccessToolResult("connectivity: success");
135
+ }
136
+ return getErrorToolResult(
137
+ `connectivity: ${health.category}${health.reason !== void 0 ? ` (${health.reason})` : ""}`
138
+ );
139
+ }
140
+ if (name === "lighthouse.version.get") {
141
+ const version = await client.getVersion();
142
+ if (version.ok) {
143
+ return getSuccessToolResult(`version: ${version.value}`);
144
+ }
145
+ return getErrorToolResult(
146
+ `version: ${version.error.category} (${version.error.reason})`
147
+ );
148
+ }
149
+ if (name === "lighthouse.worktracking.list") {
150
+ const connections = await client.listWorkTrackingConnections();
151
+ if (connections.ok) {
152
+ return getSuccessToolResult(
153
+ `worktracking: ${JSON.stringify(connections.value)}`
154
+ );
155
+ }
156
+ return getErrorToolResult(
157
+ `worktracking: ${connections.error.category} (${connections.error.reason})`
158
+ );
159
+ }
160
+ if (name === "lighthouse.worktracking.get") {
161
+ const id = getNumericId(argumentsPayload);
162
+ if (id === null) {
163
+ return getErrorToolResult("worktracking: invalid id");
164
+ }
165
+ const connection = await client.getWorkTrackingConnection(id);
166
+ if (connection.ok) {
167
+ return getSuccessToolResult(
168
+ `worktracking: ${JSON.stringify(connection.value)}`
169
+ );
170
+ }
171
+ return getErrorToolResult(
172
+ `worktracking: ${connection.error.category} (${connection.error.reason})`
173
+ );
174
+ }
175
+ if (name === "lighthouse.team.list") {
176
+ const teams = await client.listTeams();
177
+ if (teams.ok) {
178
+ return getSuccessToolResult(`teams: ${JSON.stringify(teams.value)}`);
179
+ }
180
+ return getErrorToolResult(
181
+ `teams: ${teams.error.category} (${teams.error.reason})`
182
+ );
183
+ }
184
+ if (name === "lighthouse.team.get") {
185
+ const id = getNumericId(argumentsPayload);
186
+ if (id === null) {
187
+ return getErrorToolResult("team: invalid id");
188
+ }
189
+ const team = await client.getTeam(id);
190
+ if (team.ok) {
191
+ return getSuccessToolResult(`team: ${JSON.stringify(team.value)}`);
192
+ }
193
+ return getErrorToolResult(
194
+ `team: ${team.error.category} (${team.error.reason})`
195
+ );
196
+ }
197
+ if (name === "lighthouse.team.refresh") {
198
+ const id = getNumericId(argumentsPayload);
199
+ if (id === null) {
200
+ return getErrorToolResult("team: invalid id");
201
+ }
202
+ const result = await client.refreshTeam(id);
203
+ if (result.ok) {
204
+ return getSuccessToolResult(`team refreshed: ${id}`);
205
+ }
206
+ return getErrorToolResult(
207
+ `team refresh: ${result.error.category} (${result.error.reason})`
208
+ );
209
+ }
210
+ if (name === "lighthouse.portfolio.list") {
211
+ const portfolios = await client.listPortfolios();
212
+ if (portfolios.ok) {
213
+ return getSuccessToolResult(
214
+ `portfolios: ${JSON.stringify(portfolios.value)}`
215
+ );
216
+ }
217
+ return getErrorToolResult(
218
+ `portfolios: ${portfolios.error.category} (${portfolios.error.reason})`
219
+ );
220
+ }
221
+ if (name === "lighthouse.portfolio.get") {
222
+ const id = getNumericId(argumentsPayload);
223
+ if (id === null) {
224
+ return getErrorToolResult("portfolio: invalid id");
225
+ }
226
+ const portfolio = await client.getPortfolio(id);
227
+ if (portfolio.ok) {
228
+ return getSuccessToolResult(
229
+ `portfolio: ${JSON.stringify(portfolio.value)}`
230
+ );
231
+ }
232
+ return getErrorToolResult(
233
+ `portfolio: ${portfolio.error.category} (${portfolio.error.reason})`
234
+ );
235
+ }
236
+ if (name === "lighthouse.portfolio.refresh") {
237
+ const id = getNumericId(argumentsPayload);
238
+ if (id === null) {
239
+ return getErrorToolResult("portfolio: invalid id");
240
+ }
241
+ const result = await client.refreshPortfolio(id);
242
+ if (result.ok) {
243
+ return getSuccessToolResult(`portfolio refreshed: ${id}`);
244
+ }
245
+ return getErrorToolResult(
246
+ `portfolio refresh: ${result.error.category} (${result.error.reason})`
247
+ );
248
+ }
249
+ return getErrorToolResult(`Unknown tool: ${name}`);
250
+ }
251
+ });
252
+ export {
253
+ createMcpCoreRuntime,
254
+ getMcpCorePackageContract
255
+ };
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@letpeoplework/lighthouse-mcp-core",
3
+ "version": "0.1.0",
4
+ "description": "Shared MCP semantics for Lighthouse",
5
+ "repository": "https://github.com/LetPeopleWork/lighthouse-clients",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "dependencies": {
23
+ "@letpeoplework/lighthouse-client": "0.1.0"
24
+ },
25
+ "scripts": {
26
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean",
27
+ "clean": "rimraf dist"
28
+ }
29
+ }