@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 +62 -20
- 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 +8 -10
- 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
|
@@ -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
|
|
79
|
-
|
|
80
|
-
Every request is an MCP session of its own
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
|
90
|
-
|
|
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
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
|
103
|
-
`BatchEnd` and `BatchAnswers` included. A call
|
|
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)
|
|
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({
|
|
145
|
-
version })` is the binary's launcher (`@mcp-abap-adt/http/launcher
|
|
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.
|
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": "
|
|
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": "
|
|
60
|
+
"build": "tsc -p tsconfig.json",
|
|
61
61
|
"test": "npm --prefix .. test -- --roots http/src",
|
|
62
|
-
"test:check": "
|
|
63
|
-
"lint:check": "
|
|
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": "^
|
|
68
|
-
"@mcp-abap-adt/lib": "^
|
|
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": "^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": "*",
|