@mcp-abap-adt/http 19.0.0 → 19.2.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 +14 -2
- package/bin/mcp-abap-adt-http.js +5 -3
- package/dist/httpVersion.d.ts +2 -9
- package/dist/httpVersion.d.ts.map +1 -1
- package/dist/httpVersion.js +5 -2
- package/dist/httpVersion.js.map +1 -1
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/dist/launcher.d.ts +19 -38
- package/dist/launcher.d.ts.map +1 -1
- package/dist/launcher.js +22 -123
- package/dist/launcher.js.map +1 -1
- package/package.json +5 -7
- package/dist/InstancePool.d.ts +0 -127
- package/dist/InstancePool.d.ts.map +0 -1
- package/dist/InstancePool.js +0 -318
- package/dist/InstancePool.js.map +0 -1
- package/dist/StreamableHttpServer.d.ts +0 -160
- package/dist/StreamableHttpServer.d.ts.map +0 -1
- package/dist/StreamableHttpServer.js +0 -403
- package/dist/StreamableHttpServer.js.map +0 -1
- package/dist/config/httpParameters.d.ts +0 -45
- package/dist/config/httpParameters.d.ts.map +0 -1
- package/dist/config/httpParameters.js +0 -143
- package/dist/config/httpParameters.js.map +0 -1
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StreamableHttpServer = void 0;
|
|
7
|
-
const auth_1 = require("@mcp-abap-adt/lib/auth");
|
|
8
|
-
const embeddable_1 = require("@mcp-abap-adt/lib/embeddable");
|
|
9
|
-
const http_transport_1 = require("@mcp-abap-adt/lib/http-transport");
|
|
10
|
-
const logger_1 = require("@mcp-abap-adt/lib/logger");
|
|
11
|
-
const request_context_1 = require("@mcp-abap-adt/lib/request-context");
|
|
12
|
-
const state_1 = require("@mcp-abap-adt/lib/state");
|
|
13
|
-
const responsible_rules_1 = require("@mcp-abap-adt/responsible-rules");
|
|
14
|
-
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
15
|
-
const express_1 = __importDefault(require("express"));
|
|
16
|
-
const httpVersion_js_1 = require("./httpVersion.js");
|
|
17
|
-
const InstancePool_js_1 = require("./InstancePool.js");
|
|
18
|
-
/** Whether a request body is, or holds, a `tools/call`: a JSON-RPC batch counts by its elements. */
|
|
19
|
-
function carriesToolCall(body) {
|
|
20
|
-
const isCall = (m) => m?.method === 'tools/call';
|
|
21
|
-
return Array.isArray(body) ? body.some(isCall) : isCall(body);
|
|
22
|
-
}
|
|
23
|
-
/** One tool error per request (an element with an id), in the body's shape; none: nothing to answer. */
|
|
24
|
-
function notAvailableAnswers(body) {
|
|
25
|
-
const answerOf = (m) => {
|
|
26
|
-
const id = m?.id;
|
|
27
|
-
return id === undefined
|
|
28
|
-
? undefined
|
|
29
|
-
: {
|
|
30
|
-
jsonrpc: '2.0',
|
|
31
|
-
id,
|
|
32
|
-
result: {
|
|
33
|
-
content: [{ type: 'text', text: state_1.STATE_UNAVAILABLE_WORDS }],
|
|
34
|
-
isError: true,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
if (!Array.isArray(body))
|
|
39
|
-
return answerOf(body);
|
|
40
|
-
const answers = body.map(answerOf).filter((a) => a !== undefined);
|
|
41
|
-
return answers.length > 0 ? answers : undefined;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* The Streamable HTTP server. Each HTTP POST is an MCP session of its own, on
|
|
45
|
-
* a new server instance or the pooled one its `state_handle` names.
|
|
46
|
-
* Credentials come only from each request's `x-sap-*` headers, through
|
|
47
|
-
* lib's `headerSource`: nothing is stored, shared or cached across requests,
|
|
48
|
-
* except the connections held state opened. A request without them is
|
|
49
|
-
* answered `400` (`ping` excepted), and so is one carrying
|
|
50
|
-
* `x-mcp-destination` — destinations are core's (stdio).
|
|
51
|
-
*
|
|
52
|
-
* Supports two modes:
|
|
53
|
-
* 1. Standalone mode: Creates its own Express server (when no app option provided)
|
|
54
|
-
* 2. Embedded mode: Registers routes on external app (when app option provided)
|
|
55
|
-
*/
|
|
56
|
-
class StreamableHttpServer extends embeddable_1.BaseMcpServer {
|
|
57
|
-
handlersRegistry;
|
|
58
|
-
host;
|
|
59
|
-
port;
|
|
60
|
-
enableJsonResponse;
|
|
61
|
-
path;
|
|
62
|
-
externalApp;
|
|
63
|
-
version;
|
|
64
|
-
standaloneServer;
|
|
65
|
-
/** The listener stopped, until its last connections are closed after the last step. */
|
|
66
|
-
stoppedListener;
|
|
67
|
-
tls;
|
|
68
|
-
allowedHosts;
|
|
69
|
-
allowedOrigins;
|
|
70
|
-
enableDnsRebindingProtection;
|
|
71
|
-
/** The instances that hold state between requests (spec D9). */
|
|
72
|
-
pool = new InstancePool_js_1.InstancePool();
|
|
73
|
-
stateIdleMinutes;
|
|
74
|
-
stateLogger;
|
|
75
|
-
backgroundRunsStore;
|
|
76
|
-
batchSettings;
|
|
77
|
-
constructor(handlersRegistry, opts) {
|
|
78
|
-
super({
|
|
79
|
-
name: 'mcp-abap-adt',
|
|
80
|
-
version: opts?.version ?? httpVersion_js_1.HTTP_VERSION,
|
|
81
|
-
logger: opts?.logger ?? logger_1.noopLogger,
|
|
82
|
-
// Validated by the base: a misconfiguration stops the start.
|
|
83
|
-
stateIdleMinutes: opts?.stateIdleMinutes,
|
|
84
|
-
// From the options as given: the silent default above is never the state's.
|
|
85
|
-
stateLogger: (0, state_1.stateLoggerOf)(opts ?? {}),
|
|
86
|
-
// The responsible rules, once per connection, when it is created.
|
|
87
|
-
systemContextResolver: request_context_1.defaultSystemContextResolver,
|
|
88
|
-
systemContextRules: responsible_rules_1.responsibleRules,
|
|
89
|
-
});
|
|
90
|
-
this.handlersRegistry = handlersRegistry;
|
|
91
|
-
this.stateIdleMinutes = opts?.stateIdleMinutes;
|
|
92
|
-
this.stateLogger = (0, state_1.stateLoggerOf)(opts ?? {});
|
|
93
|
-
this.backgroundRunsStore = opts?.backgroundRuns;
|
|
94
|
-
this.batchSettings =
|
|
95
|
-
opts?.batch === undefined
|
|
96
|
-
? undefined
|
|
97
|
-
: { keepRawParts: opts.batch.keepRawParts === true };
|
|
98
|
-
this.version = opts?.version ?? httpVersion_js_1.HTTP_VERSION;
|
|
99
|
-
this.host = opts?.host ?? '127.0.0.1';
|
|
100
|
-
this.port = opts?.port ?? 3000;
|
|
101
|
-
this.enableJsonResponse = opts?.enableJsonResponse ?? true;
|
|
102
|
-
this.path = opts?.path ?? '/mcp/stream/http';
|
|
103
|
-
this.externalApp = opts?.app;
|
|
104
|
-
this.tls = opts?.tls;
|
|
105
|
-
this.allowedHosts = opts?.allowedHosts;
|
|
106
|
-
this.allowedOrigins = opts?.allowedOrigins;
|
|
107
|
-
this.enableDnsRebindingProtection = opts?.enableDnsRebindingProtection;
|
|
108
|
-
// Register handlers once for shared MCP server
|
|
109
|
-
this.registerHandlers(this.handlersRegistry);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Creates the request handler function
|
|
113
|
-
* Can be used to register on external app or internal Express
|
|
114
|
-
*/
|
|
115
|
-
createRequestHandler() {
|
|
116
|
-
return async (req, res) => {
|
|
117
|
-
const clientId = `${req.socket.remoteAddress}:${req.socket.remotePort}`;
|
|
118
|
-
const mcpMethod = req.body?.method;
|
|
119
|
-
const mcpId = req.body?.id;
|
|
120
|
-
const toolName = mcpMethod === 'tools/call'
|
|
121
|
-
? req.body?.params?.name
|
|
122
|
-
: undefined;
|
|
123
|
-
const methodInfo = toolName
|
|
124
|
-
? `${mcpMethod} -> ${toolName}`
|
|
125
|
-
: (mcpMethod ?? 'unknown');
|
|
126
|
-
const isPing = mcpMethod === 'ping';
|
|
127
|
-
if (!isPing) {
|
|
128
|
-
console.error(`[StreamableHttpServer] ${req.method} ${req.path} from ${clientId} | ${methodInfo} (id=${mcpId ?? '-'})`);
|
|
129
|
-
}
|
|
130
|
-
try {
|
|
131
|
-
// A header this server no longer serves is refused, never ignored.
|
|
132
|
-
(0, http_transport_1.refuseDestinationHeader)(req.headers);
|
|
133
|
-
// The request's own source, from its x-sap-* headers alone; `ping`
|
|
134
|
-
// is a protocol-level check and answers without them.
|
|
135
|
-
const context = isPing ? undefined : (0, http_transport_1.headerContext)(req.headers);
|
|
136
|
-
// The handle: the `x-mcp-state-handle` header first, else the
|
|
137
|
-
// `tools/call` argument. A bearer value: never logged.
|
|
138
|
-
let handle;
|
|
139
|
-
try {
|
|
140
|
-
handle = (0, InstancePool_js_1.handleFrom)(req.headers, req.body);
|
|
141
|
-
}
|
|
142
|
-
catch (err) {
|
|
143
|
-
if (err instanceof InstancePool_js_1.BatchWithHandleError) {
|
|
144
|
-
res.status(400).send(InstancePool_js_1.BATCH_WITH_HANDLE_WORDS);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
throw err;
|
|
148
|
-
}
|
|
149
|
-
if (!isPing) {
|
|
150
|
-
console.error(`[StreamableHttpServer] ${methodInfo} | auth: x-sap-* headers`);
|
|
151
|
-
}
|
|
152
|
-
await this.pool.serve({ handle, refuseUnknown: carriesToolCall(req.body) }, () => this.createPerRequestServer(), async (server) => {
|
|
153
|
-
// A client that left while this request waited for the lease gets nothing.
|
|
154
|
-
if (res.destroyed)
|
|
155
|
-
return;
|
|
156
|
-
const transport = new streamableHttp_js_1.StreamableHTTPServerTransport({
|
|
157
|
-
sessionIdGenerator: undefined, // stateless mode to avoid ID collisions
|
|
158
|
-
enableJsonResponse: this.enableJsonResponse,
|
|
159
|
-
});
|
|
160
|
-
let transportClosed;
|
|
161
|
-
const closeTransport = () => {
|
|
162
|
-
transportClosed ??= transport.close().catch(() => undefined);
|
|
163
|
-
return transportClosed;
|
|
164
|
-
};
|
|
165
|
-
const disconnected = new Promise((resolve) => res.once('close', () => {
|
|
166
|
-
void closeTransport();
|
|
167
|
-
resolve();
|
|
168
|
-
}));
|
|
169
|
-
try {
|
|
170
|
-
// The request's own credentials, every time — also on a kept
|
|
171
|
-
// instance: its tool calls build their connections from them.
|
|
172
|
-
if (context)
|
|
173
|
-
server.useConnectionContext(context);
|
|
174
|
-
await server.connect(transport);
|
|
175
|
-
// Scope what the request states — x-sap-language, x-sap-responsible,
|
|
176
|
-
// x-sap-master-system — to this request's dispatch, so it cannot
|
|
177
|
-
// leak into other requests/modes via a process-global cache (#110).
|
|
178
|
-
const dispatch = (0, request_context_1.runWithRequestContext)((0, request_context_1.requestContextFromHeaders)(req.headers), () => transport.handleRequest(req, res, req.body));
|
|
179
|
-
// JSON mode answers when the handler has; SSE mode when the stream
|
|
180
|
-
// ends. A client that disconnects first must not hold the lease on
|
|
181
|
-
// a dispatch that waits for a handler.
|
|
182
|
-
let failed;
|
|
183
|
-
await Promise.race([
|
|
184
|
-
dispatch.catch((error) => {
|
|
185
|
-
failed = { error };
|
|
186
|
-
}),
|
|
187
|
-
disconnected,
|
|
188
|
-
]);
|
|
189
|
-
// A dispatch that failed is answered below, as before the pool.
|
|
190
|
-
if (failed)
|
|
191
|
-
throw failed.error;
|
|
192
|
-
}
|
|
193
|
-
finally {
|
|
194
|
-
await closeTransport();
|
|
195
|
-
// The instance goes back only when its tool handlers have settled:
|
|
196
|
-
// they do not consume the transport's abort signal.
|
|
197
|
-
await server.idle();
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
if (!isPing) {
|
|
201
|
-
console.error(`[StreamableHttpServer] ${methodInfo} (id=${mcpId ?? '-'}) completed`);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
catch (err) {
|
|
205
|
-
if (err instanceof InstancePool_js_1.PoolClosedError) {
|
|
206
|
-
if (!res.headersSent)
|
|
207
|
-
res.status(503).send(InstancePool_js_1.POOL_CLOSED_WORDS);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
// A tool call whose handle names no state: the pool's answer, as a
|
|
211
|
-
// tool's — no instance was made, nothing logged on.
|
|
212
|
-
if (err instanceof state_1.StateUnavailableError) {
|
|
213
|
-
if (!res.headersSent) {
|
|
214
|
-
const answered = notAvailableAnswers(req.body);
|
|
215
|
-
if (answered === undefined)
|
|
216
|
-
res.status(202).end();
|
|
217
|
-
else
|
|
218
|
-
res.status(200).json(answered);
|
|
219
|
-
}
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
const answer = (0, http_transport_1.requestFailureAnswer)(err);
|
|
223
|
-
if (answer.logLine !== undefined)
|
|
224
|
-
console.error(answer.logLine);
|
|
225
|
-
if (!answer.known) {
|
|
226
|
-
// No words for it: its class only — a message may quote a file (H4).
|
|
227
|
-
console.error(`[StreamableHttpServer] ${methodInfo} (id=${mcpId ?? '-'}) FAILED: ${(0, auth_1.errorClassOf)(err)}`);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
console.error(`[StreamableHttpServer] ${methodInfo} (id=${mcpId ?? '-'}) FAILED: ${answer.text}`);
|
|
231
|
-
}
|
|
232
|
-
if (!res.headersSent) {
|
|
233
|
-
res.status(answer.status).send(answer.text);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Register routes on an external HTTP application
|
|
240
|
-
* Use this when integrating with existing Express/CDS/CAP server
|
|
241
|
-
*
|
|
242
|
-
* @param app - External HTTP application (Express, CDS, etc.)
|
|
243
|
-
* @param options - Route registration options
|
|
244
|
-
*/
|
|
245
|
-
registerRoutes(app, _options) {
|
|
246
|
-
const handler = this.createRequestHandler();
|
|
247
|
-
// Health check endpoint — lightweight, no MCP protocol logic
|
|
248
|
-
app.get('/mcp/health', (_req, res) => {
|
|
249
|
-
res.json({
|
|
250
|
-
status: 'ok',
|
|
251
|
-
uptime: Math.floor(process.uptime()),
|
|
252
|
-
version: this.version,
|
|
253
|
-
transport: 'http',
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
const dnsOpts = {
|
|
257
|
-
enable: this.enableDnsRebindingProtection,
|
|
258
|
-
allowedHosts: this.allowedHosts,
|
|
259
|
-
allowedOrigins: this.allowedOrigins,
|
|
260
|
-
};
|
|
261
|
-
// Only handle POST requests - GET SSE streams cause abort errors on disconnect
|
|
262
|
-
app.post(this.path, (0, http_transport_1.withDnsRebindingProtection)(handler, dnsOpts));
|
|
263
|
-
// Return 405 for other methods to avoid SSE stream issues
|
|
264
|
-
app.all(this.path, (0, http_transport_1.withDnsRebindingProtection)((_req, res) => {
|
|
265
|
-
res.status(405).send('Method Not Allowed');
|
|
266
|
-
}, dnsOpts));
|
|
267
|
-
console.error(`[StreamableHttpServer] Routes registered on external app at ${this.path}`);
|
|
268
|
-
console.error(`[StreamableHttpServer] JSON response mode: ${this.enableJsonResponse}`);
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Get the configured endpoint path
|
|
272
|
-
*/
|
|
273
|
-
getPath() {
|
|
274
|
-
return this.path;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Start the server
|
|
278
|
-
*
|
|
279
|
-
* In standalone mode (no external app): Creates Express server and starts listening
|
|
280
|
-
* In embedded mode (external app provided): Only registers routes on external app
|
|
281
|
-
*/
|
|
282
|
-
async start() {
|
|
283
|
-
// If external app was provided in constructor, register routes on it
|
|
284
|
-
if (this.externalApp) {
|
|
285
|
-
this.registerRoutes(this.externalApp);
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
// Standalone mode: create own Express server
|
|
289
|
-
const app = (0, express_1.default)();
|
|
290
|
-
app.use(express_1.default.json());
|
|
291
|
-
this.registerRoutes(app);
|
|
292
|
-
await new Promise((resolve, reject) => {
|
|
293
|
-
const protocol = (0, http_transport_1.getProtocol)(this.tls);
|
|
294
|
-
const server = (0, http_transport_1.createServerListener)(app, this.tls);
|
|
295
|
-
this.standaloneServer = server;
|
|
296
|
-
server.listen(this.port, this.host);
|
|
297
|
-
server.once('listening', () => {
|
|
298
|
-
console.error(`[StreamableHttpServer] Server started on ${this.host}:${this.port}`);
|
|
299
|
-
console.error(`[StreamableHttpServer] Endpoint: ${protocol}://${this.host}:${this.port}${this.path}`);
|
|
300
|
-
resolve();
|
|
301
|
-
});
|
|
302
|
-
server.once('error', reject);
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* The shutdown's first step, in the latch's tick: the pool stops
|
|
307
|
-
* admitting — every later request is answered `503`.
|
|
308
|
-
*/
|
|
309
|
-
beginShutdown() {
|
|
310
|
-
this.pool.stopAdmitting();
|
|
311
|
-
}
|
|
312
|
-
/** Stops taking connections. Embedded on an external app there is no listener of its own. */
|
|
313
|
-
stopListening() {
|
|
314
|
-
const server = this.standaloneServer;
|
|
315
|
-
if (server) {
|
|
316
|
-
this.standaloneServer = undefined;
|
|
317
|
-
this.stoppedListener = server;
|
|
318
|
-
server.close();
|
|
319
|
-
server.closeIdleConnections();
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* The launcher's shutdown, after the logoffs (lib's
|
|
324
|
-
* `installTransportShutdown`), and `stop()`: nothing is answered any more —
|
|
325
|
-
* the connections still open on the stopped listener (a request whose tool
|
|
326
|
-
* was interrupted, a client's idle keep-alive) are closed, so none keeps
|
|
327
|
-
* the process alive.
|
|
328
|
-
*/
|
|
329
|
-
releaseConnections() {
|
|
330
|
-
this.stoppedListener?.closeAllConnections();
|
|
331
|
-
this.stoppedListener = undefined;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* For a host that stops the server itself (embedded): admission stops, the
|
|
335
|
-
* listener closes, then the pool's shutdown (no timer). Rejects with what
|
|
336
|
-
* could not be undone. A launcher's shutdown does not run this: it logs
|
|
337
|
-
* every owned connection off at once and interrupts the running tools
|
|
338
|
-
* (lib's `installTransportShutdown`).
|
|
339
|
-
*/
|
|
340
|
-
async stop() {
|
|
341
|
-
this.beginShutdown();
|
|
342
|
-
this.stopListening();
|
|
343
|
-
const failures = await this.pool.shutdown();
|
|
344
|
-
this.releaseConnections();
|
|
345
|
-
if (failures.length) {
|
|
346
|
-
throw new Error(`state cleanup failed: ${failures.join('; ')}`);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
createPerRequestServer() {
|
|
350
|
-
class PerRequestServer extends embeddable_1.BaseMcpServer {
|
|
351
|
-
registry;
|
|
352
|
-
constructor(registry, version, logger, state) {
|
|
353
|
-
// A transport per request: the client's disconnect closes that
|
|
354
|
-
// transport and ends no call — an admitted call goes on to its end.
|
|
355
|
-
// The instance's calls end with its close or the process shutdown.
|
|
356
|
-
super({
|
|
357
|
-
name: 'mcp-abap-adt',
|
|
358
|
-
version,
|
|
359
|
-
logger,
|
|
360
|
-
...state,
|
|
361
|
-
transportCloseEndsSession: false,
|
|
362
|
-
// The responsible rules, once, when the instance's connection is
|
|
363
|
-
// created: kept with it in the pool.
|
|
364
|
-
systemContextResolver: request_context_1.defaultSystemContextResolver,
|
|
365
|
-
systemContextRules: responsible_rules_1.responsibleRules,
|
|
366
|
-
});
|
|
367
|
-
this.registry = registry;
|
|
368
|
-
this.registerHandlers(this.registry);
|
|
369
|
-
}
|
|
370
|
-
useConnectionContext(context) {
|
|
371
|
-
this.setConnectionContext(context);
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* A pooled instance ends with its state: after the idle bound's stop,
|
|
375
|
-
* whatever its undo answered, every connection it owns is closed with
|
|
376
|
-
* a logoff — not only the state's own.
|
|
377
|
-
*/
|
|
378
|
-
idleStopped() {
|
|
379
|
-
return this.terminalClose();
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
return new PerRequestServer(this.handlersRegistry, this.version, this.logger, {
|
|
383
|
-
stateIdleMinutes: this.stateIdleMinutes,
|
|
384
|
-
stateLogger: this.stateLogger,
|
|
385
|
-
...(this.backgroundRunsStore !== undefined && {
|
|
386
|
-
backgroundRuns: this.backgroundRunsStore,
|
|
387
|
-
}),
|
|
388
|
-
// Batch mode: this pooled instance's own, never shared with another.
|
|
389
|
-
...(this.batchSettings !== undefined && {
|
|
390
|
-
batch: new embeddable_1.InstanceBatch(this.batchSettings),
|
|
391
|
-
}),
|
|
392
|
-
// An instance lasts one request unless it holds state: a lock taken
|
|
393
|
-
// here is kept as state, so the write and the unlock under it reach
|
|
394
|
-
// this instance (and its SAP session) by its state_handle.
|
|
395
|
-
heldLocks: new state_1.HeldLocks(),
|
|
396
|
-
// The corrected header pairs: the process's, shared by every
|
|
397
|
-
// instance.
|
|
398
|
-
adtHeaderPairs: this.adtHeaderPairs,
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
exports.StreamableHttpServer = StreamableHttpServer;
|
|
403
|
-
//# sourceMappingURL=StreamableHttpServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StreamableHttpServer.js","sourceRoot":"","sources":["../src/StreamableHttpServer.ts"],"names":[],"mappings":";;;;;;AAEA,iDAAsD;AAOtD,6DAKsC;AAEtC,qEAO0C;AAC1C,qDAAsD;AACtD,uEAI2C;AAC3C,mDAMiC;AAEjC,uEAAmE;AACnE,0FAAmG;AACnG,sDAA+D;AAC/D,qDAAgD;AAChD,uDAQ2B;AA8E3B,oGAAoG;AACpG,SAAS,eAAe,CAAC,IAAa;IACpC,MAAM,MAAM,GAAG,CAAC,CAAU,EAAE,EAAE,CAC3B,CAA6C,EAAE,MAAM,KAAK,YAAY,CAAC;IAC1E,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChE,CAAC;AAED,wGAAwG;AACxG,SAAS,mBAAmB,CAAC,IAAa;IACxC,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAE,EAAE;QAC9B,MAAM,EAAE,GAAI,CAAyC,EAAE,EAAE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,aAAQ,GAAR,QAAQ,CAAmB;gBA0B5C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvC,CAAC;YAEM,oBAAoB,CAAC,OAA0B;gBACpD,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACrC,CAAC;YAED;;;;eAIG;YACgB,WAAW;gBAC5B,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;YAC9B,CAAC;SACF;QACD,OAAO,IAAI,gBAAgB,CACzB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,MAAM,EACX;YACE,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,GAAG,CAAC,IAAI,CAAC,mBAAmB,KAAK,SAAS,IAAI;gBAC5C,cAAc,EAAE,IAAI,CAAC,mBAAmB;aACzC,CAAC;YACF,qEAAqE;YACrE,GAAG,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI;gBACtC,KAAK,EAAE,IAAI,0BAAa,CAAC,IAAI,CAAC,aAAa,CAAC;aAC7C,CAAC;YACF,oEAAoE;YACpE,oEAAoE;YACpE,2DAA2D;YAC3D,SAAS,EAAE,IAAI,iBAAS,EAAE;YAC1B,6DAA6D;YAC7D,YAAY;YACZ,cAAc,EAAE,IAAI,CAAC,cAAc;SACpC,CACF,CAAC;IACJ,CAAC;CACF;AA7ZD,oDA6ZC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `mcp-abap-adt-http`'s parameter table: the Streamable HTTP
|
|
3
|
-
* listener, beside lib's shared rows and the TLS rows. No destination,
|
|
4
|
-
* login or SSE option is here; the CLI or YAML form of one — or any form of
|
|
5
|
-
* `--transport`, which is gone — stops the start naming the binary that serves
|
|
6
|
-
* it. Their environment variables are not read.
|
|
7
|
-
*/
|
|
8
|
-
import { type IServerConfig, type Parameter, type ParameterTable, type TlsConfig, type YamlConfig } from '@mcp-abap-adt/lib/config';
|
|
9
|
-
import { type ToolSet } from '@mcp-abap-adt/lib/tool-set';
|
|
10
|
-
/** The Streamable HTTP rows: today's names. */
|
|
11
|
-
export declare const HTTP_ROWS: readonly Parameter[];
|
|
12
|
-
/**
|
|
13
|
-
* http's table for a tool set: its rows, the shared rows, and what it
|
|
14
|
-
* refuses — the set's removed `--exposition` among them, naming the http
|
|
15
|
-
* binary its words asked for. `mcp-abap-adt-http-ro`, `mcp-abap-adt-compact-http`
|
|
16
|
-
* and `mcp-abap-adt-compact-http-ro` are this table with their own set,
|
|
17
|
-
* nothing else.
|
|
18
|
-
*/
|
|
19
|
-
export declare function httpParameters(toolSet: ToolSet, program?: string): ParameterTable;
|
|
20
|
-
/** `mcp-abap-adt-http`'s table: http's, with the full tool set. */
|
|
21
|
-
export declare const HTTP_PARAMETERS: ParameterTable;
|
|
22
|
-
/** What `mcp-abap-adt-http` reads. */
|
|
23
|
-
export interface HttpConfig extends IServerConfig {
|
|
24
|
-
host?: string;
|
|
25
|
-
port?: number;
|
|
26
|
-
/** The MCP endpoint path */
|
|
27
|
-
httpPath?: string;
|
|
28
|
-
/** JSON responses rather than SSE streams */
|
|
29
|
-
httpJsonResponse?: boolean;
|
|
30
|
-
/** Allowed Host header values (DNS-rebinding protection; exact, incl. port) */
|
|
31
|
-
allowedHosts?: string[];
|
|
32
|
-
/** Allowed Origin header values (DNS-rebinding protection; exact, incl. scheme) */
|
|
33
|
-
allowedOrigins?: string[];
|
|
34
|
-
/** Enable DNS-rebinding protection */
|
|
35
|
-
enableDnsRebindingProtection?: boolean;
|
|
36
|
-
/** TLS: cert and key start HTTPS */
|
|
37
|
-
tls?: TlsConfig;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* `mcp-abap-adt-http`'s configuration from the arguments, the environment
|
|
41
|
-
* and the loaded config file. A removed parameter, or an invalid value,
|
|
42
|
-
* throws a `ParameterRefusal` in its words.
|
|
43
|
-
*/
|
|
44
|
-
export declare function readHttpConfig(argv: readonly string[], env: NodeJS.ProcessEnv, yaml?: YamlConfig | null, toolSet?: ToolSet): HttpConfig;
|
|
45
|
-
//# sourceMappingURL=httpParameters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"httpParameters.d.ts","sourceRoot":"","sources":["../../src/config/httpParameters.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,cAAc,EAOnB,KAAK,SAAS,EAId,KAAK,UAAU,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAe,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAKvE,+CAA+C;AAC/C,eAAO,MAAM,SAAS,EAAE,SAAS,SAAS,EAqEzC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,OAAO,SAAsB,GAC5B,cAAc,CAmBhB;AAED,mEAAmE;AACnE,eAAO,MAAM,eAAe,EAAE,cAA4C,CAAC;AAE3E,sCAAsC;AACtC,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,sCAAsC;IACtC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,oCAAoC;IACpC,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AAKD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,IAAI,GAAE,UAAU,GAAG,IAAW,EAC9B,OAAO,GAAE,OAAqB,GAC7B,UAAU,CAoBZ"}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* `mcp-abap-adt-http`'s parameter table: the Streamable HTTP
|
|
4
|
-
* listener, beside lib's shared rows and the TLS rows. No destination,
|
|
5
|
-
* login or SSE option is here; the CLI or YAML form of one — or any form of
|
|
6
|
-
* `--transport`, which is gone — stops the start naming the binary that serves
|
|
7
|
-
* it. Their environment variables are not read.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.HTTP_PARAMETERS = exports.HTTP_ROWS = void 0;
|
|
11
|
-
exports.httpParameters = httpParameters;
|
|
12
|
-
exports.readHttpConfig = readHttpConfig;
|
|
13
|
-
const config_1 = require("@mcp-abap-adt/lib/config");
|
|
14
|
-
const tool_set_1 = require("@mcp-abap-adt/lib/tool-set");
|
|
15
|
-
const responsible_rules_1 = require("@mcp-abap-adt/responsible-rules");
|
|
16
|
-
const HTTP = 'STREAMABLE HTTP';
|
|
17
|
-
/** The Streamable HTTP rows: today's names. */
|
|
18
|
-
exports.HTTP_ROWS = [
|
|
19
|
-
{
|
|
20
|
-
key: 'host',
|
|
21
|
-
cli: '--host',
|
|
22
|
-
cliAliases: ['--http-host'],
|
|
23
|
-
env: 'MCP_HTTP_HOST',
|
|
24
|
-
yaml: 'http.host',
|
|
25
|
-
kind: 'string',
|
|
26
|
-
default: '127.0.0.1',
|
|
27
|
-
valueHint: '=<host>',
|
|
28
|
-
section: HTTP,
|
|
29
|
-
help: 'Host to listen on (default 127.0.0.1, this machine only; 0.0.0.0 for every interface)',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
key: 'port',
|
|
33
|
-
cli: '--port',
|
|
34
|
-
cliAliases: ['--http-port'],
|
|
35
|
-
env: 'MCP_HTTP_PORT',
|
|
36
|
-
yaml: 'http.port',
|
|
37
|
-
kind: 'port',
|
|
38
|
-
default: 3000,
|
|
39
|
-
section: HTTP,
|
|
40
|
-
help: 'Port to listen on, 1-65535 (default 3000)',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
key: 'httpPath',
|
|
44
|
-
cli: '--path',
|
|
45
|
-
cliAliases: ['--http-path'],
|
|
46
|
-
kind: 'string',
|
|
47
|
-
valueHint: '=<path>',
|
|
48
|
-
section: HTTP,
|
|
49
|
-
help: 'The MCP endpoint path (default /mcp/stream/http)',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
key: 'httpJsonResponse',
|
|
53
|
-
cli: '--http-json-response',
|
|
54
|
-
env: 'MCP_HTTP_ENABLE_JSON_RESPONSE',
|
|
55
|
-
yaml: 'http.json-response',
|
|
56
|
-
kind: 'flag',
|
|
57
|
-
section: HTTP,
|
|
58
|
-
help: 'Answer with JSON responses rather than SSE streams',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
key: 'allowedHosts',
|
|
62
|
-
cli: '--http-allowed-hosts',
|
|
63
|
-
env: 'MCP_HTTP_ALLOWED_HOSTS',
|
|
64
|
-
yaml: 'http.allowed-hosts',
|
|
65
|
-
kind: 'list',
|
|
66
|
-
section: HTTP,
|
|
67
|
-
help: 'Host header values accepted with DNS-rebinding protection (exact, with the port), comma-separated',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
key: 'allowedOrigins',
|
|
71
|
-
cli: '--http-allowed-origins',
|
|
72
|
-
env: 'MCP_HTTP_ALLOWED_ORIGINS',
|
|
73
|
-
yaml: 'http.allowed-origins',
|
|
74
|
-
kind: 'list',
|
|
75
|
-
section: HTTP,
|
|
76
|
-
help: 'Origin header values accepted with DNS-rebinding protection (exact, with the scheme), comma-separated',
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
key: 'enableDnsRebindingProtection',
|
|
80
|
-
cli: '--http-enable-dns-protection',
|
|
81
|
-
env: 'MCP_HTTP_ENABLE_DNS_PROTECTION',
|
|
82
|
-
yaml: 'http.enable-dns-protection',
|
|
83
|
-
kind: 'flag',
|
|
84
|
-
section: HTTP,
|
|
85
|
-
help: 'Enable DNS-rebinding protection (with --http-allowed-hosts and/or --http-allowed-origins)',
|
|
86
|
-
},
|
|
87
|
-
];
|
|
88
|
-
/**
|
|
89
|
-
* http's table for a tool set: its rows, the shared rows, and what it
|
|
90
|
-
* refuses — the set's removed `--exposition` among them, naming the http
|
|
91
|
-
* binary its words asked for. `mcp-abap-adt-http-ro`, `mcp-abap-adt-compact-http`
|
|
92
|
-
* and `mcp-abap-adt-compact-http-ro` are this table with their own set,
|
|
93
|
-
* nothing else.
|
|
94
|
-
*/
|
|
95
|
-
function httpParameters(toolSet, program = 'mcp-abap-adt-http') {
|
|
96
|
-
return {
|
|
97
|
-
program,
|
|
98
|
-
rows: [
|
|
99
|
-
config_1.CONF_ROW,
|
|
100
|
-
responsible_rules_1.SYSTEM_TYPE_ROW,
|
|
101
|
-
...exports.HTTP_ROWS,
|
|
102
|
-
...(0, config_1.tlsRows)('http'),
|
|
103
|
-
config_1.STATE_IDLE_ROW,
|
|
104
|
-
config_1.BATCH_KEEP_RAW_PARTS_ROW,
|
|
105
|
-
config_1.SHUTDOWN_TIMEOUT_ROW,
|
|
106
|
-
],
|
|
107
|
-
removed: [
|
|
108
|
-
toolSet.expositionRemoved('http'),
|
|
109
|
-
(0, config_1.transportRemoved)('http'),
|
|
110
|
-
config_1.DESTINATION_OPTIONS_REMOVED,
|
|
111
|
-
config_1.SSE_OPTIONS_REMOVED,
|
|
112
|
-
],
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
/** `mcp-abap-adt-http`'s table: http's, with the full tool set. */
|
|
116
|
-
exports.HTTP_PARAMETERS = httpParameters(tool_set_1.fullToolSet);
|
|
117
|
-
const list = (v) => Array.isArray(v) ? [...v] : undefined;
|
|
118
|
-
/**
|
|
119
|
-
* `mcp-abap-adt-http`'s configuration from the arguments, the environment
|
|
120
|
-
* and the loaded config file. A removed parameter, or an invalid value,
|
|
121
|
-
* throws a `ParameterRefusal` in its words.
|
|
122
|
-
*/
|
|
123
|
-
function readHttpConfig(argv, env, yaml = null, toolSet = tool_set_1.fullToolSet) {
|
|
124
|
-
const table = httpParameters(toolSet);
|
|
125
|
-
const values = (0, config_1.readParameters)(table, argv, env, yaml);
|
|
126
|
-
return {
|
|
127
|
-
configFile: values.configFile,
|
|
128
|
-
systemType: values.systemType,
|
|
129
|
-
systemTypeSource: (0, config_1.parameterSource)(table, 'systemType', argv, env, yaml),
|
|
130
|
-
stateIdleMinutes: values.stateIdleMinutes,
|
|
131
|
-
batchKeepRawParts: values.batchKeepRawParts === true,
|
|
132
|
-
shutdownTimeout: values.shutdownTimeout,
|
|
133
|
-
host: values.host,
|
|
134
|
-
port: values.port,
|
|
135
|
-
httpPath: values.httpPath,
|
|
136
|
-
httpJsonResponse: values.httpJsonResponse,
|
|
137
|
-
allowedHosts: list(values.allowedHosts),
|
|
138
|
-
allowedOrigins: list(values.allowedOrigins),
|
|
139
|
-
enableDnsRebindingProtection: values.enableDnsRebindingProtection ?? false,
|
|
140
|
-
tls: (0, config_1.tlsConfigOf)(values),
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
//# sourceMappingURL=httpParameters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"httpParameters.js","sourceRoot":"","sources":["../../src/config/httpParameters.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAyGH,wCAsBC;AA+BD,wCAyBC;AArLD,qDAkBkC;AAClC,yDAAuE;AACvE,uEAAkE;AAElE,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAE/B,+CAA+C;AAClC,QAAA,SAAS,GAAyB;IAC7C;QACE,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,QAAQ;QACb,UAAU,EAAE,CAAC,aAAa,CAAC;QAC3B,GAAG,EAAE,eAAe;QACp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