@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
package/README.md
CHANGED
|
@@ -141,9 +141,21 @@ credentials.
|
|
|
141
141
|
## Embedding
|
|
142
142
|
|
|
143
143
|
`new StreamableHttpServer(handlersRegistry, options)` — the same options, and `app` to register
|
|
144
|
-
the routes on your own Express (or CAP) application instead of listening itself. `main({
|
|
145
|
-
version })` is the binary's launcher (`@mcp-abap-adt/http/launcher
|
|
144
|
+
the routes on your own Express (or CAP) application instead of listening itself. `main({ toolSet,
|
|
145
|
+
program, version, packageName })` is the binary's launcher (`@mcp-abap-adt/http/launcher`;
|
|
146
|
+
`packageName`, the package a second copy of lib asks to reinstall, is optional on this path and
|
|
147
|
+
defaults to `@mcp-abap-adt/http`, as 19.1.0's `{ toolSet, program, version }` still compiles). An embedder that stops the
|
|
146
148
|
server itself calls `stop()`: admission stops, the listener closes, the pool's instances are
|
|
147
149
|
disposed (their state undone) and logged off. The binary's own shutdown does not wait: it logs
|
|
148
150
|
every session off at once (lib's `installTransportShutdown`, with `releaseConnections()` after the
|
|
149
151
|
logoffs).
|
|
152
|
+
|
|
153
|
+
**Where the code lives (19.2.0).** The launcher and `StreamableHttpServer` live in
|
|
154
|
+
[`@mcp-abap-adt/server-runtime`](https://www.npmjs.com/package/@mcp-abap-adt/server-runtime),
|
|
155
|
+
which is installed with this package; this package holds the `mcp-abap-adt-http` binary and its
|
|
156
|
+
version. Its exports are unchanged, as re-exports: `@mcp-abap-adt/http` of
|
|
157
|
+
`server-runtime/http/server` (its `StreamableHttpServer` answers http's version when constructed
|
|
158
|
+
without one), `@mcp-abap-adt/http/launcher` of `server-runtime/http`. No other server package
|
|
159
|
+
depends on this one: `compact-http`, `http-ro` and `compact-http-ro` run the same launcher from
|
|
160
|
+
`server-runtime`. The runtime also carries the stdio destination layer, so `@mcp-abap-adt/auth-broker`
|
|
161
|
+
and `@mcp-abap-adt/auth-stores` are installed with this server; it never loads them.
|
package/bin/mcp-abap-adt-http.js
CHANGED
|
@@ -6,16 +6,18 @@
|
|
|
6
6
|
* The launcher is required and started in this process; it starts nothing
|
|
7
7
|
* on import: `main` is called here with the tool set this command serves,
|
|
8
8
|
* and a sibling command (@mcp-abap-adt/compact-http) calls the same `main`
|
|
9
|
-
* with its own.
|
|
9
|
+
* with its own. The launcher is @mcp-abap-adt/server-runtime's; the version
|
|
10
|
+
* is http's own.
|
|
10
11
|
*/
|
|
11
|
-
const { main } = require('
|
|
12
|
-
const { HTTP_VERSION } = require('../dist/httpVersion.js');
|
|
12
|
+
const { main } = require('@mcp-abap-adt/server-runtime/http');
|
|
13
|
+
const { HTTP_VERSION, HTTP_PACKAGE } = require('../dist/httpVersion.js');
|
|
13
14
|
const { fullToolSet } = require('@mcp-abap-adt/lib/tool-set');
|
|
14
15
|
|
|
15
16
|
void main({
|
|
16
17
|
toolSet: fullToolSet,
|
|
17
18
|
program: 'mcp-abap-adt-http',
|
|
18
19
|
version: HTTP_VERSION,
|
|
20
|
+
packageName: HTTP_PACKAGE,
|
|
19
21
|
}).catch(() => {
|
|
20
22
|
// Fixed words: an error's message may quote a file or a header.
|
|
21
23
|
console.error('[MCP] launcher failed');
|
package/dist/httpVersion.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `@mcp-abap-adt/http`'s own version, read from its own manifest: the version
|
|
3
|
-
* a transport reports in `serverInfo` and on `/health` when its caller passes
|
|
4
|
-
* none.
|
|
5
|
-
*
|
|
6
|
-
* One step up from this file is `http/` in a checkout (`src/` under test,
|
|
7
|
-
* `dist/` when built) and the package root when installed — in every layout it
|
|
8
|
-
* is this package's `package.json`.
|
|
9
|
-
*/
|
|
10
1
|
export declare const HTTP_VERSION: string;
|
|
2
|
+
/** `@mcp-abap-adt/http`'s own package name, from the same manifest: what a second copy of lib asks to reinstall. */
|
|
3
|
+
export declare const HTTP_PACKAGE: string;
|
|
11
4
|
//# sourceMappingURL=httpVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpVersion.d.ts","sourceRoot":"","sources":["../src/httpVersion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"httpVersion.d.ts","sourceRoot":"","sources":["../src/httpVersion.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,YAAY,EAAE,MAAyB,CAAC;AAErD,oHAAoH;AACpH,eAAO,MAAM,YAAY,EAAE,MAAsB,CAAC"}
|
package/dist/httpVersion.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HTTP_VERSION = void 0;
|
|
3
|
+
exports.HTTP_PACKAGE = exports.HTTP_VERSION = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
/**
|
|
@@ -12,5 +12,8 @@ const node_path_1 = require("node:path");
|
|
|
12
12
|
* `dist/` when built) and the package root when installed — in every layout it
|
|
13
13
|
* is this package's `package.json`.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
const manifest = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '..', 'package.json'), 'utf8'));
|
|
16
|
+
exports.HTTP_VERSION = manifest.version;
|
|
17
|
+
/** `@mcp-abap-adt/http`'s own package name, from the same manifest: what a second copy of lib asks to reinstall. */
|
|
18
|
+
exports.HTTP_PACKAGE = manifest.name;
|
|
16
19
|
//# sourceMappingURL=httpVersion.js.map
|
package/dist/httpVersion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpVersion.js","sourceRoot":"","sources":["../src/httpVersion.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,yCAAiC;AAEjC;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"httpVersion.js","sourceRoot":"","sources":["../src/httpVersion.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,yCAAiC;AAEjC;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAAsC,IAAI,CAAC,KAAK,CAC5D,IAAA,sBAAY,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAC5D,CAAC;AAEW,QAAA,YAAY,GAAW,QAAQ,CAAC,OAAO,CAAC;AAErD,oHAAoH;AACvG,QAAA,YAAY,GAAW,QAAQ,CAAC,IAAI,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,19 @@
|
|
|
5
5
|
* Importing from here links AGPL code. If you are embedding ADT tools in your
|
|
6
6
|
* own application, you want `@mcp-abap-adt/lib` instead: it carries the
|
|
7
7
|
* handlers and the embeddable server under Apache-2.0, and no transport.
|
|
8
|
+
*
|
|
9
|
+
* The code lives in `@mcp-abap-adt/server-runtime` (19.2.0): this module
|
|
10
|
+
* re-exports its `http/server` path, so an importer of `@mcp-abap-adt/http`
|
|
11
|
+
* sees the names it saw before.
|
|
12
|
+
*/
|
|
13
|
+
import { StreamableHttpServer as RuntimeStreamableHttpServer } from '@mcp-abap-adt/server-runtime/http/server';
|
|
14
|
+
export * from '@mcp-abap-adt/server-runtime/http/server';
|
|
15
|
+
/**
|
|
16
|
+
* The runtime's Streamable HTTP server, answering http's version when none is
|
|
17
|
+
* given — as a direct constructor call did before the code moved, even when
|
|
18
|
+
* the runtime is at another patch than http.
|
|
8
19
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
20
|
+
export declare class StreamableHttpServer extends RuntimeStreamableHttpServer {
|
|
21
|
+
constructor(...[handlersRegistry, opts]: ConstructorParameters<typeof RuntimeStreamableHttpServer>);
|
|
22
|
+
}
|
|
11
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,oBAAoB,IAAI,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAI/G,cAAc,0CAA0C,CAAC;AAEzD;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,2BAA2B;gBAEjE,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE,qBAAqB,CAChD,OAAO,2BAA2B,CACnC;CAOJ"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* `@mcp-abap-adt/http` — the Streamable HTTP transport of the MCP ABAP ADT
|
|
4
|
-
* server, 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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
3
|
if (k2 === undefined) k2 = k;
|
|
12
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -22,7 +14,35 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
22
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
15
|
};
|
|
24
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
exports.StreamableHttpServer = void 0;
|
|
18
|
+
/**
|
|
19
|
+
* `@mcp-abap-adt/http` — the Streamable HTTP transport of the MCP ABAP ADT
|
|
20
|
+
* server, AGPL-3.0-only.
|
|
21
|
+
*
|
|
22
|
+
* Importing from here links AGPL code. If you are embedding ADT tools in your
|
|
23
|
+
* own application, you want `@mcp-abap-adt/lib` instead: it carries the
|
|
24
|
+
* handlers and the embeddable server under Apache-2.0, and no transport.
|
|
25
|
+
*
|
|
26
|
+
* The code lives in `@mcp-abap-adt/server-runtime` (19.2.0): this module
|
|
27
|
+
* re-exports its `http/server` path, so an importer of `@mcp-abap-adt/http`
|
|
28
|
+
* sees the names it saw before.
|
|
29
|
+
*/
|
|
30
|
+
const server_1 = require("@mcp-abap-adt/server-runtime/http/server");
|
|
31
|
+
const httpVersion_js_1 = require("./httpVersion.js");
|
|
32
|
+
// http's parameter table and the server
|
|
33
|
+
__exportStar(require("@mcp-abap-adt/server-runtime/http/server"), exports);
|
|
34
|
+
/**
|
|
35
|
+
* The runtime's Streamable HTTP server, answering http's version when none is
|
|
36
|
+
* given — as a direct constructor call did before the code moved, even when
|
|
37
|
+
* the runtime is at another patch than http.
|
|
38
|
+
*/
|
|
39
|
+
class StreamableHttpServer extends server_1.StreamableHttpServer {
|
|
40
|
+
constructor(...[handlersRegistry, opts]) {
|
|
41
|
+
super(handlersRegistry, {
|
|
42
|
+
...opts,
|
|
43
|
+
version: opts?.version ?? httpVersion_js_1.HTTP_VERSION,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.StreamableHttpServer = StreamableHttpServer;
|
|
28
48
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;GAWG;AACH,qEAA+G;AAC/G,qDAAgD;AAEhD,wCAAwC;AACxC,2EAAyD;AAEzD;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,6BAA2B;IACnE,YACE,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAEzB;QAED,KAAK,CAAC,gBAAgB,EAAE;YACtB,GAAG,IAAI;YACP,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,6BAAY;SACvC,CAAC,CAAC;IACL,CAAC;CACF;AAXD,oDAWC"}
|
package/dist/launcher.d.ts
CHANGED
|
@@ -1,42 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* `@mcp-abap-adt/http/launcher` — the Streamable HTTP launcher. Its code lives in
|
|
3
|
+
* `@mcp-abap-adt/server-runtime` (19.2.0); this path re-exports
|
|
4
|
+
* `@mcp-abap-adt/server-runtime/http`, so an importer sees the names it saw
|
|
5
|
+
* before.
|
|
6
|
+
*
|
|
7
|
+
* And it takes 19.1.0's options: `HttpLauncherOptions`, `main` and `launch` here
|
|
8
|
+
* accept `{ toolSet, program, version }` as before. `packageName` — required
|
|
9
|
+
* on the runtime's own path — is optional here and defaults to
|
|
10
|
+
* `@mcp-abap-adt/http`, the package a second copy of lib then asks to
|
|
11
|
+
* reinstall; a value given passes through.
|
|
5
12
|
*/
|
|
6
|
-
import type {
|
|
7
|
-
import { type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
* serves, and its own name and version — nothing else. Everything the
|
|
14
|
-
* launcher does is http's, the same for any tool set:
|
|
15
|
-
* `mcp-abap-adt-http` passes `fullToolSet`, `mcp-abap-adt-http-ro`
|
|
16
|
-
* `fullReadOnlyToolSet`, `mcp-abap-adt-compact-http` and
|
|
17
|
-
* `mcp-abap-adt-compact-http-ro` the compact sets.
|
|
18
|
-
*/
|
|
19
|
-
export interface HttpLauncherOptions {
|
|
20
|
-
/** The tools served: fixed by the command, never by a flag. */
|
|
21
|
-
toolSet: ToolSet;
|
|
22
|
-
/** The command's own name: USAGE in `--help`, the `--conf` template's header. */
|
|
23
|
-
program: string;
|
|
24
|
-
/** The version `--version` and `initialize` report: the command's own package's. */
|
|
25
|
-
version: string;
|
|
26
|
-
}
|
|
27
|
-
/** What the launcher takes from the program: the process's edges. */
|
|
28
|
-
export interface HttpLauncherDeps {
|
|
29
|
-
stderr: (line: string) => void;
|
|
30
|
-
exit: (code: number) => void;
|
|
31
|
-
/** Where the shutdown listens: `process` in the program. */
|
|
32
|
-
processLike: EventEmitter;
|
|
13
|
+
import type { LauncherEdges } from '@mcp-abap-adt/lib/config';
|
|
14
|
+
import { type HttpLauncherDeps, type HttpLauncherOptions as RuntimeHttpLauncherOptions, launch as runtimeLaunch, main as runtimeMain } from '@mcp-abap-adt/server-runtime/http';
|
|
15
|
+
export * from '@mcp-abap-adt/server-runtime/http';
|
|
16
|
+
/** 19.1.0's options; `packageName` optional, `@mcp-abap-adt/http` when not given. */
|
|
17
|
+
export interface HttpLauncherOptions extends Omit<RuntimeHttpLauncherOptions, 'packageName'> {
|
|
18
|
+
/** The command's own npm package: the one a second copy of lib asks to reinstall. Default `@mcp-abap-adt/http`. */
|
|
19
|
+
packageName?: string | undefined;
|
|
33
20
|
}
|
|
34
|
-
|
|
35
|
-
export declare function
|
|
36
|
-
toolSet?: ToolSet;
|
|
37
|
-
program?: string;
|
|
38
|
-
}): string;
|
|
39
|
-
export declare function main(options: HttpLauncherOptions, edges?: LauncherEdges): Promise<StreamableHttpServer | undefined>;
|
|
40
|
-
/** Everything after the parameters are read: the tool list, the server, the shutdown. */
|
|
41
|
-
export declare function launch(config: HttpConfig, options: HttpLauncherOptions, deps: HttpLauncherDeps): Promise<StreamableHttpServer | undefined>;
|
|
21
|
+
export declare function main(options: HttpLauncherOptions, edges?: LauncherEdges): ReturnType<typeof runtimeMain>;
|
|
22
|
+
export declare function launch(config: Parameters<typeof runtimeLaunch>[0], options: HttpLauncherOptions, deps: HttpLauncherDeps): ReturnType<typeof runtimeLaunch>;
|
|
42
23
|
//# sourceMappingURL=launcher.d.ts.map
|
package/dist/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,IAAI,0BAA0B,EACtD,MAAM,IAAI,aAAa,EACvB,IAAI,IAAI,WAAW,EACpB,MAAM,mCAAmC,CAAC;AAG3C,cAAc,mCAAmC,CAAC;AAElD,qFAAqF;AACrF,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,0BAA0B,EAAE,aAAa,CAAC;IACvD,mHAAmH;IACnH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAMD,wBAAsB,IAAI,CACxB,OAAO,EAAE,mBAAmB,EAC5B,KAAK,CAAC,EAAE,aAAa,GACpB,UAAU,CAAC,OAAO,WAAW,CAAC,CAEhC;AAED,wBAAsB,MAAM,CAC1B,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,EAC3C,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,gBAAgB,GACrB,UAAU,CAAC,OAAO,aAAa,CAAC,CAElC"}
|
package/dist/launcher.js
CHANGED
|
@@ -1,132 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
7
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.httpHelp = httpHelp;
|
|
9
17
|
exports.main = main;
|
|
10
18
|
exports.launch = launch;
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const tool_set_1 = require("@mcp-abap-adt/lib/tool-set");
|
|
17
|
-
const responsible_rules_1 = require("@mcp-abap-adt/responsible-rules");
|
|
18
|
-
const httpParameters_js_1 = require("./config/httpParameters.js");
|
|
19
|
-
const StreamableHttpServer_js_1 = require("./StreamableHttpServer.js");
|
|
20
|
-
const HELP_SECTIONS = `
|
|
21
|
-
CREDENTIALS (each request's headers; nothing is stored, shared or cached):
|
|
22
|
-
x-sap-url The system's URL (required)
|
|
23
|
-
x-sap-client The client (optional)
|
|
24
|
-
x-sap-jwt-token A token you hold, sent as a Bearer token
|
|
25
|
-
x-sap-login, x-sap-password A user and password (basic)
|
|
26
|
-
A request without them is answered 400 (ping excepted). x-mcp-destination is
|
|
27
|
-
refused with 400: destinations are served only by mcp-abap-adt (stdio).
|
|
28
|
-
|
|
29
|
-
System Context (per request, first found wins):
|
|
30
|
-
x-sap-responsible Responsible of created objects
|
|
31
|
-
x-sap-master-system Master system of created objects
|
|
32
|
-
x-sap-language Master/original language for created objects
|
|
33
|
-
x-sap-debug-terminal-id The debugger's terminal id (where the debugger is served)
|
|
34
|
-
x-sap-debug-ide-id The debugger's IDE id
|
|
35
|
-
x-sap-debug-breakpoint-conflict replace (default) or refuse-if-held: whether a take-over
|
|
36
|
-
of the debugger, and every later change of its breakpoints,
|
|
37
|
-
first asks if another debugger listens for the same SAP user
|
|
38
|
-
Then SAP_RESPONSIBLE, SAP_MASTER_SYSTEM, SAP_DEBUG_TERMINAL_ID, SAP_DEBUG_IDE_ID,
|
|
39
|
-
SAP_DEBUG_BREAKPOINT_CONFLICT of the environment; with x-sap-login, the login is the responsible when none is stated.
|
|
40
|
-
|
|
41
|
-
Held state (a debug session) is reached again with its state_handle, on the
|
|
42
|
-
instance that holds it; MCP_STATE_IDLE_MINUTES / --state-idle-minutes bound it.
|
|
43
|
-
|
|
44
|
-
A health check answers GET /mcp/health.
|
|
45
|
-
`;
|
|
46
|
-
/** http's help: its own table, the set's TOOLS section, the headers. */
|
|
47
|
-
function httpHelp(options = {}) {
|
|
48
|
-
const toolSet = options.toolSet ?? tool_set_1.fullToolSet;
|
|
49
|
-
const program = options.program ?? 'mcp-abap-adt-http';
|
|
50
|
-
return (0, config_1.generateHelp)((0, httpParameters_js_1.httpParameters)(toolSet, program), {
|
|
51
|
-
description: " MCP server for SAP ABAP systems via ADT, over Streamable HTTP: credentials only from\n each request's x-sap-* headers. stdio (destinations, logins) is mcp-abap-adt, SSE\n mcp-abap-adt-sse; a binary is its transport.",
|
|
52
|
-
sections: [
|
|
53
|
-
toolSet.toolsHelp('http'),
|
|
54
|
-
HELP_SECTIONS,
|
|
55
|
-
`\nEXAMPLES:\n # Listen on port 3000\n ${program} --port=3000\n`,
|
|
56
|
-
],
|
|
57
|
-
});
|
|
19
|
+
const http_1 = require("@mcp-abap-adt/server-runtime/http");
|
|
20
|
+
const httpVersion_js_1 = require("./httpVersion.js");
|
|
21
|
+
__exportStar(require("@mcp-abap-adt/server-runtime/http"), exports);
|
|
22
|
+
function withPackage(options) {
|
|
23
|
+
return { ...options, packageName: options.packageName ?? httpVersion_js_1.HTTP_PACKAGE };
|
|
58
24
|
}
|
|
59
|
-
async function main(options, edges
|
|
60
|
-
|
|
61
|
-
if ((0, config_1.answerVersionOrHelp)(edges, {
|
|
62
|
-
version: options.version,
|
|
63
|
-
help: () => httpHelp(options),
|
|
64
|
-
})) {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
// http's own table: an option of another binary, --transport, or the
|
|
68
|
-
// removed --exposition stops here.
|
|
69
|
-
const config = (0, config_1.readStartupConfig)((0, httpParameters_js_1.httpParameters)(options.toolSet, options.program), argv, process.env, { stderr, exit }, (args, env, yaml) => (0, httpParameters_js_1.readHttpConfig)(args, env, yaml, options.toolSet));
|
|
70
|
-
if (config === undefined)
|
|
71
|
-
return undefined;
|
|
72
|
-
return launch(config, options, {
|
|
73
|
-
stderr,
|
|
74
|
-
exit,
|
|
75
|
-
processLike: edges.processLike,
|
|
76
|
-
});
|
|
25
|
+
async function main(options, edges) {
|
|
26
|
+
return (0, http_1.main)(withPackage(options), edges);
|
|
77
27
|
}
|
|
78
|
-
/** Everything after the parameters are read: the tool list, the server, the shutdown. */
|
|
79
28
|
async function launch(config, options, deps) {
|
|
80
|
-
|
|
81
|
-
// SAP_SYSTEM_TYPE or YAML system-type (no request header states it).
|
|
82
|
-
// Without it the start ends here, before anything listens — so no tool
|
|
83
|
-
// list is filtered for a kind nobody stated.
|
|
84
|
-
if (config.systemType === undefined) {
|
|
85
|
-
deps.stderr(`[MCP] ${(0, responsible_rules_1.listenerSystemTypeRequiredWords)()}`);
|
|
86
|
-
deps.exit(1);
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
// The connector and the tool filter read the system kind from the
|
|
90
|
-
// environment (`resolveSystemKind`).
|
|
91
|
-
process.env.SAP_SYSTEM_TYPE = config.systemType;
|
|
92
|
-
const server = new StreamableHttpServer_js_1.StreamableHttpServer((0, tool_set_1.registryOf)(options.toolSet, 'http'), {
|
|
93
|
-
version: options.version,
|
|
94
|
-
stateIdleMinutes: config.stateIdleMinutes,
|
|
95
|
-
// Batch mode: one InstanceBatch per pooled instance.
|
|
96
|
-
batch: { keepRawParts: config.batchKeepRawParts === true },
|
|
97
|
-
// The state's lines go to stderr whatever the transport logger says.
|
|
98
|
-
stateLogger: state_1.stderrStateLogger,
|
|
99
|
-
host: config.host,
|
|
100
|
-
port: config.port,
|
|
101
|
-
enableJsonResponse: config.httpJsonResponse || undefined,
|
|
102
|
-
path: config.httpPath,
|
|
103
|
-
logger: logger_1.noopLogger,
|
|
104
|
-
tls: config.tls,
|
|
105
|
-
allowedHosts: config.allowedHosts,
|
|
106
|
-
allowedOrigins: config.allowedOrigins,
|
|
107
|
-
enableDnsRebindingProtection: config.enableDnsRebindingProtection,
|
|
108
|
-
// No runtime session file and no leftover-session tool: one server holds
|
|
109
|
-
// the sessions of many users, so they are stdio's only.
|
|
110
|
-
// Background runs of the run tools, kept in this process's memory
|
|
111
|
-
// and handed to every instance; they end with the process.
|
|
112
|
-
// Only where the set serves them: a -ro command has none, so a
|
|
113
|
-
// run's `background: true` is refused.
|
|
114
|
-
...(options.toolSet.backgroundRuns && {
|
|
115
|
-
backgroundRuns: new background_runs_memory_1.InMemoryBackgroundRuns(),
|
|
116
|
-
}),
|
|
117
|
-
});
|
|
118
|
-
(0, http_transport_1.installTransportShutdown)({
|
|
119
|
-
begin: () => server.beginShutdown(),
|
|
120
|
-
stopListening: () => server.stopListening(),
|
|
121
|
-
release: () => server.releaseConnections(),
|
|
122
|
-
exit: deps.exit,
|
|
123
|
-
stderr: deps.stderr,
|
|
124
|
-
processLike: deps.processLike,
|
|
125
|
-
shutdownTimeoutMs: config.shutdownTimeout === undefined
|
|
126
|
-
? undefined
|
|
127
|
-
: config.shutdownTimeout * 1000,
|
|
128
|
-
});
|
|
129
|
-
await server.start();
|
|
130
|
-
return server;
|
|
29
|
+
return (0, http_1.launch)(config, withPackage(options), deps);
|
|
131
30
|
}
|
|
132
31
|
//# sourceMappingURL=launcher.js.map
|
package/dist/launcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkCA,oBAKC;AAED,wBAMC;AAlCD,4DAK2C;AAC3C,qDAAgD;AAEhD,oEAAkD;AASlD,SAAS,WAAW,CAAC,OAA4B;IAC/C,OAAO,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,6BAAY,EAAE,CAAC;AAC1E,CAAC;AAEM,KAAK,UAAU,IAAI,CACxB,OAA4B,EAC5B,KAAqB;IAErB,OAAO,IAAA,WAAW,EAAC,WAAW,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;AAClD,CAAC;AAEM,KAAK,UAAU,MAAM,CAC1B,MAA2C,EAC3C,OAA4B,EAC5B,IAAsB;IAEtB,OAAO,IAAA,aAAa,EAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-abap-adt/http",
|
|
3
3
|
"mcpName": "io.github.fr0ster/mcp-abap-adt-http",
|
|
4
|
-
"version": "19.
|
|
4
|
+
"version": "19.2.0",
|
|
5
5
|
"description": "The Streamable HTTP transport of the MCP ABAP ADT server: an Express app serving the ADT tools of @mcp-abap-adt/lib over MCP Streamable HTTP, with DNS rebinding protection and TLS.",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"publishConfig": {
|
|
@@ -64,12 +64,10 @@
|
|
|
64
64
|
"prepublishOnly": "npm run build"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@mcp-abap-adt/background-runs-memory": "^19.
|
|
68
|
-
"@mcp-abap-adt/lib": "^19.
|
|
69
|
-
"@mcp-abap-adt/
|
|
70
|
-
"@mcp-abap-adt/
|
|
71
|
-
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
72
|
-
"express": "^5.2.1"
|
|
67
|
+
"@mcp-abap-adt/background-runs-memory": "^19.2.0",
|
|
68
|
+
"@mcp-abap-adt/lib": "^19.2.0",
|
|
69
|
+
"@mcp-abap-adt/responsible-rules": "^19.2.0",
|
|
70
|
+
"@mcp-abap-adt/server-runtime": "^19.2.0"
|
|
73
71
|
},
|
|
74
72
|
"devDependencies": {
|
|
75
73
|
"@types/express": "*",
|
package/dist/InstancePool.d.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Streamable HTTP keeps the MCP instance that holds state between calls.
|
|
3
|
-
*
|
|
4
|
-
* The transport is stateless — every request is an MCP session of its own —
|
|
5
|
-
* and state lives in an instance (measured for the debugger: a continuous
|
|
6
|
-
* poll, an attach within seconds, the attaching ABAP session; over RFC nothing
|
|
7
|
-
* carries that session to another connection). So per request the host takes
|
|
8
|
-
* an instance once: the one the request's handle names (the
|
|
9
|
-
* `x-mcp-state-handle` header, else the `tools/call`'s `state_handle`), or a
|
|
10
|
-
* new one.
|
|
11
|
-
* The handle identifies an LLM session's state and is a bearer secret:
|
|
12
|
-
* whoever holds it reaches the instance, like a session cookie; keeping it
|
|
13
|
-
* safe is the deployer's. There is no owner and no limit of ours: two
|
|
14
|
-
* listeners of one SAP user meet as SAP answers them (see the debugger's
|
|
15
|
-
* `ids.ts`). One request at a time per instance (the SDK binds one
|
|
16
|
-
* transport).
|
|
17
|
-
* An instance that holds nothing is disposed once, after its work; a disposal
|
|
18
|
-
* that fails keeps the instance for a retry. The pool keeps no clock: the
|
|
19
|
-
* idle bound is the instance state's own (`InstanceState`), and an instance it
|
|
20
|
-
* empties leaves through `onEmpty` like any other.
|
|
21
|
-
*
|
|
22
|
-
* The pool knows `InstanceState` and nothing of what the state is.
|
|
23
|
-
*/
|
|
24
|
-
import type { IncomingHttpHeaders } from 'node:http';
|
|
25
|
-
import { type InstanceState } from '@mcp-abap-adt/lib/state';
|
|
26
|
-
export interface Poolable {
|
|
27
|
-
readonly state: InstanceState;
|
|
28
|
-
readonly stateHandle: string;
|
|
29
|
-
holdsState(): boolean;
|
|
30
|
-
/** The state undo: callable again, each call retrying what is left. */
|
|
31
|
-
dispose(): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* The terminal close: every connection the instance owns
|
|
34
|
-
* closed with a logoff. Run when the instance leaves the pool, after its
|
|
35
|
-
* undo, whatever the undo answered.
|
|
36
|
-
*/
|
|
37
|
-
terminalClose?(): Promise<void>;
|
|
38
|
-
}
|
|
39
|
-
/** The `400` words of a batch carrying `state_handle`. */
|
|
40
|
-
export declare const BATCH_WITH_HANDLE_WORDS = "a JSON-RPC batch cannot carry state_handle";
|
|
41
|
-
/** The `503` words of a request after the shutdown began. */
|
|
42
|
-
export declare const POOL_CLOSED_WORDS = "the server is shutting down";
|
|
43
|
-
export declare class BatchWithHandleError extends Error {
|
|
44
|
-
constructor();
|
|
45
|
-
}
|
|
46
|
-
export declare class PoolClosedError extends Error {
|
|
47
|
-
constructor();
|
|
48
|
-
}
|
|
49
|
-
/** The `state_handle` of a single `tools/call`; a batch carrying one is refused. */
|
|
50
|
-
export declare function handleOf(body: unknown): string | undefined;
|
|
51
|
-
/** The request header that carries the handle on Streamable HTTP. */
|
|
52
|
-
export declare const STATE_HANDLE_HEADER = "x-mcp-state-handle";
|
|
53
|
-
/**
|
|
54
|
-
* The handle a request routes by: the `x-mcp-state-handle` header first, else
|
|
55
|
-
* the `state_handle` of a single `tools/call` (`handleOf`; the debugger tools
|
|
56
|
-
* keep their argument). A JSON-RPC batch carrying `state_handle` is refused
|
|
57
|
-
* whether or not the header is there. A header that is not one non-empty
|
|
58
|
-
* value is absent.
|
|
59
|
-
*/
|
|
60
|
-
export declare function handleFrom(headers: IncomingHttpHeaders, body: unknown): string | undefined;
|
|
61
|
-
export declare class InstancePool<T extends Poolable> {
|
|
62
|
-
private readonly held;
|
|
63
|
-
/** handle → entry, kept in step with each instance's handle (`onChange`). */
|
|
64
|
-
private readonly index;
|
|
65
|
-
/** Requests working on an instance; no entry for an instance nobody works on. */
|
|
66
|
-
private readonly busy;
|
|
67
|
-
private readonly subscribed;
|
|
68
|
-
private readonly evicting;
|
|
69
|
-
/** Disposal failed: the message. */
|
|
70
|
-
private readonly failed;
|
|
71
|
-
/** Disposal failed or still finishing: owned for shutdown. */
|
|
72
|
-
private readonly retained;
|
|
73
|
-
private readonly active;
|
|
74
|
-
private admitting;
|
|
75
|
-
/** Instances whose terminal close ran: they left the pool for good. */
|
|
76
|
-
private readonly closed;
|
|
77
|
-
/**
|
|
78
|
-
* What a failure is named by: an ordinal per instance. Never the handle — it
|
|
79
|
-
* is a bearer secret, and these lines reach the log at shutdown.
|
|
80
|
-
*/
|
|
81
|
-
private readonly ordinals;
|
|
82
|
-
private nextOrdinal;
|
|
83
|
-
private nameOf;
|
|
84
|
-
size(): number;
|
|
85
|
-
private byHandle;
|
|
86
|
-
private keep;
|
|
87
|
-
/** The handle rotated (a complete stop): the old one stops routing at once. */
|
|
88
|
-
private rekey;
|
|
89
|
-
private drop;
|
|
90
|
-
/**
|
|
91
|
-
* `refuseUnknown` (a tool call): a handle that names no instance in the
|
|
92
|
-
* pool — never one, or one whose state ended — is refused here with
|
|
93
|
-
* `StateUnavailableError`, before any instance is made or anything logs
|
|
94
|
-
* on; the answer is the same whatever the handle was. Without a handle, a
|
|
95
|
-
* new instance as ever.
|
|
96
|
-
*/
|
|
97
|
-
serve(request: {
|
|
98
|
-
handle?: string;
|
|
99
|
-
refuseUnknown?: boolean;
|
|
100
|
-
}, create: () => T, work: (instance: T) => Promise<void>): Promise<void>;
|
|
101
|
-
private route;
|
|
102
|
-
private run;
|
|
103
|
-
/** After a request: what holds state is kept; the rest is disposed. */
|
|
104
|
-
private settle;
|
|
105
|
-
/**
|
|
106
|
-
* Once at a time per instance: dispose it. It leaves the pool only when it
|
|
107
|
-
* holds nothing afterwards — an asynchronous part may finish later, and
|
|
108
|
-
* `onEmpty` calls this again then. A disposal that fails keeps the instance,
|
|
109
|
-
* fresh or held, for a retry. The guard is set before disposing, so a part
|
|
110
|
-
* that empties synchronously inside dispose() re-enters harmlessly.
|
|
111
|
-
*/
|
|
112
|
-
private evict;
|
|
113
|
-
/** The terminal close of an instance leaving the pool, once. */
|
|
114
|
-
private terminalClose;
|
|
115
|
-
/** Stops admission (shutdown, in the latch's tick): every later request is `503`. */
|
|
116
|
-
stopAdmitting(): void;
|
|
117
|
-
/**
|
|
118
|
-
* Stop admission; let running requests and disposals finish; dispose what is
|
|
119
|
-
* held or retained; wait until each has settled (an asynchronous part
|
|
120
|
-
* finishes when its last event arrives — no timer); retry once what still
|
|
121
|
-
* holds; report what is still left. Every instance it owned then leaves the
|
|
122
|
-
* pool through its terminal close — its connections closed with a logoff
|
|
123
|
-
* whatever its undo answered.
|
|
124
|
-
*/
|
|
125
|
-
shutdown(): Promise<string[]>;
|
|
126
|
-
}
|
|
127
|
-
//# sourceMappingURL=InstancePool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InstancePool.d.ts","sourceRoot":"","sources":["../src/InstancePool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,UAAU,IAAI,OAAO,CAAC;IACtB,uEAAuE;IACvE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB;;;;OAIG;IACH,aAAa,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAED,0DAA0D;AAC1D,eAAO,MAAM,uBAAuB,+CACU,CAAC;AAE/C,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,gCAAgC,CAAC;AAE/D,qBAAa,oBAAqB,SAAQ,KAAK;;CAK9C;AAED,qBAAa,eAAgB,SAAQ,KAAK;;CAKzC;AAOD,oFAAoF;AACpF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAc1D;AAED,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,OAAO,GACZ,MAAM,GAAG,SAAS,CAIpB;AAoCD,qBAAa,YAAY,CAAC,CAAC,SAAS,QAAQ;IAC1C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyB;IAC9C,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;IACpD,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwB;IAC7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAyB;IACpD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IACxD,oCAAoC;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAC/C,8DAA8D;IAC9D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;IACtD,OAAO,CAAC,SAAS,CAAQ;IACzB,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;IACrD,OAAO,CAAC,WAAW,CAAK;IAExB,OAAO,CAAC,MAAM;IASd,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,IAAI;IAaZ,+EAA+E;IAC/E,OAAO,CAAC,KAAK;IAQb,OAAO,CAAC,IAAI;IAQZ;;;;;;OAMG;IACG,KAAK,CACT,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,EACrD,MAAM,EAAE,MAAM,CAAC,EACf,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GACnC,OAAO,CAAC,IAAI,CAAC;IAWhB,OAAO,CAAC,KAAK;YA8BC,GAAG;IAqBjB,uEAAuE;YACzD,MAAM;IAQpB;;;;;;OAMG;IACH,OAAO,CAAC,KAAK;IAuCb,gEAAgE;YAClD,aAAa;IAM3B,qFAAqF;IACrF,aAAa,IAAI,IAAI;IAIrB;;;;;;;OAOG;IACG,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CA4BpC"}
|