@mcp-abap-adt/core 15.1.0 → 16.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SseServer.d.ts +16 -3
- package/dist/SseServer.d.ts.map +1 -1
- package/dist/SseServer.js +82 -44
- package/dist/SseServer.js.map +1 -1
- package/dist/StdioServer.d.ts +11 -3
- package/dist/StdioServer.d.ts.map +1 -1
- package/dist/StdioServer.js +32 -6
- package/dist/StdioServer.js.map +1 -1
- package/dist/StreamableHttpServer.d.ts +14 -5
- package/dist/StreamableHttpServer.d.ts.map +1 -1
- package/dist/StreamableHttpServer.js +54 -55
- package/dist/StreamableHttpServer.js.map +1 -1
- package/dist/coreVersion.d.ts +14 -0
- package/dist/coreVersion.d.ts.map +1 -0
- package/dist/coreVersion.js +19 -0
- package/dist/coreVersion.js.map +1 -0
- package/dist/destinationRequest.d.ts +38 -0
- package/dist/destinationRequest.d.ts.map +1 -0
- package/dist/destinationRequest.js +85 -0
- package/dist/destinationRequest.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/launcher.d.ts +54 -1
- package/dist/launcher.d.ts.map +1 -1
- package/dist/launcher.js +313 -188
- package/dist/launcher.js.map +1 -1
- package/dist/shutdown.d.ts +45 -0
- package/dist/shutdown.d.ts.map +1 -0
- package/dist/shutdown.js +79 -0
- package/dist/shutdown.js.map +1 -0
- package/package.json +24 -4
- package/dist/AuthBrokerConfig.d.ts +0 -22
- package/dist/AuthBrokerConfig.d.ts.map +0 -1
- package/dist/AuthBrokerConfig.js +0 -43
- package/dist/AuthBrokerConfig.js.map +0 -1
package/dist/SseServer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IDestinations } from '@mcp-abap-adt/lib/auth';
|
|
2
2
|
import type { TlsConfig } from '@mcp-abap-adt/lib/config';
|
|
3
3
|
import type { IHttpApplication, RouteRegistrationOptions } from '@mcp-abap-adt/lib/embeddable';
|
|
4
4
|
import type { IHandlersRegistry } from '@mcp-abap-adt/lib/handlers';
|
|
@@ -67,13 +67,16 @@ export interface SseServerOptions {
|
|
|
67
67
|
*/
|
|
68
68
|
export declare class SseServer {
|
|
69
69
|
private readonly handlersRegistry;
|
|
70
|
-
|
|
70
|
+
/** The destinations: settings and the counted provider, nothing else. */
|
|
71
|
+
private readonly destinations;
|
|
71
72
|
private readonly host;
|
|
72
73
|
private readonly port;
|
|
73
74
|
private readonly ssePath;
|
|
74
75
|
private readonly postPath;
|
|
75
76
|
private readonly defaultDestination?;
|
|
76
77
|
private readonly sessions;
|
|
78
|
+
/** Per-destination lock around the first connect: it serialises the first login. */
|
|
79
|
+
private readonly firstConnect;
|
|
77
80
|
private readonly logger;
|
|
78
81
|
private readonly version;
|
|
79
82
|
private readonly externalApp?;
|
|
@@ -83,7 +86,9 @@ export declare class SseServer {
|
|
|
83
86
|
private readonly allowedHosts?;
|
|
84
87
|
private readonly allowedOrigins?;
|
|
85
88
|
private readonly enableDnsRebindingProtection?;
|
|
86
|
-
constructor(handlersRegistry: IHandlersRegistry,
|
|
89
|
+
constructor(handlersRegistry: IHandlersRegistry,
|
|
90
|
+
/** The destinations: settings and the counted provider, nothing else. */
|
|
91
|
+
destinations: IDestinations, opts?: SseServerOptions);
|
|
87
92
|
/**
|
|
88
93
|
* Register routes on an external HTTP application
|
|
89
94
|
* Use this when integrating with existing Express/CDS/CAP server
|
|
@@ -107,8 +112,16 @@ export declare class SseServer {
|
|
|
107
112
|
* In embedded mode (external app provided): Only registers routes on external app
|
|
108
113
|
*/
|
|
109
114
|
start(): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Stops taking connections (shutdown, step 1). Requests already running are
|
|
117
|
+
* not waited for, nor is an open stream: the factory's gate holds them.
|
|
118
|
+
* Embedded on an external app, there is no listener of its own to stop.
|
|
119
|
+
*/
|
|
120
|
+
stop(): Promise<void>;
|
|
110
121
|
private handleGet;
|
|
111
122
|
private handlePost;
|
|
123
|
+
/** A session whose destination failed: the error's words, or as before. */
|
|
124
|
+
private answerFailure;
|
|
112
125
|
/**
|
|
113
126
|
* Check if request has SAP connection headers
|
|
114
127
|
*/
|
package/dist/SseServer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SseServer.d.ts","sourceRoot":"","sources":["../src/SseServer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"SseServer.d.ts","sourceRoot":"","sources":["../src/SseServer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAOpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAYnD,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,GAAG,CAAC,EAAE,gBAAgB,CAAC;IACvB;;OAEG;IACH,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CA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rB,QAAQ,CAAC,EAAE,wBAAwB,GAClC,IAAI;IAiDP;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAmC5B;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAQb,SAAS;YA8HT,UAAU;IAmDxB,2EAA2E;IAC3E,OAAO,CAAC,aAAa;IAarB;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAShC"}
|
package/dist/SseServer.js
CHANGED
|
@@ -4,14 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SseServer = void 0;
|
|
7
|
+
const auth_1 = require("@mcp-abap-adt/lib/auth");
|
|
7
8
|
const embeddable_1 = require("@mcp-abap-adt/lib/embeddable");
|
|
8
9
|
const logger_1 = require("@mcp-abap-adt/lib/logger");
|
|
9
10
|
const request_context_1 = require("@mcp-abap-adt/lib/request-context");
|
|
10
11
|
const sse_js_1 = require("@modelcontextprotocol/sdk/server/sse.js");
|
|
11
12
|
const express_1 = __importDefault(require("express"));
|
|
13
|
+
const coreVersion_js_1 = require("./coreVersion.js");
|
|
14
|
+
const destinationRequest_js_1 = require("./destinationRequest.js");
|
|
12
15
|
const dnsRebindingProtection_js_1 = require("./dnsRebindingProtection.js");
|
|
13
16
|
const tlsUtils_js_1 = require("./tlsUtils.js");
|
|
14
|
-
const DEFAULT_VERSION = process.env.npm_package_version ?? '1.0.0';
|
|
15
17
|
/**
|
|
16
18
|
* Minimal SSE server: creates a new BaseMcpServer per GET connection, routes POST by sessionId.
|
|
17
19
|
*
|
|
@@ -21,13 +23,15 @@ const DEFAULT_VERSION = process.env.npm_package_version ?? '1.0.0';
|
|
|
21
23
|
*/
|
|
22
24
|
class SseServer {
|
|
23
25
|
handlersRegistry;
|
|
24
|
-
|
|
26
|
+
destinations;
|
|
25
27
|
host;
|
|
26
28
|
port;
|
|
27
29
|
ssePath;
|
|
28
30
|
postPath;
|
|
29
31
|
defaultDestination;
|
|
30
32
|
sessions = new Map();
|
|
33
|
+
/** Per-destination lock around the first connect: it serialises the first login. */
|
|
34
|
+
firstConnect = new destinationRequest_js_1.FirstConnectLock();
|
|
31
35
|
logger;
|
|
32
36
|
version;
|
|
33
37
|
externalApp;
|
|
@@ -37,16 +41,18 @@ class SseServer {
|
|
|
37
41
|
allowedHosts;
|
|
38
42
|
allowedOrigins;
|
|
39
43
|
enableDnsRebindingProtection;
|
|
40
|
-
constructor(handlersRegistry,
|
|
44
|
+
constructor(handlersRegistry,
|
|
45
|
+
/** The destinations: settings and the counted provider, nothing else. */
|
|
46
|
+
destinations, opts) {
|
|
41
47
|
this.handlersRegistry = handlersRegistry;
|
|
42
|
-
this.
|
|
48
|
+
this.destinations = destinations;
|
|
43
49
|
this.host = opts?.host ?? '127.0.0.1';
|
|
44
50
|
this.port = opts?.port ?? 3001;
|
|
45
51
|
this.ssePath = opts?.ssePath ?? '/sse';
|
|
46
52
|
this.postPath = opts?.postPath ?? '/messages';
|
|
47
53
|
this.defaultDestination = opts?.defaultDestination;
|
|
48
54
|
this.logger = opts?.logger ?? logger_1.noopLogger;
|
|
49
|
-
this.version = opts?.version ??
|
|
55
|
+
this.version = opts?.version ?? coreVersion_js_1.CORE_VERSION;
|
|
50
56
|
this.externalApp = opts?.app;
|
|
51
57
|
this.tls = opts?.tls;
|
|
52
58
|
this.allowDestinationHeader = opts?.allowDestinationHeader ?? false;
|
|
@@ -133,35 +139,49 @@ class SseServer {
|
|
|
133
139
|
server.once('error', reject);
|
|
134
140
|
});
|
|
135
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Stops taking connections (shutdown, step 1). Requests already running are
|
|
144
|
+
* not waited for, nor is an open stream: the factory's gate holds them.
|
|
145
|
+
* Embedded on an external app, there is no listener of its own to stop.
|
|
146
|
+
*/
|
|
147
|
+
async stop() {
|
|
148
|
+
const server = this.standaloneServer;
|
|
149
|
+
if (!server)
|
|
150
|
+
return;
|
|
151
|
+
this.standaloneServer = undefined;
|
|
152
|
+
server.close();
|
|
153
|
+
server.closeIdleConnections();
|
|
154
|
+
}
|
|
136
155
|
async handleGet(req, res) {
|
|
137
156
|
let destination;
|
|
138
|
-
let
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
let fromHeaders = false;
|
|
158
|
+
try {
|
|
159
|
+
// Priority 1: x-mcp-destination (only with --allow-destination-header),
|
|
160
|
+
// refused when it is not a destination name
|
|
161
|
+
const destinationHeader = (0, destinationRequest_js_1.destinationFromHeader)(req.headers, this.allowDestinationHeader);
|
|
162
|
+
if (destinationHeader !== undefined) {
|
|
163
|
+
destination = destinationHeader;
|
|
164
|
+
}
|
|
165
|
+
// Priority 2: Check SAP connection headers (x-sap-url + auth params)
|
|
166
|
+
// The settings and the credential come from the headers, no destination
|
|
167
|
+
else if (this.hasSapConnectionHeaders(req.headers)) {
|
|
168
|
+
destination = undefined;
|
|
169
|
+
fromHeaders = true;
|
|
170
|
+
}
|
|
171
|
+
// Priority 3: Use default destination
|
|
172
|
+
else if (this.defaultDestination) {
|
|
173
|
+
destination = this.defaultDestination;
|
|
174
|
+
}
|
|
175
|
+
// Priority 4: No auth params at all -> reject request
|
|
176
|
+
else {
|
|
177
|
+
res
|
|
178
|
+
.status(400)
|
|
179
|
+
.send('Missing SAP connection context. Provide x-mcp-destination header, configure default destination (--mcp/--env-path), or pass x-sap-* headers.');
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
159
182
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
res
|
|
163
|
-
.status(400)
|
|
164
|
-
.send('Missing SAP connection context. Provide x-mcp-destination header, configure default destination (--mcp/--env-path), or pass x-sap-* headers.');
|
|
183
|
+
catch (error) {
|
|
184
|
+
this.answerFailure(res, error);
|
|
165
185
|
return;
|
|
166
186
|
}
|
|
167
187
|
this.logger.debug(`SSE GET: destination=${destination ?? 'none'}`);
|
|
@@ -175,9 +195,9 @@ class SseServer {
|
|
|
175
195
|
this.loggerImpl = loggerImpl;
|
|
176
196
|
this.ver = ver;
|
|
177
197
|
}
|
|
178
|
-
async init(dest,
|
|
179
|
-
if (dest
|
|
180
|
-
await this.setConnectionContext(dest,
|
|
198
|
+
async init(dest, destinations, firstConnect, hdrs) {
|
|
199
|
+
if (dest) {
|
|
200
|
+
await firstConnect.run(dest, () => this.setConnectionContext(dest, destinations), () => this.getConnection());
|
|
181
201
|
}
|
|
182
202
|
else if (hdrs) {
|
|
183
203
|
this.setConnectionContextFromHeaders(hdrs);
|
|
@@ -186,18 +206,22 @@ class SseServer {
|
|
|
186
206
|
}
|
|
187
207
|
}
|
|
188
208
|
const server = new SessionServer(this.handlersRegistry, this.logger, this.version);
|
|
189
|
-
|
|
209
|
+
try {
|
|
210
|
+
await server.init(destination, this.destinations, this.firstConnect, fromHeaders ? req.headers : undefined);
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
this.answerFailure(res, error);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
190
216
|
const transport = new sse_js_1.SSEServerTransport(this.postPath, res);
|
|
191
217
|
const sessionId = transport.sessionId;
|
|
192
218
|
console.error(`[SSE GET] Created session ${sessionId} for destination ${destination}`);
|
|
193
|
-
// Capture the
|
|
194
|
-
// connection time; it is scoped around each
|
|
195
|
-
// never leaks into other sessions via a
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
: rawSseLang;
|
|
200
|
-
this.sessions.set(sessionId, { server, transport, masterLanguage });
|
|
219
|
+
// Capture what the session states (x-sap-language, x-sap-responsible,
|
|
220
|
+
// x-sap-master-system) once at connection time; it is scoped around each
|
|
221
|
+
// POST dispatch below so it never leaks into other sessions via a
|
|
222
|
+
// process-global cache (#110).
|
|
223
|
+
const requestContext = (0, request_context_1.requestContextFromHeaders)(req.headers);
|
|
224
|
+
this.sessions.set(sessionId, { server, transport, requestContext });
|
|
201
225
|
console.error(`[SSE GET] Session stored, total sessions: ${this.sessions.size}`);
|
|
202
226
|
// Connect transport to server BEFORE registering close handler
|
|
203
227
|
// This ensures connection is established before any cleanup can happen
|
|
@@ -242,7 +266,7 @@ class SseServer {
|
|
|
242
266
|
console.error(`[SSE POST] Calling handlePostMessage with req.body for session ${sessionId}`);
|
|
243
267
|
}
|
|
244
268
|
try {
|
|
245
|
-
await (0, request_context_1.runWithRequestContext)({
|
|
269
|
+
await (0, request_context_1.runWithRequestContext)({ ...entry.requestContext }, () => entry.transport.handlePostMessage(req, res, req.body));
|
|
246
270
|
if (!isPing) {
|
|
247
271
|
console.error(`[SSE POST] Successfully processed for session ${sessionId}`);
|
|
248
272
|
}
|
|
@@ -255,6 +279,20 @@ class SseServer {
|
|
|
255
279
|
}
|
|
256
280
|
}
|
|
257
281
|
}
|
|
282
|
+
/** A session whose destination failed: the error's words, or as before. */
|
|
283
|
+
answerFailure(res, error) {
|
|
284
|
+
const answer = (0, destinationRequest_js_1.destinationFailureAnswer)(error);
|
|
285
|
+
if (answer.known) {
|
|
286
|
+
console.error(`[SSE GET] FAILED: ${answer.text}`);
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
// No words for it: its class only — a message may quote a file (H4).
|
|
290
|
+
console.error(`[SSE GET] FAILED: ${(0, auth_1.errorClassOf)(error)}`);
|
|
291
|
+
}
|
|
292
|
+
if (!res.headersSent) {
|
|
293
|
+
res.status(answer.status).send(answer.text);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
258
296
|
/**
|
|
259
297
|
* Check if request has SAP connection headers
|
|
260
298
|
*/
|
package/dist/SseServer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SseServer.js","sourceRoot":"","sources":["../src/SseServer.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"SseServer.js","sourceRoot":"","sources":["../src/SseServer.ts"],"names":[],"mappings":";;;;;;AAEA,iDAA0E;AAM1E,6DAA6D;AAE7D,qDAAsD;AACtD,uEAI2C;AAE3C,oEAA6E;AAC7E,sDAA8B;AAC9B,qDAAgD;AAChD,mEAIiC;AACjC,2EAAyE;AACzE,+CAAkE;AAoElE;;;;;;GAMG;AACH,MAAa,SAAS;IAoBD;IAEA;IArBF,IAAI,CAAS;IACb,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,QAAQ,CAAS;IACjB,kBAAkB,CAAU;IAC5B,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC5D,oFAAoF;IACnE,YAAY,GAAG,IAAI,wCAAgB,EAAE,CAAC;IACtC,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,WAAW,CAAoB;IACxC,gBAAgB,CAA4B;IACnC,GAAG,CAAa;IAChB,sBAAsB,CAAU;IAChC,YAAY,CAAY;IACxB,cAAc,CAAY;IAC1B,4BAA4B,CAAW;IAExD,YACmB,gBAAmC;IACpD,yEAAyE;IACxD,YAA2B,EAC5C,IAAuB;QAHN,qBAAgB,GAAhB,gBAAgB,CAAmB;QAEnC,iBAAY,GAAZ,YAAY,CAAe;QAG5C,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,kBAAkB,GAA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AC5D,MAAM,UAAU,GAAG,OAAO,CAAC,iBAAiB,CAAC,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC5E,MAAM,YAAY,GAChB,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;YAClD,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAE3D,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,UAAU,IAAI,YAAY,CAAC,CAAC,CAAC;IACpD,CAAC;CACF;AAlXD,8BAkXC"}
|
package/dist/StdioServer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IDestinations } from '@mcp-abap-adt/lib/auth';
|
|
2
2
|
import { BaseMcpServer } from '@mcp-abap-adt/lib/embeddable';
|
|
3
3
|
import type { IHandlersRegistry } from '@mcp-abap-adt/lib/handlers';
|
|
4
4
|
import type { Logger } from '@mcp-abap-adt/logger';
|
|
@@ -10,11 +10,19 @@ export interface StdioServerOptions {
|
|
|
10
10
|
/**
|
|
11
11
|
* Minimal stdio server implementation based on BaseMcpServer.
|
|
12
12
|
* Sets connection context once at startup and connects stdio transport.
|
|
13
|
+
* The destination's settings and provider come from `IDestinations` — the
|
|
14
|
+
* factory, or the inspection-only stand-in.
|
|
13
15
|
*/
|
|
14
16
|
export declare class StdioServer extends BaseMcpServer {
|
|
15
17
|
private readonly handlersRegistry;
|
|
16
|
-
private readonly
|
|
17
|
-
constructor(handlersRegistry: IHandlersRegistry,
|
|
18
|
+
private readonly destinations;
|
|
19
|
+
constructor(handlersRegistry: IHandlersRegistry, destinations: IDestinations, opts?: StdioServerOptions);
|
|
18
20
|
start(destination: string): Promise<void>;
|
|
19
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* The destinations of inspection-only mode (stdio with neither `--mcp` nor an
|
|
24
|
+
* `--env` file): the tools can be listed, and a tool call answers with the
|
|
25
|
+
* refusal of a provider that has no credential, instead of dialling anywhere.
|
|
26
|
+
*/
|
|
27
|
+
export declare function inspectionOnlyDestinations(): IDestinations;
|
|
20
28
|
//# sourceMappingURL=StdioServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StdioServer.d.ts","sourceRoot":"","sources":["../src/StdioServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"StdioServer.d.ts","sourceRoot":"","sources":["../src/StdioServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAInD,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,aAAa;IAE1C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,gBAAgB,EAAE,iBAAiB,EACnC,YAAY,EAAE,aAAa,EAC5C,IAAI,CAAC,EAAE,kBAAkB;IASrB,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOhD;AAKD;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,aAAa,CAgB1D"}
|
package/dist/StdioServer.js
CHANGED
|
@@ -1,32 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StdioServer = void 0;
|
|
4
|
+
exports.inspectionOnlyDestinations = inspectionOnlyDestinations;
|
|
4
5
|
const embeddable_1 = require("@mcp-abap-adt/lib/embeddable");
|
|
5
6
|
const logger_1 = require("@mcp-abap-adt/lib/logger");
|
|
6
7
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
7
|
-
const
|
|
8
|
+
const coreVersion_js_1 = require("./coreVersion.js");
|
|
8
9
|
/**
|
|
9
10
|
* Minimal stdio server implementation based on BaseMcpServer.
|
|
10
11
|
* Sets connection context once at startup and connects stdio transport.
|
|
12
|
+
* The destination's settings and provider come from `IDestinations` — the
|
|
13
|
+
* factory, or the inspection-only stand-in.
|
|
11
14
|
*/
|
|
12
15
|
class StdioServer extends embeddable_1.BaseMcpServer {
|
|
13
16
|
handlersRegistry;
|
|
14
|
-
|
|
15
|
-
constructor(handlersRegistry,
|
|
17
|
+
destinations;
|
|
18
|
+
constructor(handlersRegistry, destinations, opts) {
|
|
16
19
|
super({
|
|
17
20
|
name: opts?.name ?? 'mcp-abap-adt',
|
|
18
|
-
version: opts?.version ??
|
|
21
|
+
version: opts?.version ?? coreVersion_js_1.CORE_VERSION,
|
|
19
22
|
logger: opts?.logger ?? logger_1.noopLogger,
|
|
20
23
|
});
|
|
21
24
|
this.handlersRegistry = handlersRegistry;
|
|
22
|
-
this.
|
|
25
|
+
this.destinations = destinations;
|
|
23
26
|
}
|
|
24
27
|
async start(destination) {
|
|
25
|
-
await this.setConnectionContext(destination, this.
|
|
28
|
+
await this.setConnectionContext(destination, this.destinations);
|
|
26
29
|
this.registerHandlers(this.handlersRegistry);
|
|
27
30
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
28
31
|
await this.connect(transport);
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
exports.StdioServer = StdioServer;
|
|
35
|
+
const INSPECTION_ONLY = 'inspection-only mode: no connection parameters. To connect to an SAP system, use --mcp=<destination> or --env-path=<path>.';
|
|
36
|
+
/**
|
|
37
|
+
* The destinations of inspection-only mode (stdio with neither `--mcp` nor an
|
|
38
|
+
* `--env` file): the tools can be listed, and a tool call answers with the
|
|
39
|
+
* refusal of a provider that has no credential, instead of dialling anywhere.
|
|
40
|
+
*/
|
|
41
|
+
function inspectionOnlyDestinations() {
|
|
42
|
+
const refused = async () => ({
|
|
43
|
+
ok: false,
|
|
44
|
+
refusal: { reason: INSPECTION_ONLY },
|
|
45
|
+
});
|
|
46
|
+
const provider = {
|
|
47
|
+
kind: 'inspection-only',
|
|
48
|
+
prepare: refused,
|
|
49
|
+
establish: refused,
|
|
50
|
+
authorize: refused,
|
|
51
|
+
rejected: refused,
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
settingsFor: async () => ({ url: 'http://mock', authType: 'basic' }),
|
|
55
|
+
getProvider: async () => provider,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
32
58
|
//# sourceMappingURL=StdioServer.js.map
|
package/dist/StdioServer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StdioServer.js","sourceRoot":"","sources":["../src/StdioServer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"StdioServer.js","sourceRoot":"","sources":["../src/StdioServer.ts"],"names":[],"mappings":";;;AAkDA,gEAgBC;AAjED,6DAA6D;AAE7D,qDAAsD;AAEtD,wEAAiF;AACjF,qDAAgD;AAQhD;;;;;GAKG;AACH,MAAa,WAAY,SAAQ,0BAAa;IAEzB;IACA;IAFnB,YACmB,gBAAmC,EACnC,YAA2B,EAC5C,IAAyB;QAEzB,KAAK,CAAC;YACJ,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,cAAc;YAClC,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,6BAAY;YACtC,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,mBAAU;SACnC,CAAC,CAAC;QARc,qBAAgB,GAAhB,gBAAgB,CAAmB;QACnC,iBAAY,GAAZ,YAAY,CAAe;IAQ9C,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,WAAmB;QAC7B,MAAM,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE7C,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;QAC7C,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;CACF;AApBD,kCAoBC;AAED,MAAM,eAAe,GACnB,4HAA4H,CAAC;AAE/H;;;;GAIG;AACH,SAAgB,0BAA0B;IACxC,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC;QAC3B,EAAE,EAAE,KAAc;QAClB,OAAO,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE;KACrC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAsD;QAClE,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,OAAO;QAClB,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,OAAO;KAClB,CAAC;IACF,OAAO;QACL,WAAW,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;QACpE,WAAW,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IDestinations } from '@mcp-abap-adt/lib/auth';
|
|
2
2
|
import type { TlsConfig } from '@mcp-abap-adt/lib/config';
|
|
3
3
|
import type { IHttpApplication, RouteRegistrationOptions } from '@mcp-abap-adt/lib/embeddable';
|
|
4
4
|
import { BaseMcpServer } from '@mcp-abap-adt/lib/embeddable';
|
|
@@ -70,7 +70,8 @@ export interface StreamableHttpServerOptions {
|
|
|
70
70
|
*/
|
|
71
71
|
export declare class StreamableHttpServer extends BaseMcpServer {
|
|
72
72
|
private readonly handlersRegistry;
|
|
73
|
-
|
|
73
|
+
/** The destinations: settings and the counted provider, nothing else. */
|
|
74
|
+
private readonly destinations;
|
|
74
75
|
private readonly host;
|
|
75
76
|
private readonly port;
|
|
76
77
|
private readonly enableJsonResponse;
|
|
@@ -84,9 +85,11 @@ export declare class StreamableHttpServer extends BaseMcpServer {
|
|
|
84
85
|
private readonly allowedHosts?;
|
|
85
86
|
private readonly allowedOrigins?;
|
|
86
87
|
private readonly enableDnsRebindingProtection?;
|
|
87
|
-
/** Per-destination lock
|
|
88
|
-
private readonly
|
|
89
|
-
constructor(handlersRegistry: IHandlersRegistry,
|
|
88
|
+
/** Per-destination lock around the first connect: it serialises the first login. */
|
|
89
|
+
private readonly firstConnect;
|
|
90
|
+
constructor(handlersRegistry: IHandlersRegistry,
|
|
91
|
+
/** The destinations: settings and the counted provider, nothing else. */
|
|
92
|
+
destinations: IDestinations, opts?: StreamableHttpServerOptions);
|
|
90
93
|
/**
|
|
91
94
|
* Creates the request handler function
|
|
92
95
|
* Can be used to register on external app or internal Express
|
|
@@ -111,6 +114,12 @@ export declare class StreamableHttpServer extends BaseMcpServer {
|
|
|
111
114
|
* In embedded mode (external app provided): Only registers routes on external app
|
|
112
115
|
*/
|
|
113
116
|
start(): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Stops taking connections (shutdown, step 1). Requests already running are
|
|
119
|
+
* not waited for, nor is an open stream: the factory's gate holds them.
|
|
120
|
+
* Embedded on an external app, there is no listener of its own to stop.
|
|
121
|
+
*/
|
|
122
|
+
stop(): Promise<void>;
|
|
114
123
|
/**
|
|
115
124
|
* Check if request has SAP connection headers
|
|
116
125
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamableHttpServer.d.ts","sourceRoot":"","sources":["../src/StreamableHttpServer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"StreamableHttpServer.d.ts","sourceRoot":"","sources":["../src/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