@node-in-layers/mcp-server 2.3.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +311 -109
- package/docs/node-in-layers-system.json +11 -5
- package/internal-libs.d.ts +29 -0
- package/internal-libs.js +184 -0
- package/internal-libs.js.map +1 -0
- package/libs.d.ts +8 -42
- package/libs.js +52 -2
- package/libs.js.map +1 -1
- package/mcp.d.ts +0 -6
- package/mcp.js +209 -92
- package/mcp.js.map +1 -1
- package/models.d.ts +99 -79
- package/models.js +2 -2
- package/models.js.map +1 -1
- package/nil.d.ts +96 -76
- package/nil.js +119 -44
- package/nil.js.map +1 -1
- package/package.json +14 -7
- package/types.d.ts +522 -51
- package/types.js +14 -0
- package/types.js.map +1 -1
- package/utils.d.ts +21 -0
- package/utils.js +33 -0
- package/utils.js.map +1 -0
package/mcp.js
CHANGED
|
@@ -8,12 +8,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { randomUUID } from 'crypto';
|
|
11
|
+
import z from 'zod';
|
|
11
12
|
import get from 'lodash/get.js';
|
|
12
|
-
import
|
|
13
|
+
import express from 'express';
|
|
14
|
+
import bodyParser from 'body-parser';
|
|
15
|
+
import cors from 'cors';
|
|
16
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
17
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
18
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
19
|
+
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
13
20
|
import { McpNamespace, } from './types.js';
|
|
14
21
|
import { create as createModelsMcp } from './models.js';
|
|
15
22
|
import { create as createNilMcp } from './nil.js';
|
|
23
|
+
import { buildMergedToolInput, isZodSchema, openApiToZodSchema, } from './internal-libs.js';
|
|
16
24
|
const DEFAULT_RESPONSE_REQUEST_LOG_LEVEL = 'info';
|
|
25
|
+
const DEFAULT_PORT = 3000;
|
|
26
|
+
const BAD_REQUEST_STATUS = 400;
|
|
27
|
+
const NOT_FOUND_STATUS = 404;
|
|
28
|
+
const UNHANDLED_REQUEST_STATUS = 405;
|
|
17
29
|
const create = (context) => {
|
|
18
30
|
const tools = [];
|
|
19
31
|
const sets = [];
|
|
@@ -24,81 +36,213 @@ const create = (context) => {
|
|
|
24
36
|
tools.push(tool);
|
|
25
37
|
};
|
|
26
38
|
const _wrapToolsWithLogger = (tool) => {
|
|
27
|
-
|
|
39
|
+
// This execute is what the MCP SDK calls: (args, extra) where extra is RequestHandlerExtra.
|
|
40
|
+
// extra.requestInfo contains HTTP headers (and only headers) provided by the SDK transport.
|
|
41
|
+
const execute = (input, extra) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
42
|
var _a, _b, _c, _d, _e, _f;
|
|
29
43
|
const requestId = randomUUID();
|
|
30
44
|
const logger = context.log
|
|
31
45
|
.getIdLogger('logRequest', 'requestId', requestId)
|
|
32
|
-
.applyData({
|
|
33
|
-
requestId: requestId,
|
|
34
|
-
});
|
|
46
|
+
.applyData({ requestId });
|
|
35
47
|
const level = ((_a = context.config[McpNamespace].logging) === null || _a === void 0 ? void 0 : _a.requestLogLevel) ||
|
|
36
48
|
DEFAULT_RESPONSE_REQUEST_LOG_LEVEL;
|
|
37
49
|
const requestData = ((_c = (_b = context.config[McpNamespace].logging) === null || _b === void 0 ? void 0 : _b.requestLogGetData) === null || _c === void 0 ? void 0 : _c.call(_b, input)) || {};
|
|
38
50
|
logger[level]('Request received', Object.assign({ method: 'POST',
|
|
39
51
|
// @ts-ignore
|
|
40
52
|
url: ((_d = context.config[McpNamespace].server) === null || _d === void 0 ? void 0 : _d.path) || '/', tool: tool.name, body: input }, requestData));
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
ids: logger.getIds(),
|
|
44
|
-
},
|
|
45
|
-
});
|
|
53
|
+
const { mergedInput, mergedCrossLayerProps } = buildMergedToolInput(input, extra, logger);
|
|
54
|
+
const result = yield tool.execute(mergedInput, mergedCrossLayerProps);
|
|
46
55
|
const data = get(result, 'content[0].text');
|
|
47
56
|
const toShow = data ? JSON.parse(data) : result;
|
|
48
|
-
const responseData =
|
|
57
|
+
const responseData =
|
|
58
|
+
// @ts-ignore — responseLogGetData receives the tool result, not a Request
|
|
59
|
+
((_f = (_e = context.config[McpNamespace].logging) === null || _e === void 0 ? void 0 : _e.responseLogGetData) === null || _f === void 0 ? void 0 : _f.call(_e, result)) || {};
|
|
49
60
|
logger[level]('Request Response', Object.assign({ response: toShow }, responseData));
|
|
50
61
|
return result;
|
|
51
62
|
});
|
|
52
63
|
return Object.assign(Object.assign({}, tool), { execute });
|
|
53
64
|
};
|
|
54
|
-
const
|
|
65
|
+
const _buildAllTools = (systemContext) => {
|
|
55
66
|
var _a;
|
|
56
67
|
const config = systemContext.config[McpNamespace];
|
|
57
|
-
if ((_a = config.hideComponents) === null || _a === void 0 ? void 0 : _a.allModels) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
const modelsMcp = createModelsMcp(systemContext);
|
|
61
|
-
return [
|
|
62
|
-
modelsMcp.listModels(),
|
|
63
|
-
modelsMcp.describe(),
|
|
64
|
-
modelsMcp.save(),
|
|
65
|
-
modelsMcp.retrieve(),
|
|
66
|
-
modelsMcp.delete(),
|
|
67
|
-
modelsMcp.search(),
|
|
68
|
-
modelsMcp.bulkInsert(),
|
|
69
|
-
modelsMcp.bulkDelete(),
|
|
70
|
-
];
|
|
71
|
-
};
|
|
72
|
-
const _getServer = (systemContext, options) => {
|
|
73
68
|
const nilMcp = createNilMcp(systemContext);
|
|
74
|
-
const
|
|
69
|
+
const modelTools = ((_a = config.hideComponents) === null || _a === void 0 ? void 0 : _a.allModels)
|
|
70
|
+
? []
|
|
71
|
+
: (() => {
|
|
72
|
+
const modelsMcp = createModelsMcp(systemContext);
|
|
73
|
+
return [
|
|
74
|
+
modelsMcp.listModels(),
|
|
75
|
+
modelsMcp.describe(),
|
|
76
|
+
modelsMcp.save(),
|
|
77
|
+
modelsMcp.retrieve(),
|
|
78
|
+
modelsMcp.delete(),
|
|
79
|
+
modelsMcp.search(),
|
|
80
|
+
modelsMcp.bulkInsert(),
|
|
81
|
+
modelsMcp.bulkDelete(),
|
|
82
|
+
];
|
|
83
|
+
})();
|
|
84
|
+
return [
|
|
75
85
|
nilMcp.startHere(),
|
|
76
86
|
nilMcp.listDomains(),
|
|
77
87
|
nilMcp.listFeatures(),
|
|
78
88
|
nilMcp.describeFeature(),
|
|
79
89
|
nilMcp.executeFeature(),
|
|
80
|
-
...
|
|
90
|
+
...modelTools,
|
|
81
91
|
...tools,
|
|
82
92
|
].map(_wrapToolsWithLogger);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
server: systemContext.config[McpNamespace].server,
|
|
90
|
-
}, {
|
|
91
|
-
express: Object.assign({ preRouteMiddleware,
|
|
92
|
-
additionalRoutes }, (options ? options : {})),
|
|
93
|
+
};
|
|
94
|
+
const _buildMcpServer = (systemContext) => {
|
|
95
|
+
const config = systemContext.config[McpNamespace];
|
|
96
|
+
const server = new McpServer({
|
|
97
|
+
name: systemContext.config.systemName,
|
|
98
|
+
version: config.version || '1.0.0',
|
|
93
99
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
_buildAllTools(systemContext).forEach(tool => {
|
|
101
|
+
const inputSchema = isZodSchema(tool.inputSchema)
|
|
102
|
+
? tool.inputSchema
|
|
103
|
+
: z.object(openApiToZodSchema(tool.inputSchema));
|
|
104
|
+
const outputSchema = (() => {
|
|
105
|
+
const raw = tool.outputSchema;
|
|
106
|
+
if (!raw) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
// If already Zod, pass through (SDK validates structuredContent with it)
|
|
110
|
+
if (isZodSchema(raw)) {
|
|
111
|
+
return raw;
|
|
112
|
+
}
|
|
113
|
+
// If OpenAPI/JSON-schema-ish object at root, convert to a Zod object schema.
|
|
114
|
+
// If it's null/array/anyOf/etc at root, return undefined (no output validation).
|
|
115
|
+
if (typeof raw === 'object' && raw.type === 'object') {
|
|
116
|
+
return z.object(openApiToZodSchema(raw)).loose();
|
|
117
|
+
}
|
|
118
|
+
return undefined;
|
|
119
|
+
})();
|
|
120
|
+
server.registerTool(tool.name, Object.assign({ description: tool.description, inputSchema }, (outputSchema ? { outputSchema } : {})), tool.execute);
|
|
99
121
|
});
|
|
100
122
|
return server;
|
|
101
123
|
};
|
|
124
|
+
// ─── HTTP transport ────────────────────────────────────────────────────────
|
|
125
|
+
const _buildExpressOptions = (options) => (Object.assign({ preRouteMiddleware,
|
|
126
|
+
additionalRoutes }, (options || {})));
|
|
127
|
+
const _buildHttpApp = (systemContext, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
128
|
+
var _a, _b, _c;
|
|
129
|
+
const config = systemContext.config[McpNamespace];
|
|
130
|
+
const isStateful = Boolean(config.stateful);
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
const path = ((_a = config.server) === null || _a === void 0 ? void 0 : _a.path) || '/';
|
|
133
|
+
const expressOpts = _buildExpressOptions(options);
|
|
134
|
+
const app = express();
|
|
135
|
+
app.use(bodyParser.json(expressOpts.jsonBodyParser));
|
|
136
|
+
app.use(cors());
|
|
137
|
+
(_b = expressOpts.preRouteMiddleware) === null || _b === void 0 ? void 0 : _b.forEach(middleware => app.use(middleware));
|
|
138
|
+
// Session map used only in stateful mode
|
|
139
|
+
const transports = {};
|
|
140
|
+
const _routeWrapper = (func) => {
|
|
141
|
+
if (expressOpts.afterRouteCallback) {
|
|
142
|
+
return (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
143
|
+
yield func(req, res);
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
yield expressOpts.afterRouteCallback(req, res);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return func;
|
|
149
|
+
};
|
|
150
|
+
const handleStatelessRequest = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
151
|
+
const server = _buildMcpServer(systemContext);
|
|
152
|
+
const transport = new StreamableHTTPServerTransport({
|
|
153
|
+
sessionIdGenerator: undefined,
|
|
154
|
+
enableJsonResponse: true,
|
|
155
|
+
});
|
|
156
|
+
res.on('close', () => {
|
|
157
|
+
transport.close();
|
|
158
|
+
server.close();
|
|
159
|
+
});
|
|
160
|
+
yield server.connect(transport);
|
|
161
|
+
yield transport.handleRequest(req, res, req.body);
|
|
162
|
+
});
|
|
163
|
+
const handleStatefulRequest = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
164
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
165
|
+
// eslint-disable-next-line functional/no-let
|
|
166
|
+
let transport;
|
|
167
|
+
if (sessionId && transports[sessionId]) {
|
|
168
|
+
transport = transports[sessionId];
|
|
169
|
+
}
|
|
170
|
+
else if (!sessionId && isInitializeRequest(req.body)) {
|
|
171
|
+
const server = _buildMcpServer(systemContext);
|
|
172
|
+
transport = new StreamableHTTPServerTransport({
|
|
173
|
+
sessionIdGenerator: () => randomUUID(),
|
|
174
|
+
enableJsonResponse: true,
|
|
175
|
+
onsessioninitialized: newSessionId => {
|
|
176
|
+
// eslint-disable-next-line functional/immutable-data
|
|
177
|
+
transports[newSessionId] = transport;
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
// eslint-disable-next-line functional/immutable-data
|
|
181
|
+
transport.onclose = () => {
|
|
182
|
+
if (transport.sessionId) {
|
|
183
|
+
// eslint-disable-next-line functional/immutable-data
|
|
184
|
+
delete transports[transport.sessionId];
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
yield server.connect(transport);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
res.status(BAD_REQUEST_STATUS).json({
|
|
191
|
+
jsonrpc: '2.0',
|
|
192
|
+
error: {
|
|
193
|
+
code: -32000,
|
|
194
|
+
message: 'Bad Request: No valid session ID provided',
|
|
195
|
+
},
|
|
196
|
+
id: null,
|
|
197
|
+
});
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
yield transport.handleRequest(req, res, req.body);
|
|
201
|
+
});
|
|
202
|
+
const handleSessionRequest = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
203
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
204
|
+
if (!sessionId || !transports[sessionId]) {
|
|
205
|
+
res.status(BAD_REQUEST_STATUS).send('Invalid or missing session ID');
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
yield transports[sessionId].handleRequest(req, res);
|
|
209
|
+
});
|
|
210
|
+
const _unhandledRequest = (_req, res) => {
|
|
211
|
+
res.writeHead(UNHANDLED_REQUEST_STATUS).end(JSON.stringify({
|
|
212
|
+
jsonrpc: '2.0',
|
|
213
|
+
error: { code: -32000, message: 'Method not allowed.' },
|
|
214
|
+
id: null,
|
|
215
|
+
}));
|
|
216
|
+
};
|
|
217
|
+
(_c = expressOpts.additionalRoutes) === null || _c === void 0 ? void 0 : _c.forEach(route => {
|
|
218
|
+
app[route.method.toLowerCase()](route.path, route.handler);
|
|
219
|
+
});
|
|
220
|
+
app.post(path, _routeWrapper(isStateful ? handleStatefulRequest : handleStatelessRequest));
|
|
221
|
+
if (isStateful) {
|
|
222
|
+
app.get(path, _routeWrapper(handleSessionRequest));
|
|
223
|
+
app.delete(path, _routeWrapper(handleSessionRequest));
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
app.get(path, _routeWrapper(_unhandledRequest));
|
|
227
|
+
app.delete(path, _routeWrapper(_unhandledRequest));
|
|
228
|
+
}
|
|
229
|
+
app.use(_routeWrapper((_req, res) => {
|
|
230
|
+
res.status(NOT_FOUND_STATUS).json({
|
|
231
|
+
error: 'Not Found',
|
|
232
|
+
message: `The requested URL ${_req.url} was not found on this server`,
|
|
233
|
+
status: NOT_FOUND_STATUS,
|
|
234
|
+
});
|
|
235
|
+
}));
|
|
236
|
+
sets.forEach(([key, value]) => app.set(key, value));
|
|
237
|
+
return app;
|
|
238
|
+
});
|
|
239
|
+
// ─── CLI transport ─────────────────────────────────────────────────────────
|
|
240
|
+
const _startCli = (systemContext) => __awaiter(void 0, void 0, void 0, function* () {
|
|
241
|
+
const server = _buildMcpServer(systemContext);
|
|
242
|
+
const transport = new StdioServerTransport();
|
|
243
|
+
yield server.connect(transport);
|
|
244
|
+
});
|
|
245
|
+
// ─── Public API ────────────────────────────────────────────────────────────
|
|
102
246
|
const addPreRouteMiddleware = (middleware) => {
|
|
103
247
|
// eslint-disable-next-line functional/immutable-data
|
|
104
248
|
preRouteMiddleware.push(middleware);
|
|
@@ -108,18 +252,28 @@ const create = (context) => {
|
|
|
108
252
|
additionalRoutes.push(route);
|
|
109
253
|
};
|
|
110
254
|
const start = (systemContext, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
-
const
|
|
112
|
-
|
|
255
|
+
const connectionType = systemContext.config[McpNamespace].server.connection.type;
|
|
256
|
+
if (connectionType === 'cli') {
|
|
257
|
+
yield _startCli(systemContext);
|
|
258
|
+
}
|
|
259
|
+
else if (connectionType === 'http') {
|
|
260
|
+
const app = yield _buildHttpApp(systemContext, options);
|
|
261
|
+
// @ts-ignore
|
|
262
|
+
const port = systemContext.config[McpNamespace].server.connection.port ||
|
|
263
|
+
DEFAULT_PORT;
|
|
264
|
+
app.listen(port);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
throw new Error(`Unsupported connection type: ${connectionType}`);
|
|
268
|
+
}
|
|
113
269
|
});
|
|
114
|
-
const getApp = (options) => {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
throw new Error(`Server not http or sse`);
|
|
270
|
+
const getApp = (systemContext, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
271
|
+
const connectionType = systemContext.config[McpNamespace].server.connection.type;
|
|
272
|
+
if (connectionType !== 'http') {
|
|
273
|
+
throw new Error(`getApp is only supported for HTTP connections`);
|
|
119
274
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
};
|
|
275
|
+
return _buildHttpApp(systemContext, options);
|
|
276
|
+
});
|
|
123
277
|
const set = (key, value) => {
|
|
124
278
|
// eslint-disable-next-line functional/immutable-data
|
|
125
279
|
sets.push([key, value]);
|
|
@@ -133,42 +287,5 @@ const create = (context) => {
|
|
|
133
287
|
set,
|
|
134
288
|
};
|
|
135
289
|
};
|
|
136
|
-
/**
|
|
137
|
-
* Automatically adds all the models in the given domain to the MCP server.
|
|
138
|
-
* @param namespace The namespace of the domain to add the models from.
|
|
139
|
-
* @param opts Options for the tool name generator.
|
|
140
|
-
* @returns A function that can be used to add the models to the MCP server.
|
|
141
|
-
*/
|
|
142
|
-
/*
|
|
143
|
-
const mcpModels = <TConfig extends Config = Config>(
|
|
144
|
-
namespace: string,
|
|
145
|
-
context: McpContext<TConfig>
|
|
146
|
-
) => {
|
|
147
|
-
const mcpFunctions = context.mcp[McpNamespace]
|
|
148
|
-
const namedFeatures = get(context, `features.${namespace}`)
|
|
149
|
-
if (!namedFeatures) {
|
|
150
|
-
throw new Error(
|
|
151
|
-
`features.${namespace} does not exist on context needed for mcp.`
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
// Look for CRUDS functions.
|
|
155
|
-
Object.entries(namedFeatures).forEach(
|
|
156
|
-
([key, value]: [key: string, value: any]) => {
|
|
157
|
-
if (typeof value === 'object') {
|
|
158
|
-
if (key === 'cruds') {
|
|
159
|
-
Object.entries(value).forEach(([, modelCrudFuncs]) => {
|
|
160
|
-
mcpFunctions.addModelCruds(
|
|
161
|
-
modelCrudFuncs as ModelCrudsFunctions<any>
|
|
162
|
-
)
|
|
163
|
-
})
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
{}
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
return {}
|
|
171
|
-
}
|
|
172
|
-
*/
|
|
173
290
|
export { create };
|
|
174
291
|
//# sourceMappingURL=mcp.js.map
|
package/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,GAAG,MAAM,eAAe,CAAA;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAGvE,OAAO,EAKL,YAAY,GACb,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,UAAU,CAAA;AAEjD,MAAM,kCAAkC,GAAG,MAAM,CAAA;AAEjD,MAAM,MAAM,GAAG,CACb,OAA6C,EAC/B,EAAE;IAChB,MAAM,KAAK,GAAiB,EAAE,CAAA;IAC9B,MAAM,IAAI,GAAoB,EAAE,CAAA;IAChC,MAAM,kBAAkB,GAAwB,EAAE,CAAA;IAClD,MAAM,gBAAgB,GAAmB,EAAE,CAAA;IAC3C,MAAM,OAAO,GAAG,CAAC,IAAgB,EAAE,EAAE;QACnC,qDAAqD;QACrD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAA;IAED,MAAM,oBAAoB,GAAG,CAAC,IAAgB,EAAc,EAAE;QAC5D,MAAM,OAAO,GAAG,CAAO,KAAU,EAAE,EAAE;;YACnC,MAAM,SAAS,GAAG,UAAU,EAAE,CAAA;YAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG;iBACvB,WAAW,CAAC,YAAY,EAAE,WAAW,EAAE,SAAS,CAAC;iBACjD,SAAS,CAAC;gBACT,SAAS,EAAE,SAAS;aACrB,CAAC,CAAA;YACJ,MAAM,KAAK,G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;QACL,KAAK;QACL,MAAM;QACN,OAAO;QACP,qBAAqB;QACrB,kBAAkB;QAClB,GAAG;KACJ,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
package/models.d.ts
CHANGED
|
@@ -1,63 +1,42 @@
|
|
|
1
1
|
import { LayerContext } from '@node-in-layers/core';
|
|
2
|
-
import {
|
|
2
|
+
import { McpTool } from './types.js';
|
|
3
3
|
export declare const create: <TConfig extends Readonly<{
|
|
4
4
|
"@node-in-layers/mcp-server": {
|
|
5
|
-
name?: string | undefined;
|
|
6
5
|
version?: string | undefined;
|
|
7
|
-
|
|
6
|
+
stateful?: boolean | undefined;
|
|
8
7
|
server: {
|
|
9
|
-
connection: Readonly<{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
connection: {
|
|
27
|
-
type: "cli";
|
|
28
|
-
};
|
|
29
|
-
}>;
|
|
30
|
-
}> | Readonly<{
|
|
31
|
-
server: Readonly<{
|
|
32
|
-
connection: Readonly<{
|
|
33
|
-
type: "sse";
|
|
34
|
-
url: string;
|
|
35
|
-
port?: number | undefined;
|
|
36
|
-
}>;
|
|
37
|
-
path?: string | undefined;
|
|
38
|
-
messagesPath?: string | undefined;
|
|
39
|
-
}>;
|
|
40
|
-
}> | Readonly<{
|
|
41
|
-
server: Readonly<{
|
|
42
|
-
connection: Readonly<{
|
|
43
|
-
type: "http";
|
|
44
|
-
url: string;
|
|
45
|
-
port?: number | undefined;
|
|
46
|
-
headers?: Readonly<Record<string, string>> | undefined;
|
|
47
|
-
timeout?: number | undefined;
|
|
48
|
-
retry?: Readonly<{
|
|
49
|
-
attempts: number;
|
|
50
|
-
backoff: number;
|
|
51
|
-
}> | undefined;
|
|
52
|
-
}>;
|
|
53
|
-
path?: string | undefined;
|
|
54
|
-
}>;
|
|
55
|
-
stateless: true;
|
|
56
|
-
}>;
|
|
8
|
+
connection: ({} & Readonly<{
|
|
9
|
+
type: "http";
|
|
10
|
+
url: string;
|
|
11
|
+
headers?: Readonly<Record<string, string>> | undefined;
|
|
12
|
+
timeout?: number | undefined;
|
|
13
|
+
retry?: Readonly<{
|
|
14
|
+
attempts: number;
|
|
15
|
+
backoff: number;
|
|
16
|
+
}> | undefined;
|
|
17
|
+
}>) | ({
|
|
18
|
+
url?: undefined;
|
|
19
|
+
headers?: undefined;
|
|
20
|
+
timeout?: undefined;
|
|
21
|
+
retry?: undefined;
|
|
22
|
+
} & Readonly<{
|
|
23
|
+
type: "cli";
|
|
24
|
+
}>);
|
|
57
25
|
};
|
|
58
26
|
startHere?: {
|
|
59
|
-
name
|
|
60
|
-
description
|
|
27
|
+
name?: string | undefined;
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
hideDefaultSystemEntries?: boolean | undefined;
|
|
30
|
+
includeDomains?: boolean | undefined;
|
|
31
|
+
includeFeatures?: boolean | undefined;
|
|
32
|
+
examplesOfUse?: readonly Readonly<{
|
|
33
|
+
name: string;
|
|
34
|
+
description?: string | undefined;
|
|
35
|
+
value?: string | undefined;
|
|
36
|
+
tags?: string[] | undefined;
|
|
37
|
+
details?: string | undefined;
|
|
38
|
+
example?: string | undefined;
|
|
39
|
+
}>[] | undefined;
|
|
61
40
|
} | undefined;
|
|
62
41
|
hiddenPaths?: string[] | undefined;
|
|
63
42
|
hideComponents?: {
|
|
@@ -68,18 +47,10 @@ export declare const create: <TConfig extends Readonly<{
|
|
|
68
47
|
systemDescription?: {
|
|
69
48
|
description?: string | undefined;
|
|
70
49
|
version?: string | undefined;
|
|
71
|
-
examplesOfUse?: readonly Readonly<{
|
|
72
|
-
name: string;
|
|
73
|
-
description?: string | undefined;
|
|
74
|
-
value?: string | undefined;
|
|
75
|
-
tags?: string[] | undefined;
|
|
76
|
-
details?: string | undefined;
|
|
77
|
-
example?: string | undefined;
|
|
78
|
-
}>[] | undefined;
|
|
79
50
|
} | undefined;
|
|
80
51
|
logging?: {
|
|
81
|
-
requestLogLevel?: import("@node-in-layers/core
|
|
82
|
-
responseLogLevel?: import("@node-in-layers/core
|
|
52
|
+
requestLogLevel?: import("@node-in-layers/core").LogLevelNames | undefined;
|
|
53
|
+
responseLogLevel?: import("@node-in-layers/core").LogLevelNames | undefined;
|
|
83
54
|
requestLogGetData?: ((req: Request) => Record<string, any>) | undefined;
|
|
84
55
|
responseLogGetData?: ((req: Request) => Record<string, any>) | undefined;
|
|
85
56
|
} | undefined;
|
|
@@ -89,8 +60,8 @@ export declare const create: <TConfig extends Readonly<{
|
|
|
89
60
|
environment: string;
|
|
90
61
|
"@node-in-layers/core": Readonly<{
|
|
91
62
|
logging: {
|
|
92
|
-
logLevel: import("@node-in-layers/core
|
|
93
|
-
logFormat: import("@node-in-layers/core
|
|
63
|
+
logLevel: import("@node-in-layers/core").LogLevelNames;
|
|
64
|
+
logFormat: import("@node-in-layers/core").LogFormat | readonly import("@node-in-layers/core").LogFormat[];
|
|
94
65
|
maxLogSizeInCharacters?: number | undefined;
|
|
95
66
|
tcpLoggingOptions?: Readonly<{
|
|
96
67
|
url: string;
|
|
@@ -108,20 +79,49 @@ export declare const create: <TConfig extends Readonly<{
|
|
|
108
79
|
}>, props?: {
|
|
109
80
|
ids?: readonly Readonly<Record<string, string>>[] | undefined;
|
|
110
81
|
data?: Record<string, any> | undefined;
|
|
111
|
-
} | undefined) => import("@node-in-layers/core
|
|
82
|
+
} | undefined) => import("@node-in-layers/core").HighLevelLogger;
|
|
112
83
|
}> | undefined;
|
|
113
|
-
getFunctionWrapLogLevel?: ((layerName: string, functionName?: string | undefined) => import("@node-in-layers/core
|
|
84
|
+
getFunctionWrapLogLevel?: ((layerName: string, functionName?: string | undefined) => import("@node-in-layers/core").LogLevelNames) | undefined;
|
|
114
85
|
ignoreLayerFunctions?: Record<string, boolean | Record<string, boolean | Record<string, boolean>>> | undefined;
|
|
86
|
+
otel?: Readonly<{
|
|
87
|
+
serviceName?: string | undefined;
|
|
88
|
+
version?: string | undefined;
|
|
89
|
+
trace?: Readonly<{
|
|
90
|
+
enabled?: boolean | undefined;
|
|
91
|
+
exporter?: Readonly<{
|
|
92
|
+
endpoint?: string | undefined;
|
|
93
|
+
headers?: Record<string, string> | undefined;
|
|
94
|
+
}> | undefined;
|
|
95
|
+
}> | undefined;
|
|
96
|
+
logs?: Readonly<{
|
|
97
|
+
enabled?: boolean | undefined;
|
|
98
|
+
exporter?: Readonly<{
|
|
99
|
+
endpoint?: string | undefined;
|
|
100
|
+
headers?: Record<string, string> | undefined;
|
|
101
|
+
}> | undefined;
|
|
102
|
+
}> | undefined;
|
|
103
|
+
metrics?: Readonly<{
|
|
104
|
+
enabled?: boolean | undefined;
|
|
105
|
+
exporter?: Readonly<{
|
|
106
|
+
endpoint?: string | undefined;
|
|
107
|
+
headers?: Record<string, string> | undefined;
|
|
108
|
+
}> | undefined;
|
|
109
|
+
}> | undefined;
|
|
110
|
+
exporter?: Readonly<{
|
|
111
|
+
endpoint?: string | undefined;
|
|
112
|
+
headers?: Record<string, string> | undefined;
|
|
113
|
+
}> | undefined;
|
|
114
|
+
}> | undefined;
|
|
115
115
|
};
|
|
116
|
-
layerOrder: readonly import("@node-in-layers/core
|
|
116
|
+
layerOrder: readonly import("@node-in-layers/core").LayerDescription[];
|
|
117
117
|
apps: readonly Readonly<{
|
|
118
118
|
name: string;
|
|
119
119
|
description?: string | undefined;
|
|
120
120
|
services?: Readonly<{
|
|
121
|
-
create: (context: any) => import("@node-in-layers/core
|
|
121
|
+
create: (context: any) => import("@node-in-layers/core").MaybePromise<object>;
|
|
122
122
|
}> | undefined;
|
|
123
123
|
features?: Readonly<{
|
|
124
|
-
create: (context: any) => import("@node-in-layers/core
|
|
124
|
+
create: (context: any) => import("@node-in-layers/core").MaybePromise<object>;
|
|
125
125
|
}> | undefined;
|
|
126
126
|
globals?: Readonly<{
|
|
127
127
|
create: (context: Readonly<{
|
|
@@ -138,7 +138,7 @@ export declare const create: <TConfig extends Readonly<{
|
|
|
138
138
|
}>, props?: {
|
|
139
139
|
ids?: readonly Readonly<Record<string, string>>[] | undefined;
|
|
140
140
|
data?: Record<string, any> | undefined;
|
|
141
|
-
} | undefined) => import("@node-in-layers/core
|
|
141
|
+
} | undefined) => import("@node-in-layers/core").HighLevelLogger;
|
|
142
142
|
}>;
|
|
143
143
|
constants: {
|
|
144
144
|
environment: string;
|
|
@@ -151,8 +151,24 @@ export declare const create: <TConfig extends Readonly<{
|
|
|
151
151
|
create: <T extends Readonly<{
|
|
152
152
|
[s: string]: any;
|
|
153
153
|
}>, TModelExtensions extends object = object, TModelInstanceExtensions extends object = object>(modelProps: Readonly<{
|
|
154
|
+
context: Readonly<{
|
|
155
|
+
config: Readonly<any>;
|
|
156
|
+
rootLogger: Readonly<{
|
|
157
|
+
getLogger: (context: Readonly<any>, props?: {
|
|
158
|
+
ids?: readonly Readonly<Record<string, string>>[] | undefined;
|
|
159
|
+
data?: Record<string, any> | undefined;
|
|
160
|
+
} | undefined) => import("@node-in-layers/core").HighLevelLogger;
|
|
161
|
+
}>;
|
|
162
|
+
constants: {
|
|
163
|
+
environment: string;
|
|
164
|
+
workingDirectory: string;
|
|
165
|
+
runtimeId: string;
|
|
166
|
+
};
|
|
167
|
+
}>;
|
|
154
168
|
Model: import("functional-models/types.js").ModelFactory<object, object>;
|
|
155
169
|
fetcher: import("functional-models/types.js").ModelInstanceFetcher<object, object>;
|
|
170
|
+
getPrimaryKeyProperty: import("@node-in-layers/core").PrimaryKeyPropertyGetter;
|
|
171
|
+
getForeignKeyProperty: import("@node-in-layers/core").ForeignKeyPropertyGetter;
|
|
156
172
|
getModel: <T_1 extends Readonly<{
|
|
157
173
|
[s: string]: any;
|
|
158
174
|
}>>(namespace: string, modelName: string) => () => import("functional-models/types.js").ModelType<T_1, object, object>;
|
|
@@ -166,14 +182,18 @@ export declare const create: <TConfig extends Readonly<{
|
|
|
166
182
|
[x: string]: string | [string, string] | [string, string, any[]];
|
|
167
183
|
};
|
|
168
184
|
} | undefined;
|
|
185
|
+
modelIdPropertyType?: import("functional-models").PrimaryKeyPropertyType | undefined;
|
|
186
|
+
primaryKeyGenerator?: import("functional-models").PrimaryKeyGenerator | undefined;
|
|
187
|
+
modelNameToIdPropertyType?: Record<string, import("functional-models").PrimaryKeyPropertyType> | undefined;
|
|
188
|
+
modelNameToPrimaryKeyGenerator?: Record<string, import("functional-models").PrimaryKeyGenerator> | undefined;
|
|
169
189
|
}>;
|
|
170
190
|
}>>(context: any) => {
|
|
171
|
-
listModels: () =>
|
|
172
|
-
describe: () =>
|
|
173
|
-
save: () =>
|
|
174
|
-
retrieve: () =>
|
|
175
|
-
delete: () =>
|
|
176
|
-
search: () =>
|
|
177
|
-
bulkInsert: () =>
|
|
178
|
-
bulkDelete: () =>
|
|
191
|
+
listModels: () => McpTool;
|
|
192
|
+
describe: () => McpTool;
|
|
193
|
+
save: () => McpTool;
|
|
194
|
+
retrieve: () => McpTool;
|
|
195
|
+
delete: () => McpTool;
|
|
196
|
+
search: () => McpTool;
|
|
197
|
+
bulkInsert: () => McpTool;
|
|
198
|
+
bulkDelete: () => McpTool;
|
|
179
199
|
};
|
package/models.js
CHANGED
|
@@ -13,7 +13,7 @@ import { createErrorObject, isErrorObject, } from '@node-in-layers/core';
|
|
|
13
13
|
import { modelToOpenApi } from 'functional-models-openapi';
|
|
14
14
|
import { asyncMap } from 'modern-async';
|
|
15
15
|
import { isDomainHidden, areAllModelsHidden, isModelHidden, commonMcpExecute, createDomainNotFoundError, createModelsNotFoundError, createMcpResponse, createModelNotFoundError, cleanupSearchQuery, doesDomainNotExist, } from './libs.js';
|
|
16
|
-
import { McpNamespace } from './types.js';
|
|
16
|
+
import { McpNamespace, } from './types.js';
|
|
17
17
|
const describeModelMcpTool = () => {
|
|
18
18
|
return {
|
|
19
19
|
name: 'describe_model',
|
|
@@ -95,7 +95,7 @@ export const create = (context) => {
|
|
|
95
95
|
.getModelDefinition().description;
|
|
96
96
|
return acc.concat(Object.assign({ modelType: model.getModel().getName() }, (description ? { description } : {})));
|
|
97
97
|
}, []);
|
|
98
|
-
return createMcpResponse(result);
|
|
98
|
+
return createMcpResponse({ models: result });
|
|
99
99
|
})) });
|
|
100
100
|
};
|
|
101
101
|
const describe = () => {
|