@mcp-abap-adt/sse 0.0.0-stage → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,384 @@
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.SseServer = 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 sse_js_1 = require("@modelcontextprotocol/sdk/server/sse.js");
15
+ const express_1 = __importDefault(require("express"));
16
+ const sseVersion_js_1 = require("./sseVersion.js");
17
+ /**
18
+ * The SSE server: a `GET` opens a connection and builds one
19
+ * `BaseMcpServer` for it, whose source is that `GET`'s `x-sap-*` headers
20
+ * (lib's `headerSource`) — one per connection, shared with no other and
21
+ * outliving none. A `POST` is routed by its `sessionId` alone: its own
22
+ * `x-sap-*` headers are not read. A `GET` without credentials, and a `GET` or
23
+ * a `POST` carrying `x-mcp-destination`, are answered `400`.
24
+ *
25
+ * Supports two modes:
26
+ * 1. Standalone mode: Creates its own Express server (when no app option provided)
27
+ * 2. Embedded mode: Registers routes on external app (when app option provided)
28
+ */
29
+ class SseServer {
30
+ handlersRegistry;
31
+ host;
32
+ port;
33
+ ssePath;
34
+ postPath;
35
+ sessions = new Map();
36
+ /**
37
+ * Every connection from its `GET` until its close settled — being set up,
38
+ * open, or closing — with its one cleanup (the instance close): a
39
+ * shutdown runs it for the open ones and joins the ones already closing
40
+ * A close that settled before the shutdown is only logged.
41
+ */
42
+ connections = new Map();
43
+ logger;
44
+ version;
45
+ externalApp;
46
+ standaloneServer;
47
+ /** The listener stopped, until its last connections are closed after the last step. */
48
+ stoppedListener;
49
+ tls;
50
+ allowedHosts;
51
+ allowedOrigins;
52
+ enableDnsRebindingProtection;
53
+ stateIdleMinutes;
54
+ stateLogger;
55
+ backgroundRuns;
56
+ batchSettings;
57
+ /** The corrected header pairs: the process's, shared by every stream's instance. */
58
+ adtHeaderPairs = new embeddable_1.AdtHeaderPairs();
59
+ constructor(handlersRegistry, opts) {
60
+ this.handlersRegistry = handlersRegistry;
61
+ this.host = opts?.host ?? '127.0.0.1';
62
+ this.port = opts?.port ?? 3001;
63
+ this.ssePath = opts?.ssePath ?? '/sse';
64
+ this.postPath = opts?.postPath ?? '/messages';
65
+ this.logger = opts?.logger ?? logger_1.noopLogger;
66
+ this.version = opts?.version ?? sseVersion_js_1.SSE_VERSION;
67
+ this.externalApp = opts?.app;
68
+ this.tls = opts?.tls;
69
+ this.allowedHosts = opts?.allowedHosts;
70
+ this.allowedOrigins = opts?.allowedOrigins;
71
+ this.enableDnsRebindingProtection = opts?.enableDnsRebindingProtection;
72
+ // Refused here, at startup, rather than at a session's first request.
73
+ this.stateIdleMinutes =
74
+ opts?.stateIdleMinutes === undefined
75
+ ? undefined
76
+ : (0, state_1.parseStateIdleMinutes)(opts.stateIdleMinutes, 'stateIdleMinutes');
77
+ // From the options as given: the silent default of `this.logger` is never the state's.
78
+ this.stateLogger = (0, state_1.stateLoggerOf)(opts ?? {});
79
+ this.backgroundRuns = opts?.backgroundRuns;
80
+ this.batchSettings =
81
+ opts?.batch === undefined
82
+ ? undefined
83
+ : { keepRawParts: opts.batch.keepRawParts === true };
84
+ }
85
+ /**
86
+ * Register routes on an external HTTP application
87
+ * Use this when integrating with existing Express/CDS/CAP server
88
+ *
89
+ * @param app - External HTTP application (Express, CDS, etc.)
90
+ * @param options - Route registration options
91
+ */
92
+ registerRoutes(app, _options) {
93
+ // Health check endpoint — lightweight, no MCP protocol logic
94
+ app.get('/mcp/health', ((_req, res) => {
95
+ res.json({
96
+ status: 'ok',
97
+ uptime: Math.floor(process.uptime()),
98
+ version: this.version,
99
+ transport: 'sse',
100
+ activeSessions: this.sessions.size,
101
+ });
102
+ }));
103
+ const dnsOpts = {
104
+ enable: this.enableDnsRebindingProtection,
105
+ allowedHosts: this.allowedHosts,
106
+ allowedOrigins: this.allowedOrigins,
107
+ };
108
+ app.get(this.ssePath, (0, http_transport_1.withDnsRebindingProtection)((async (req, res) => {
109
+ await this.handleGet(req, res);
110
+ }), dnsOpts));
111
+ app.post(this.postPath, (0, http_transport_1.withDnsRebindingProtection)((async (req, res) => {
112
+ const url = new URL(req.originalUrl, `http://${req.headers.host}`);
113
+ await this.handlePost(req, res, url);
114
+ }), dnsOpts));
115
+ console.error(`[SseServer] Routes registered on external app`);
116
+ console.error(`[SseServer] SSE endpoint: ${this.ssePath}`);
117
+ console.error(`[SseServer] POST endpoint: ${this.postPath}`);
118
+ }
119
+ /**
120
+ * Get the configured SSE endpoint path
121
+ */
122
+ getSsePath() {
123
+ return this.ssePath;
124
+ }
125
+ /**
126
+ * Get the configured POST endpoint path
127
+ */
128
+ getPostPath() {
129
+ return this.postPath;
130
+ }
131
+ /**
132
+ * Start the server
133
+ *
134
+ * In standalone mode (no external app): Creates Express server and starts listening
135
+ * In embedded mode (external app provided): Only registers routes on external app
136
+ */
137
+ async start() {
138
+ // If external app was provided in constructor, register routes on it
139
+ if (this.externalApp) {
140
+ this.registerRoutes(this.externalApp);
141
+ return;
142
+ }
143
+ // Standalone mode: create own Express server
144
+ const app = (0, express_1.default)();
145
+ app.use(express_1.default.json());
146
+ this.registerRoutes(app);
147
+ await new Promise((resolve, reject) => {
148
+ const protocol = (0, http_transport_1.getProtocol)(this.tls);
149
+ const server = (0, http_transport_1.createServerListener)(app, this.tls);
150
+ this.standaloneServer = server;
151
+ server.listen(this.port, this.host);
152
+ server.once('listening', () => {
153
+ console.error(`[SseServer] Server started on ${this.host}:${this.port}`);
154
+ console.error(`[SseServer] SSE endpoint: ${protocol}://${this.host}:${this.port}${this.ssePath}`);
155
+ console.error(`[SseServer] POST endpoint: ${protocol}://${this.host}:${this.port}${this.postPath}`);
156
+ resolve();
157
+ });
158
+ server.once('error', reject);
159
+ });
160
+ }
161
+ /** Stops taking connections. Embedded on an external app there is no listener of its own. */
162
+ stopListening() {
163
+ const server = this.standaloneServer;
164
+ if (server) {
165
+ this.standaloneServer = undefined;
166
+ this.stoppedListener = server;
167
+ server.close();
168
+ server.closeIdleConnections();
169
+ }
170
+ }
171
+ /**
172
+ * The launcher's shutdown, after the logoffs (lib's
173
+ * `installTransportShutdown`), and `stop()`: nothing is answered any more —
174
+ * the connections still open on the stopped listener (a request whose tool
175
+ * was interrupted, a client's idle keep-alive) are closed, so none keeps
176
+ * the process alive.
177
+ */
178
+ releaseConnections() {
179
+ this.stoppedListener?.closeAllConnections();
180
+ this.stoppedListener = undefined;
181
+ }
182
+ /**
183
+ * For a host that stops the server itself (embedded): the listener
184
+ * closes, then every connection's instance close — its connections logged
185
+ * off at once, its calls interrupted (no tool awaited, no timer). A
186
+ * launcher's shutdown does not run this: it logs every connection the
187
+ * process owns off at once and interrupts every running tool (lib's
188
+ * `installTransportShutdown`).
189
+ */
190
+ async stop() {
191
+ this.stopListening();
192
+ await this.closeAll();
193
+ this.releaseConnections();
194
+ }
195
+ /** The instance close of every connection, joined where one runs already. */
196
+ async closeAll() {
197
+ await Promise.all([...this.connections.values()].map((c) => c.close()));
198
+ }
199
+ async handleGet(req, res) {
200
+ // The shutdown began: no new connection (embedded hosts keep their
201
+ // listener; a launcher's is closed already).
202
+ if ((0, state_1.isLatched)()) {
203
+ if (!res.headersSent)
204
+ res.writeHead(503).end('the server is shutting down');
205
+ return;
206
+ }
207
+ // The connection's source, from this GET's x-sap-* headers alone; a
208
+ // header this server no longer serves is refused, never ignored.
209
+ let context;
210
+ try {
211
+ context = (0, http_transport_1.headerContext)(req.headers);
212
+ }
213
+ catch (error) {
214
+ this.answerFailure(res, error);
215
+ return;
216
+ }
217
+ this.logger.debug('SSE GET: credentials from x-sap-* headers');
218
+ class SessionServer extends embeddable_1.BaseMcpServer {
219
+ registry;
220
+ loggerImpl;
221
+ ver;
222
+ constructor(registry, loggerImpl, ver, state) {
223
+ super({
224
+ name: 'mcp-abap-adt-sse',
225
+ version: ver,
226
+ logger: loggerImpl,
227
+ ...state,
228
+ // The responsible rules, once per stream, when its connection is
229
+ // created.
230
+ systemContextResolver: request_context_1.defaultSystemContextResolver,
231
+ systemContextRules: responsible_rules_1.responsibleRules,
232
+ });
233
+ this.registry = registry;
234
+ this.loggerImpl = loggerImpl;
235
+ this.ver = ver;
236
+ }
237
+ init(connectionContext) {
238
+ this.setConnectionContext(connectionContext);
239
+ this.registerHandlers(this.registry);
240
+ }
241
+ }
242
+ const server = new SessionServer(this.handlersRegistry, this.logger, this.version, {
243
+ stateIdleMinutes: this.stateIdleMinutes,
244
+ stateLogger: this.stateLogger,
245
+ ...(this.backgroundRuns !== undefined && {
246
+ backgroundRuns: this.backgroundRuns,
247
+ }),
248
+ // Batch mode: this connection's own, never shared with another.
249
+ ...(this.batchSettings !== undefined && {
250
+ batch: new embeddable_1.InstanceBatch(this.batchSettings),
251
+ }),
252
+ adtHeaderPairs: this.adtHeaderPairs,
253
+ });
254
+ server.init(context);
255
+ const transport = new sse_js_1.SSEServerTransport(this.postPath, res);
256
+ const sessionId = transport.sessionId;
257
+ console.error(`[SSE GET] Created session ${sessionId}`);
258
+ // Capture what the session states (x-sap-language, x-sap-responsible,
259
+ // x-sap-master-system) once at connection time; it is scoped around each
260
+ // POST dispatch below so it never leaks into other sessions via a
261
+ // process-global cache (#110).
262
+ const requestContext = (0, request_context_1.requestContextFromHeaders)(req.headers);
263
+ // The close tracking comes first, before the first setup await: the response's close, the stream's failure and a rejected
264
+ // connect all reach this one cleanup — the instance close, once.
265
+ let cleanup;
266
+ const close = () => {
267
+ cleanup ??= this.closeConnection(sessionId, server);
268
+ return cleanup;
269
+ };
270
+ this.connections.set(server, { sessionId, close });
271
+ res.on('close', () => {
272
+ console.error(`[SSE CLOSE] Connection closed for session ${sessionId}`);
273
+ void close();
274
+ });
275
+ res.on('error', () => {
276
+ void close();
277
+ });
278
+ try {
279
+ await server.connect(transport);
280
+ this.logger.debug(`SSE GET: server connected for session ${sessionId}`);
281
+ }
282
+ catch (error) {
283
+ this.logger.error(`SSE GET: failed to connect for session ${sessionId}: ${this.failureWords(error)}`);
284
+ if (!res.headersSent) {
285
+ res.writeHead(500).end('Internal Server Error');
286
+ }
287
+ void close();
288
+ return;
289
+ }
290
+ // An instance whose connection closed during setup is never published.
291
+ if (cleanup !== undefined)
292
+ return;
293
+ this.sessions.set(sessionId, { server, transport, requestContext });
294
+ console.error(`[SSE GET] Session stored, total sessions: ${this.sessions.size}`);
295
+ }
296
+ /**
297
+ * One connection's cleanup — the client closed its stream, as a
298
+ * stdio client closes stdin: the session leaves the routing map first
299
+ * (main's: a later `POST` for it is an unknown session), then the instance
300
+ * close — the instance latch, its connections logged off at once and its
301
+ * running and queued calls interrupted in the same tick (no tool awaited),
302
+ * its state let go, its MCP server and stream closed.
303
+ */
304
+ async closeConnection(sessionId, server) {
305
+ if (this.sessions.get(sessionId)?.server === server) {
306
+ this.sessions.delete(sessionId);
307
+ }
308
+ try {
309
+ await (0, embeddable_1.closeInstance)(server);
310
+ }
311
+ finally {
312
+ this.connections.delete(server);
313
+ }
314
+ }
315
+ async handlePost(req, res, url) {
316
+ // A header this server no longer serves is refused on a POST too; the
317
+ // POST's own x-sap-* headers are not read (the connection's are its GET's).
318
+ try {
319
+ (0, http_transport_1.refuseDestinationHeader)(req.headers);
320
+ }
321
+ catch (error) {
322
+ this.answerFailure(res, error);
323
+ return;
324
+ }
325
+ const sessionId = (url?.searchParams.get('sessionId') ||
326
+ req.headers['x-session-id'] ||
327
+ '');
328
+ const mcpMethod = req.body?.method;
329
+ const isPing = mcpMethod === 'ping';
330
+ if (!isPing) {
331
+ console.error(`[SSE POST] sessionId=${sessionId}, activeSessions=${this.sessions.size}, keys=[${Array.from(this.sessions.keys()).join(', ')}]`);
332
+ }
333
+ const entry = this.sessions.get(sessionId);
334
+ if (!entry) {
335
+ console.error(`[SSE POST] Invalid session ${sessionId} - session not found!`);
336
+ res.writeHead(400).end('Invalid session');
337
+ return;
338
+ }
339
+ // Pass pre-parsed body from express.json() middleware (like reference implementation)
340
+ // express.json() already read and parsed the body into req.body
341
+ if (!isPing) {
342
+ console.error(`[SSE POST] Calling handlePostMessage with req.body for session ${sessionId}`);
343
+ }
344
+ try {
345
+ await (0, request_context_1.runWithRequestContext)({ ...entry.requestContext }, () => entry.transport.handlePostMessage(req, res, req.body));
346
+ if (!isPing) {
347
+ console.error(`[SSE POST] Successfully processed for session ${sessionId}`);
348
+ }
349
+ }
350
+ catch (error) {
351
+ // Fixed words and what the reader makes of it — never its message.
352
+ console.error(`[SSE POST] FAILED for session ${sessionId}: ${this.failureWords(error)}`);
353
+ if (!res.headersSent) {
354
+ res.writeHead(500).end('Internal Server Error');
355
+ }
356
+ }
357
+ }
358
+ /**
359
+ * What a log line says of a thrown value: `logFields` of the failure the
360
+ * reader knows, else its class only — a message may quote a file.
361
+ */
362
+ failureWords(error) {
363
+ const answer = (0, http_transport_1.requestFailureAnswer)(error);
364
+ return answer.logLine ?? (0, auth_1.errorClassOf)(error);
365
+ }
366
+ /** A request refused or failed: the refusal's words (400), the reader's, or as before. */
367
+ answerFailure(res, error) {
368
+ const answer = (0, http_transport_1.requestFailureAnswer)(error);
369
+ if (answer.logLine !== undefined)
370
+ console.error(answer.logLine);
371
+ if (answer.known) {
372
+ console.error(`[SSE] FAILED: ${answer.text}`);
373
+ }
374
+ else {
375
+ // No words for it: its class only — a message may quote a file (H4).
376
+ console.error(`[SSE] FAILED: ${(0, auth_1.errorClassOf)(error)}`);
377
+ }
378
+ if (!res.headersSent) {
379
+ res.status(answer.status).send(answer.text);
380
+ }
381
+ }
382
+ }
383
+ exports.SseServer = SseServer;
384
+ //# sourceMappingURL=SseServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SseServer.js","sourceRoot":"","sources":["../src/SseServer.ts"],"names":[],"mappings":";;;;;;AAEA,iDAAsD;AAQtD,6DAKsC;AAEtC,qEAO0C;AAC1C,qDAAsD;AACtD,uEAK2C;AAC3C,mDAKiC;AAEjC,uEAAmE;AACnE,oEAA6E;AAC7E,sDAA8B;AAC9B,mDAA8C;AA+E9C;;;;;;;;;;;GAWG;AACH,MAAa,SAAS;IAkCD;IAjCF,IAAI,CAAS;IACb,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,QAAQ,CAAS;IACjB,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC5D;;;;;OAKG;IACc,WAAW,GAAG,IAAI,GAAG,EAGnC,CAAC;IACa,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,WAAW,CAAoB;IACxC,gBAAgB,CAA4B;IACpD,uFAAuF;IAC/E,eAAe,CAA4B;IAClC,GAAG,CAAa;IAChB,YAAY,CAAY;IACxB,cAAc,CAAY;IAC1B,4BAA4B,CAAW;IACvC,gBAAgB,CAAU;IAC1B,WAAW,CAAc;IACzB,cAAc,CAA8B;IAC5C,aAAa,CAAwC;IACtE,oFAAoF;IACnE,cAAc,GAAG,IAAI,2BAAc,EAAE,CAAC;IAEvD,YACmB,gBAAmC,EACpD,IAAuB;QADN,qBAAgB,GAAhB,gBAAgB,CAAmB;QAGpD,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,IAAI,IAAI,WAAW,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,OAAO,IAAI,MAAM,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI,WAAW,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,IAA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"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * `mcp-abap-adt-sse`'s parameter table: every SSE
3
+ * option of today under its name, beside lib's shared rows and the TLS rows
4
+ *. No destination, login or Streamable HTTP option is here; the CLI or
5
+ * YAML form of one — or any form of `--transport`, which is gone — stops the
6
+ * start naming the binary that serves it. Their environment variables
7
+ * are not read.
8
+ */
9
+ import { type IServerConfig, type Parameter, type ParameterTable, type TlsConfig, type YamlConfig } from '@mcp-abap-adt/lib/config';
10
+ import { type ToolSet } from '@mcp-abap-adt/lib/tool-set';
11
+ /** The SSE rows: today's names. */
12
+ export declare const SSE_ROWS: readonly Parameter[];
13
+ /**
14
+ * sse's table for a tool set: its rows, the shared rows, and what it
15
+ * refuses — the set's removed `--exposition` among them, naming the sse
16
+ * binary its words asked for. `mcp-abap-adt-sse-ro`, `mcp-abap-adt-compact-sse`
17
+ * and `mcp-abap-adt-compact-sse-ro` are this table with their own set,
18
+ * nothing else.
19
+ */
20
+ export declare function sseParameters(toolSet: ToolSet, program?: string): ParameterTable;
21
+ /** `mcp-abap-adt-sse`'s table: sse's, with the full tool set. */
22
+ export declare const SSE_PARAMETERS: ParameterTable;
23
+ /** What `mcp-abap-adt-sse` reads. */
24
+ export interface SseConfig extends IServerConfig {
25
+ host?: string;
26
+ port?: number;
27
+ /** The path of the GET that opens an SSE connection */
28
+ ssePath?: string;
29
+ /** The path of a connection's POST messages */
30
+ postPath?: string;
31
+ /** Allowed Host header values (DNS-rebinding protection; exact, incl. port) */
32
+ allowedHosts?: string[];
33
+ /** Allowed Origin header values (DNS-rebinding protection; exact, incl. scheme) */
34
+ allowedOrigins?: string[];
35
+ /** Enable DNS-rebinding protection */
36
+ enableDnsRebindingProtection?: boolean;
37
+ /** TLS: cert and key start HTTPS */
38
+ tls?: TlsConfig;
39
+ }
40
+ /**
41
+ * `mcp-abap-adt-sse`'s configuration from the arguments, the environment and
42
+ * the loaded config file. A removed parameter, or an invalid value, throws a
43
+ * `ParameterRefusal` in its words.
44
+ */
45
+ export declare function readSseConfig(argv: readonly string[], env: NodeJS.ProcessEnv, yaml?: YamlConfig | null, toolSet?: ToolSet): SseConfig;
46
+ //# sourceMappingURL=sseParameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sseParameters.d.ts","sourceRoot":"","sources":["../../src/config/sseParameters.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,cAAc,EAMnB,KAAK,SAAS,EAId,KAAK,UAAU,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAe,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAKvE,mCAAmC;AACnC,eAAO,MAAM,QAAQ,EAAE,SAAS,SAAS,EAiExC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,SAAqB,GAC3B,cAAc,CAmBhB;AAED,iEAAiE;AACjE,eAAO,MAAM,cAAc,EAAE,cAA2C,CAAC;AAEzE,qCAAqC;AACrC,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+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,aAAa,CAC3B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,IAAI,GAAE,UAAU,GAAG,IAAW,EAC9B,OAAO,GAAE,OAAqB,GAC7B,SAAS,CAoBX"}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ /**
3
+ * `mcp-abap-adt-sse`'s parameter table: every SSE
4
+ * option of today under its name, beside lib's shared rows and the TLS rows
5
+ *. No destination, login or Streamable HTTP option is here; the CLI or
6
+ * YAML form of one — or any form of `--transport`, which is gone — stops the
7
+ * start naming the binary that serves it. Their environment variables
8
+ * are not read.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.SSE_PARAMETERS = exports.SSE_ROWS = void 0;
12
+ exports.sseParameters = sseParameters;
13
+ exports.readSseConfig = readSseConfig;
14
+ const config_1 = require("@mcp-abap-adt/lib/config");
15
+ const tool_set_1 = require("@mcp-abap-adt/lib/tool-set");
16
+ const responsible_rules_1 = require("@mcp-abap-adt/responsible-rules");
17
+ const SSE = 'SSE';
18
+ /** The SSE rows: today's names. */
19
+ exports.SSE_ROWS = [
20
+ {
21
+ key: 'host',
22
+ cli: '--sse-host',
23
+ env: 'MCP_SSE_HOST',
24
+ yaml: 'sse.host',
25
+ kind: 'string',
26
+ default: '127.0.0.1',
27
+ valueHint: '=<host>',
28
+ section: SSE,
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: '--sse-port',
34
+ env: 'MCP_SSE_PORT',
35
+ yaml: 'sse.port',
36
+ kind: 'port',
37
+ default: 3001,
38
+ section: SSE,
39
+ help: 'Port to listen on, 1-65535 (default 3001)',
40
+ },
41
+ {
42
+ key: 'ssePath',
43
+ cli: '--sse-path',
44
+ kind: 'string',
45
+ valueHint: '=<path>',
46
+ section: SSE,
47
+ help: 'The path of the GET that opens an SSE connection (default /sse)',
48
+ },
49
+ {
50
+ key: 'postPath',
51
+ cli: '--post-path',
52
+ kind: 'string',
53
+ valueHint: '=<path>',
54
+ section: SSE,
55
+ help: "The path of a connection's POST messages (default /messages)",
56
+ },
57
+ {
58
+ key: 'allowedHosts',
59
+ cli: '--sse-allowed-hosts',
60
+ env: 'MCP_SSE_ALLOWED_HOSTS',
61
+ yaml: 'sse.allowed-hosts',
62
+ kind: 'list',
63
+ section: SSE,
64
+ help: 'Host header values accepted with DNS-rebinding protection (exact, with the port), comma-separated',
65
+ },
66
+ {
67
+ key: 'allowedOrigins',
68
+ cli: '--sse-allowed-origins',
69
+ env: 'MCP_SSE_ALLOWED_ORIGINS',
70
+ yaml: 'sse.allowed-origins',
71
+ kind: 'list',
72
+ section: SSE,
73
+ help: 'Origin header values accepted with DNS-rebinding protection (exact, with the scheme), comma-separated',
74
+ },
75
+ {
76
+ key: 'enableDnsRebindingProtection',
77
+ cli: '--sse-enable-dns-protection',
78
+ env: 'MCP_SSE_ENABLE_DNS_PROTECTION',
79
+ yaml: 'sse.enable-dns-protection',
80
+ kind: 'flag',
81
+ section: SSE,
82
+ help: 'Enable DNS-rebinding protection (with --sse-allowed-hosts and/or --sse-allowed-origins)',
83
+ },
84
+ ];
85
+ /**
86
+ * sse's table for a tool set: its rows, the shared rows, and what it
87
+ * refuses — the set's removed `--exposition` among them, naming the sse
88
+ * binary its words asked for. `mcp-abap-adt-sse-ro`, `mcp-abap-adt-compact-sse`
89
+ * and `mcp-abap-adt-compact-sse-ro` are this table with their own set,
90
+ * nothing else.
91
+ */
92
+ function sseParameters(toolSet, program = 'mcp-abap-adt-sse') {
93
+ return {
94
+ program,
95
+ rows: [
96
+ config_1.CONF_ROW,
97
+ responsible_rules_1.SYSTEM_TYPE_ROW,
98
+ ...exports.SSE_ROWS,
99
+ ...(0, config_1.tlsRows)('sse'),
100
+ config_1.STATE_IDLE_ROW,
101
+ config_1.BATCH_KEEP_RAW_PARTS_ROW,
102
+ config_1.SHUTDOWN_TIMEOUT_ROW,
103
+ ],
104
+ removed: [
105
+ toolSet.expositionRemoved('sse'),
106
+ (0, config_1.transportRemoved)('sse'),
107
+ config_1.DESTINATION_OPTIONS_REMOVED,
108
+ config_1.HTTP_OPTIONS_REMOVED,
109
+ ],
110
+ };
111
+ }
112
+ /** `mcp-abap-adt-sse`'s table: sse's, with the full tool set. */
113
+ exports.SSE_PARAMETERS = sseParameters(tool_set_1.fullToolSet);
114
+ const list = (v) => Array.isArray(v) ? [...v] : undefined;
115
+ /**
116
+ * `mcp-abap-adt-sse`'s configuration from the arguments, the environment and
117
+ * the loaded config file. A removed parameter, or an invalid value, throws a
118
+ * `ParameterRefusal` in its words.
119
+ */
120
+ function readSseConfig(argv, env, yaml = null, toolSet = tool_set_1.fullToolSet) {
121
+ const table = sseParameters(toolSet);
122
+ const values = (0, config_1.readParameters)(table, argv, env, yaml);
123
+ return {
124
+ configFile: values.configFile,
125
+ systemType: values.systemType,
126
+ systemTypeSource: (0, config_1.parameterSource)(table, 'systemType', argv, env, yaml),
127
+ stateIdleMinutes: values.stateIdleMinutes,
128
+ batchKeepRawParts: values.batchKeepRawParts === true,
129
+ shutdownTimeout: values.shutdownTimeout,
130
+ host: values.host,
131
+ port: values.port,
132
+ ssePath: values.ssePath,
133
+ postPath: values.postPath,
134
+ allowedHosts: list(values.allowedHosts),
135
+ allowedOrigins: list(values.allowedOrigins),
136
+ enableDnsRebindingProtection: values.enableDnsRebindingProtection ?? false,
137
+ tls: (0, config_1.tlsConfigOf)(values),
138
+ };
139
+ }
140
+ //# sourceMappingURL=sseParameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sseParameters.js","sourceRoot":"","sources":["../../src/config/sseParameters.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAqGH,sCAsBC;AA+BD,sCAyBC;AAjLD,qDAkBkC;AAClC,yDAAuE;AACvE,uEAAkE;AAElE,MAAM,GAAG,GAAG,KAAK,CAAC;AAElB,mCAAmC;AACtB,QAAA,QAAQ,GAAyB;IAC5C;QACE,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,YAAY;QACjB,GAAG,EAAE,cAAc;QACnB,IAAI,EAAE,U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I,EAAE,MAAM,CAAC,IAAc;QAC3B,IAAI,EAAE,MAAM,CAAC,IAAc;QAC3B,OAAO,EAAE,MAAM,CAAC,OAA6B;QAC7C,QAAQ,EAAE,MAAM,CAAC,QAA8B;QAC/C,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;QACvC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;QAC3C,4BAA4B,EACzB,MAAM,CAAC,4BAAoD,IAAI,KAAK;QACvE,GAAG,EAAE,IAAA,oBAAW,EAAC,MAAM,CAAC;KACzB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `@mcp-abap-adt/sse` — the HTTP+SSE transport of the MCP ABAP ADT server,
3
+ * AGPL-3.0-only.
4
+ *
5
+ * Importing from here links AGPL code. If you are embedding ADT tools in your
6
+ * own application, you want `@mcp-abap-adt/lib` instead: it carries the
7
+ * handlers and the embeddable server under Apache-2.0, and no transport.
8
+ */
9
+ export * from './config/sseParameters.js';
10
+ export * from './SseServer.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * `@mcp-abap-adt/sse` — the HTTP+SSE transport of the MCP ABAP ADT server,
4
+ * AGPL-3.0-only.
5
+ *
6
+ * Importing from here links AGPL code. If you are embedding ADT tools in your
7
+ * own application, you want `@mcp-abap-adt/lib` instead: it carries the
8
+ * handlers and the embeddable server under Apache-2.0, and no transport.
9
+ */
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ // sse's parameter table
26
+ __exportStar(require("./config/sseParameters.js"), exports);
27
+ __exportStar(require("./SseServer.js"), exports);
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAEH,wBAAwB;AACxB,4DAA0C;AAC1C,iDAA+B"}