@mcp-abap-adt/http 19.1.0 → 20.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.
package/README.md CHANGED
@@ -75,40 +75,70 @@ As before 19.0.0, under the same names: `--host` / `--http-host` / `MCP_HTTP_HOS
75
75
  new in 19.0.0, `--shutdown-timeout` / `MCP_SHUTDOWN_TIMEOUT` (see [Shutdown](#shutdown)).
76
76
  `mcp-abap-adt-http --help` lists them.
77
77
 
78
- ## Held state (the debugger)
79
-
80
- Every request is an MCP session of its own. A tool that holds state (a debug session, a batch)
81
- answers a `state_handle`; a request carrying it is routed to the instance that holds the state,
82
- one request at a time, and its own headers give its credential. The handle travels in the
83
- optional `x-mcp-state-handle` request header; without the header the pool reads a `tools/call`'s
84
- `state_handle` argument, as the debugger tools send it. A tool call whose handle the pool does
78
+ ## Held state, and the long session
79
+
80
+ Every request is an MCP session of its own, served by a new instance unless it names an instance
81
+ that holds state. A tool that holds state — a long session, a lock, a batch, a debug session —
82
+ answers a `state_handle`. **Send it as the `state_handle` argument** of every call that must reach
83
+ that state: every tool of this binary declares that optional argument (the debugger tools keep
84
+ their own declaration, required where it is required). A client that sets request headers may
85
+ send it in the `x-mcp-state-handle` header instead; when both are sent, the header wins. Such a
86
+ call is routed to the instance that holds the state, one request at a time, and its own headers
87
+ give its credential. A tool call whose handle the pool does
85
88
  not know — one that never existed, or whose state ended — is answered `state is not available`
86
89
  by the pool itself, the same answer whatever the handle was, and no instance is made and nothing
87
90
  logs on for it — a JSON-RPC array holding a tool call too, one such answer per request in it with
88
91
  an `id` (an array whose tool call carries a `state_handle` argument is answered `400`); another request carrying such a handle (an `initialize`, a list) gets a new
89
- instance, as a request without a handle does. The handle is a bearer secret: whoever holds it reaches the state. Held state ends
90
- by its stop tool, the idle bound (`--state-idle-minutes`, 30–35 791, default 30), or the server's
92
+ instance, as a request without a handle does. The handle is a bearer secret: whoever holds it
93
+ reaches the state, and the server does not identify the caller. Held state ends
94
+ by its stop tool (a long session's: `SessionClose`), the idle bound (`--state-idle-minutes`, 30–35 791, default 30), or the server's
91
95
  stop. See
92
96
  [the debugger guide](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/user-guide/DEBUGGER.md).
93
97
 
98
+ **The long session.** `SessionOpen` keeps an instance and its SAP connection for a run of calls
99
+ and answers `{ "state_handle": "…" }`. Every call carrying that `state_handle` runs on that
100
+ instance, on its held SAP session: no new connection, no `systeminformation` lookup, no logoff
101
+ between the calls. A call without it runs on a new instance, as before. Called with the handle of
102
+ an instance that already holds state (a lock, a batch, a debug session), or of an open session,
103
+ `SessionOpen` answers that same handle and keeps what the instance holds; called without a handle
104
+ it opens a new instance with a handle of its own — each long session is its own instance.
105
+ `SessionClose` with the handle answers `{ "closed": true, "held": { "locks": …, "batch": …,
106
+ "debug_session": … } }` — what the instance held — and once that answer is written the instance
107
+ leaves the pool and is closed: every SAP session it owns gets its logoff, which releases the locks
108
+ taken in it; an open batch and its recorded calls are dropped unsent; nothing is undone (the
109
+ logoff ends in SAP what the state held); the MCP server closes. From then on the handle answers
110
+ `state is not available` at once, whether or not SAP has answered the logoffs yet; the close
111
+ awaits each logoff's write and its answer with no timer of the server's, and the server's
112
+ shutdown awaits a close still running. `SessionClose` without a handle, or with an unknown one,
113
+ answers `state is not available`. A session never closed ends at the idle bound — no call on it for
114
+ `--state-idle-minutes`: its state ends, every SAP session of the instance is logged off, and the instance leaves the pool.
115
+ There is no list tool: the model keeps the handles it opened, and the handle is its only way back
116
+ to its session. Both tools change nothing in the system, so `mcp-abap-adt-http-ro` serves them too;
117
+ in batch mode they run at once and are never recorded — open leaves the batch open, close drops
118
+ it. No stdio or SSE binary serves them: there the instance lives as long as the connection.
119
+
94
120
  **Locks (compact).** compact `HandlerLock` holds the lock as the pooled instance's state and answers its `state_handle`;
95
- `HandlerUpdate`, `HandlerDelete` of a class include and `HandlerUnlock` under that lock send it in the `x-mcp-state-handle` header
96
- and reach the SAP session that holds the lock — without it they reach another instance and are
97
- refused, sending nothing. A request with the same credential headers works on the held
98
- connection; another credential retires it, and its logoff releases the lock. The hold ends at the
99
- `UNLOCK`.
121
+ `HandlerUpdate`, `HandlerDelete` of a class include and `HandlerUnlock` under that lock send it as
122
+ the `state_handle` argument (or in the `x-mcp-state-handle` header) and reach the SAP session that
123
+ holds the lock — without it they reach another instance and are refused, sending nothing. A
124
+ request with another credential (a renewed token, a new user and password) works on the held
125
+ connection too: the instance keeps its SAP session and the lock, and the new credential is put in
126
+ force for its next sends; what SAP answers to that credential reaches the caller as it came. The
127
+ hold ends at the `UNLOCK`, or with the instance (`SessionClose` of a long session, the idle bound,
128
+ the server's stop), whose logoff releases the lock.
100
129
 
101
130
  **Batch mode.** `BatchBegin` (compact: `HandlerBatch` with `action: 'begin'`) holds state and
102
- answers the instance's `state_handle`: send it in `x-mcp-state-handle` on every call of the batch,
103
- `BatchEnd` and `BatchAnswers` included. A call without it reaches an instance where no batch is
104
- open. See
131
+ answers the instance's `state_handle`: send it as the `state_handle` argument (or in
132
+ `x-mcp-state-handle`) on every call of the batch, `BatchEnd` and `BatchAnswers` included. A call
133
+ without it reaches an instance where no batch is open. See
105
134
  [Batch Mode](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/user-guide/BATCH_MODE.md#over-streamable-http).
106
135
 
107
136
  ## Every ADT session ends with a logoff
108
137
 
109
138
  An instance logs off every ADT session it opened when it leaves the pool: a request's instance
110
139
  after its request, when it holds nothing; a pooled instance when its state ends (its stop tool,
111
- the idle bound). An instance whose state undo fails is kept for a retry — it has not left, and its
140
+ the idle bound); a long session's instance at its `SessionClose`, with no undo — the logoff ends
141
+ what it held. An instance whose state undo fails is kept for a retry — it has not left, and its
112
142
  sessions stay open — until a later undo succeeds or the server shuts down, where its sessions are
113
143
  logged off at once. (After the idle bound's stop a pooled instance's sessions are logged off even
114
144
  when the undo failed.) The logoff is what releases a lock a tool left. A client that drops its
@@ -141,9 +171,21 @@ credentials.
141
171
  ## Embedding
142
172
 
143
173
  `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({ program,
145
- version })` is the binary's launcher (`@mcp-abap-adt/http/launcher`). An embedder that stops the
174
+ the routes on your own Express (or CAP) application instead of listening itself. `main({ toolSet,
175
+ program, version, packageName })` is the binary's launcher (`@mcp-abap-adt/http/launcher`;
176
+ `packageName`, the package a second copy of lib asks to reinstall, is optional on this path and
177
+ defaults to `@mcp-abap-adt/http`, as 19.1.0's `{ toolSet, program, version }` still compiles). An embedder that stops the
146
178
  server itself calls `stop()`: admission stops, the listener closes, the pool's instances are
147
179
  disposed (their state undone) and logged off. The binary's own shutdown does not wait: it logs
148
180
  every session off at once (lib's `installTransportShutdown`, with `releaseConnections()` after the
149
181
  logoffs).
182
+
183
+ **Where the code lives (19.2.0).** The launcher and `StreamableHttpServer` live in
184
+ [`@mcp-abap-adt/server-runtime`](https://www.npmjs.com/package/@mcp-abap-adt/server-runtime),
185
+ which is installed with this package; this package holds the `mcp-abap-adt-http` binary and its
186
+ version. Its exports are unchanged, as re-exports: `@mcp-abap-adt/http` of
187
+ `server-runtime/http/server` (its `StreamableHttpServer` answers http's version when constructed
188
+ without one), `@mcp-abap-adt/http/launcher` of `server-runtime/http`. No other server package
189
+ depends on this one: `compact-http`, `http-ro` and `compact-http-ro` run the same launcher from
190
+ `server-runtime`. The runtime also carries the stdio destination layer, so `@mcp-abap-adt/auth-broker`
191
+ and `@mcp-abap-adt/auth-stores` are installed with this server; it never loads them.
@@ -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('../dist/launcher.js');
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');
@@ -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":"AAGA;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,MAElB,CAAC"}
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"}
@@ -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
- exports.HTTP_VERSION = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '..', 'package.json'), 'utf8')).version;
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
@@ -1 +1 @@
1
- {"version":3,"file":"httpVersion.js","sourceRoot":"","sources":["../src/httpVersion.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,yCAAiC;AAEjC;;;;;;;;GAQG;AACU,QAAA,YAAY,GAAW,IAAI,CAAC,KAAK,CAC5C,IAAA,sBAAY,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAC5D,CAAC,OAAO,CAAC"}
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 * from './config/httpParameters.js';
10
- export * from './StreamableHttpServer.js';
20
+ export declare class StreamableHttpServer extends RuntimeStreamableHttpServer {
21
+ constructor(...[handlersRegistry, opts]: ConstructorParameters<typeof RuntimeStreamableHttpServer>);
22
+ }
11
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC"}
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
- // http's parameter table
26
- __exportStar(require("./config/httpParameters.js"), exports);
27
- __exportStar(require("./StreamableHttpServer.js"), exports);
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":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAEH,yBAAyB;AACzB,6DAA2C;AAC3C,4DAA0C"}
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"}
@@ -1,42 +1,23 @@
1
1
  /**
2
- * `mcp-abap-adt-http` — the Streamable HTTP binary. Credentials
3
- * come only from each request's `x-sap-*` headers; no destination, no
4
- * broker, no store, no login. The tools are the `ToolSet` the command passes.
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 { EventEmitter } from 'node:events';
7
- import { type LauncherEdges } from '@mcp-abap-adt/lib/config';
8
- import { type ToolSet } from '@mcp-abap-adt/lib/tool-set';
9
- import { type HttpConfig } from './config/httpParameters.js';
10
- import { StreamableHttpServer } from './StreamableHttpServer.js';
11
- /**
12
- * What a command passes http's launcher: the tools it
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
- /** http's help: its own table, the set's TOOLS section, the headers. */
35
- export declare function httpHelp(options?: {
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
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAGL,KAAK,aAAa,EAGnB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,OAAO,EAAE,OAAO,CAAC;IACjB,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,4DAA4D;IAC5D,WAAW,EAAE,YAAY,CAAC;CAC3B;AA6BD,wEAAwE;AACxE,wBAAgB,QAAQ,CACtB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACpD,MAAM,CAYR;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,mBAAmB,EAC5B,KAAK,GAAE,aAA8B,GACpC,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAyB3C;AAED,yFAAyF;AACzF,wBAAsB,MAAM,CAC1B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAqD3C"}
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
- * `mcp-abap-adt-http` — the Streamable HTTP binary. Credentials
4
- * come only from each request's `x-sap-*` headers; no destination, no
5
- * broker, no store, no login. The tools are the `ToolSet` the command passes.
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 background_runs_memory_1 = require("@mcp-abap-adt/background-runs-memory");
12
- const config_1 = require("@mcp-abap-adt/lib/config");
13
- const http_transport_1 = require("@mcp-abap-adt/lib/http-transport");
14
- const logger_1 = require("@mcp-abap-adt/lib/logger");
15
- const state_1 = require("@mcp-abap-adt/lib/state");
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 = (0, config_1.processEdges)()) {
60
- const { argv, stderr, exit } = edges;
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
- // The system kind is required, never guessed: stated by --system-type,
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
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAgFH,4BAcC;AAED,oBA4BC;AAGD,wBAyDC;AArLD,iFAA8E;AAC9E,qDAMkC;AAClC,qEAA4E;AAC5E,qDAAsD;AACtD,mDAA4D;AAC5D,yDAIoC;AACpC,uEAAkF;AAClF,kEAIoC;AACpC,uEAAiE;AA2BjE,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBrB,CAAC;AAEF,wEAAwE;AACxE,SAAgB,QAAQ,CACtB,UAAmD,EAAE;IAErD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,sBAAW,CAAC;IAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,mBAAmB,CAAC;IACvD,OAAO,IAAA,qBAAY,EAAC,IAAA,kCAAc,EAAC,OAAO,EAAE,OAAO,CAAC,EAAE;QACpD,WAAW,EACT,6NAA6N;QAC/N,QAAQ,EAAE;YACR,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;YACzB,aAAa;YACb,2CAA2C,OAAO,gBAAgB;SACnE;KACF,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,IAAI,CACxB,OAA4B,EAC5B,QAAuB,IAAA,qBAAY,GAAE;IAErC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACrC,IACE,IAAA,4BAAmB,EAAC,KAAK,EAAE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ACpC,CAAC,CAAC;IACH,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,OAAO,MAAM,CAAC;AAChB,CAAC"}
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.1.0",
4
+ "version": "20.0.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": {
@@ -57,19 +57,17 @@
57
57
  ],
58
58
  "scripts": {
59
59
  "prebuild": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
60
- "build": "npx tsc -p tsconfig.json",
60
+ "build": "tsc -p tsconfig.json",
61
61
  "test": "npm --prefix .. test -- --roots http/src",
62
- "test:check": "npx tsc --noEmit -p tsconfig.test.json",
63
- "lint:check": "npx biome check src",
62
+ "test:check": "tsc --noEmit -p tsconfig.test.json",
63
+ "lint:check": "biome check src",
64
64
  "prepublishOnly": "npm run build"
65
65
  },
66
66
  "dependencies": {
67
- "@mcp-abap-adt/background-runs-memory": "^19.1.0",
68
- "@mcp-abap-adt/lib": "^19.1.0",
69
- "@mcp-abap-adt/logger": "^0.4.1",
70
- "@mcp-abap-adt/responsible-rules": "^19.1.0",
71
- "@modelcontextprotocol/sdk": "^1.32.0",
72
- "express": "^5.2.1"
67
+ "@mcp-abap-adt/background-runs-memory": "^20.0.0",
68
+ "@mcp-abap-adt/lib": "^20.0.0",
69
+ "@mcp-abap-adt/responsible-rules": "^20.0.0",
70
+ "@mcp-abap-adt/server-runtime": "^20.0.0"
73
71
  },
74
72
  "devDependencies": {
75
73
  "@types/express": "*",