@abapify/adt-mcp 0.3.6 → 0.4.5

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
@@ -218,20 +218,77 @@ or, when not found:
218
218
 
219
219
  ### Source Code
220
220
 
221
+ #### `list_source_versions`
222
+
223
+ List immutable ADT source-version metadata and transport provenance for every
224
+ source component of one object. The result is metadata-only; it never embeds
225
+ ABAP source.
226
+
227
+ | Parameter | Type | Description |
228
+ | ------------ | ------- | -------------------------------------------- |
229
+ | `objectName` | string | ABAP object name |
230
+ | `objectType` | string | Object type (`PROG`, `CLAS`, `INTF`, …) |
231
+ | `component` | string? | Exact component id such as `implementations` |
232
+
233
+ #### `get_source_version`
234
+
235
+ Explicitly read one immutable source URI returned by
236
+ `list_source_versions` or `cts_transport_source_manifest`. Output is bounded
237
+ by `maxBytes` (1 MiB default, 4 MiB hard cap) and fails rather than truncating.
238
+
239
+ | Parameter | Type | Description |
240
+ | ---------- | ------- | ----------------------------------------------- |
241
+ | `uri` | string | Server-relative immutable `/sap/bc/adt/...` URI |
242
+ | `maxBytes` | number? | Positive UTF-8 response limit |
243
+
244
+ #### `cts_transport_source_manifest`
245
+
246
+ Build a metadata-only, component-granular exactness manifest for an ordered
247
+ non-empty transport list. Every leaf reports its change kind, exactness,
248
+ concrete request/task provenance, immutable base/head references when known,
249
+ and a typed diagnostic when exact isolation cannot be proven.
250
+
251
+ | Parameter | Type | Description |
252
+ | ------------- | -------- | ----------------------------------------------- |
253
+ | `transports` | string[] | Ordered request/task identifiers |
254
+ | `selector` | object? | Optional `objFunc`, `pgmid`, and `type` filters |
255
+ | `concurrency` | number? | Bounded metadata/feed concurrency (max 32) |
256
+
221
257
  #### `get_source`
222
258
 
223
- Fetch the raw ABAP source code for a program, class, interface, or function group.
259
+ Fetch ABAP source code for a program, class, interface, or function group. Supports version-aware reads, class includes, method-level reads, and regex grep for token-efficient source exploration.
224
260
 
225
261
  **Parameters:**
226
262
 
227
- | Parameter | Type | Description |
228
- | ------------ | ------- | ---------------------------------------------------------------------------------------- |
229
- | `objectName` | string | ABAP object name |
230
- | `objectType` | string? | Object type hint (`PROG`, `CLAS`, `INTF`, …). Skips the search round-trip when provided. |
263
+ | Parameter | Type | Description |
264
+ | ------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
265
+ | `objectName` | string | ABAP object name |
266
+ | `objectType` | string? | Object type hint (`PROG`, `CLAS`, `INTF`, …). Skips the search round-trip when provided. |
267
+ | `version` | enum? | `active` (default, last activated) or `inactive` (unactivated draft). |
268
+ | `include` | string? | For `CLAS`: source include (`main`, `definitions`, `implementations`, `testclasses`, `macros`, `text_symbols`, `localtypes`). |
269
+ | `method` | string? | For `CLAS`: method name to read, or `*` to list all methods. |
270
+ | `grep` | string? | Regex pattern; returns matching source lines with context instead of full source. For `CLAS` source, each match is annotated with the owning method/class/include. |
271
+ | `maxBytes` | number? | Maximum UTF-8 response size in bytes (default 1 MiB, hard cap 2 MiB). |
272
+ | `format` | enum? | `raw` (default) or `structured` (class includes and method boundaries as JSON). |
273
+
274
+ **Returns:**
275
+
276
+ - Default: `{ object, bytes, source, version, include }`
277
+ - `method=*`: `{ object, methodCount, methods }`
278
+ - `method=<name>`: `{ object, method, startLine, endLine, bytes, source }`
279
+ - `grep`: `{ object, pattern, matchCount, matches, methodContext }`
280
+ - `format=structured`: `{ object, source, bytes, version, include, includes, methods }`
231
281
 
232
- **Returns:** Plain ABAP source text.
282
+ **Examples:**
233
283
 
234
- **Tip:** Always pass `objectType` when you already know it — it saves one network round-trip.
284
+ ```text
285
+ get_source objectName=ZCL_ORDER objectType=CLAS version=inactive
286
+ get_source objectName=ZCL_ORDER objectType=CLAS include=testclasses
287
+ get_source objectName=ZCL_ORDER objectType=CLAS method=get_name
288
+ get_source objectName=ZCL_ORDER objectType=CLAS grep="SELECT.*FROM"
289
+ ```
290
+
291
+ **Tip:** Do not combine `method` and `grep`. Use `grep` to locate code, then `method` to read the full method.
235
292
 
236
293
  ---
237
294
 
@@ -426,33 +483,60 @@ Create a new transport request.
426
483
  | `description` | string | ✅ | Transport description |
427
484
  | `type` | `"K"` \| `"W"` | `"K"` | Workbench (`K`) or Customizing (`W`) |
428
485
 
429
- > 🚧 Not yet implemented — returns a clear error until the underlying client method is available.
430
-
431
486
  ---
432
487
 
433
- #### `cts_release_transport`
488
+ #### `cts_create_task`
434
489
 
435
- Release a transport request.
490
+ Create and verify a modifiable task under an existing transport request.
436
491
 
437
492
  **Parameters:**
438
493
 
439
- | Parameter | Type | Description |
440
- | ------------- | ------ | ---------------- |
441
- | `transportId` | string | Transport number |
494
+ | Parameter | Type | Description |
495
+ | ----------- | ------ | ------------------------------- |
496
+ | `transport` | string | Parent transport request number |
497
+ | `owner` | string | SAP user who will own the task |
442
498
 
443
- > 🚧 Not yet implemented.
499
+ **Returns:** The parent transport number, created task number, normalized owner,
500
+ and `created` status.
444
501
 
445
502
  ---
446
503
 
504
+ #### `cts_release_transport`
505
+
506
+ Release a transport request.
507
+
508
+ **Parameters:**
509
+
510
+ | Parameter | Type | Description |
511
+ | ------------ | ------- | ------------------------------------------- |
512
+ | `transport` | string | Transport number |
513
+ | `releaseAll` | boolean | Release modifiable tasks before the request |
514
+
447
515
  #### `cts_delete_transport`
448
516
 
449
517
  Delete a transport request.
450
518
 
451
519
  **Parameters:**
452
520
 
453
- | Parameter | Type | Description |
454
- | ------------- | ------ | ---------------- |
455
- | `transportId` | string | Transport number |
521
+ | Parameter | Type | Description |
522
+ | ----------- | ------ | ---------------- |
523
+ | `transport` | string | Transport number |
524
+
525
+ ---
526
+
527
+ #### `flow_checkout_tr`
528
+
529
+ Reconcile an allowed local workspace to an exact transport source boundary.
530
+ The tool delegates to `@abapify/adt-flow`; it does not run Git commands.
531
+
532
+ | Parameter | Type | Default | Description |
533
+ | --------------- | -------- | ------- | ----------------------------------------------- |
534
+ | `transports` | string[] | ✅ | Non-empty transport scope |
535
+ | `workspaceRoot` | string | ✅ | Absolute directory within a server-owned root |
536
+ | `base` | boolean | `false` | Select the version immediately before the scope |
537
+
538
+ The JSON result contains changed, moved, removed, unchanged, descriptor, and
539
+ SAP-call counts. It never contains source bodies or credentials.
456
540
 
457
541
  ---
458
542
 
@@ -462,11 +546,15 @@ Delete a transport request.
462
546
 
463
547
  Run ABAP Test Cockpit checks on an object or package and return the resulting findings worklist.
464
548
 
549
+ In destination mode, this operation requires an explicit `safe_execute`
550
+ grant. A `read` grant is insufficient because SAP creates a temporary
551
+ server-side worklist for the analysis.
552
+
465
553
  **Parameters:**
466
554
 
467
- | Parameter | Type | Description |
468
- | ----------- | ------ | ----------------------------------------------------------- |
469
- | `objectUri` | string | ADT URI of the target, e.g. `/sap/bc/adt/packages/ZPACKAGE` |
555
+ | Parameter | Type | Description |
556
+ | --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
557
+ | `scope` | object | ATC scope: `{ kind: 'package', packageName }`, `{ kind: 'transport_request', trkorr }`, or `{ kind: 'objects', objects: [{ objectType, objectName }] }` |
470
558
 
471
559
  **Returns:**
472
560
 
@@ -492,7 +580,7 @@ Run ABAP Test Cockpit checks on an object or package and return the resulting fi
492
580
 
493
581
  ```
494
582
  1. list_package_objects packageName=ZPACKAGE
495
- 2. get_object objectName=ZCL_FOO
583
+ 2. get_object objectName=ZCL_FOO objectType=CLAS
496
584
  3. get_source objectName=ZCL_FOO objectType=CLAS
497
585
  ```
498
586
 
@@ -500,7 +588,7 @@ Run ABAP Test Cockpit checks on an object or package and return the resulting fi
500
588
 
501
589
  ```
502
590
  1. check_syntax objectName=ZCL_FOO objectType=CLAS
503
- 2. atc_run objectUri=/sap/bc/adt/oo/classes/zcl_foo
591
+ 2. atc_run scope={"kind":"objects","objects":[{"objectType":"CLAS","objectName":"ZCL_FOO"}]}
504
592
  3. run_unit_tests objectName=ZCL_FOO objectType=CLAS
505
593
  ```
506
594
 
@@ -565,12 +653,11 @@ const server = createMcpServer({
565
653
 
566
654
  ## Testing
567
655
 
568
- Integration tests use Node.js native test runner (`node:test`) and a built-in mock ADT server that needs no SAP system.
656
+ Integration tests use Vitest and a built-in mock ADT server that needs no SAP system.
569
657
 
570
658
  ```bash
571
659
  # Run all integration tests
572
- cd packages/adt-mcp
573
- node --test --import tsx tests/integration.test.ts
660
+ bunx vitest run tests/integration.test.ts
574
661
  ```
575
662
 
576
663
  ### Using the mock server in your own tests
@@ -592,31 +679,36 @@ await mock.stop();
592
679
  bunx nx build adt-mcp # build
593
680
  bunx nx typecheck adt-mcp # type check
594
681
  bunx nx lint adt-mcp # lint
595
- bunx nx test adt-mcp # tests (runs integration suite)
682
+ bunx nx test adt-mcp # run integration tests with Vitest
596
683
  ```
597
684
 
598
685
  ---
599
686
 
600
687
  ## Feature Parity Map
601
688
 
602
- | CLI Command | MCP Tool | Status |
603
- | ---------------------- | ----------------------- | ---------- |
604
- | `adt discovery` | `discovery` | ✅ |
605
- | `adt info` | `system_info` | ✅ |
606
- | `adt search` | `search_objects` | ✅ |
607
- | `adt get` | `get_object` | ✅ |
608
- | `adt source get` | `get_source` | ✅ |
609
- | `adt source put` | `update_source` | ✅ |
610
- | `adt activate` | `activate_object` | ✅ |
611
- | `adt check` | `check_syntax` | ✅ |
612
- | `adt aunit run` | `run_unit_tests` | ✅ |
613
- | `adt atc run` | `atc_run` | ✅ |
614
- | `adt cts tr list` | `cts_list_transports` | ✅ |
615
- | `adt cts tr get` | `cts_get_transport` | ✅ |
616
- | `adt cts tr delete` | `cts_delete_transport` | ✅ |
617
- | `adt cts tr create` | `cts_create_transport` | 🚧 Not yet |
618
- | `adt cts tr release` | `cts_release_transport` | 🚧 Not yet |
619
- | `adt ls` | — | 🔜 Future |
620
- | `adt cts search` | — | 🔜 Future |
621
- | `adt import package` | — | 🔜 Future |
622
- | `adt import transport` | — | 🔜 Future |
689
+ | CLI Command | MCP Tool | Status |
690
+ | ---------------------------- | ------------------------------- | --------- |
691
+ | `adt discovery` | `discovery` | ✅ |
692
+ | `adt info` | `system_info` | ✅ |
693
+ | `adt search` | `search_objects` | ✅ |
694
+ | `adt get` | `get_object` | ✅ |
695
+ | `adt source get` | `get_source` | ✅ |
696
+ | `adt source versions` | `list_source_versions` | ✅ |
697
+ | `adt source version get` | `get_source_version` | ✅ |
698
+ | `adt source put` | `update_source` | ✅ |
699
+ | `adt activate` | `activate_object` | ✅ |
700
+ | `adt check` | `check_syntax` | ✅ |
701
+ | `adt aunit run` | `run_unit_tests` | ✅ |
702
+ | `adt atc run` | `atc_run` | ✅ |
703
+ | `adt cts tr list` | `cts_list_transports` | ✅ |
704
+ | `adt cts tr get` | `cts_get_transport` | ✅ |
705
+ | `adt cts tr task create` | `cts_create_task` | ✅ |
706
+ | `adt cts tr source-manifest` | `cts_transport_source_manifest` | ✅ |
707
+ | `adt cts tr delete` | `cts_delete_transport` | ✅ |
708
+ | `adt cts tr create` | `cts_create_transport` | ✅ |
709
+ | `adt cts tr release` | `cts_release_transport` | ✅ |
710
+ | `adt flow checkout tr` | `flow_checkout_tr` | ✅ |
711
+ | `adt ls` | — | 🔜 Future |
712
+ | `adt cts search` | — | 🔜 Future |
713
+ | `adt import package` | — | 🔜 Future |
714
+ | `adt import transport` | — | 🔜 Future |
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,311 @@
1
+ #!/usr/bin/env node
2
+ import { n as startHttpServer } from "../server-5bFocUjx.mjs";
3
+ import { loadConfig } from "@abapify/adt-config";
4
+
5
+ //#region src/lib/http/adt-config-loader.ts
6
+ /**
7
+ * adt-config adapter for adt-mcp multi-system registry.
8
+ *
9
+ * Loads SAP system definitions from `adt.config.ts` / `adt.config.json`
10
+ * (via `@abapify/adt-config`) and returns a {@link MultiSystemConfig}
11
+ * compatible object that `startHttpServer()` can consume.
12
+ *
13
+ * Only destinations with a resolvable `url` field in their `options`
14
+ * (or the shorthand string URL) are included. Credentials (username /
15
+ * password) are intentionally NOT loaded — they must be supplied at
16
+ * runtime via the `sap_connect` tool call, matching the security policy
17
+ * of the existing multi-system loader.
18
+ */
19
+ /**
20
+ * Sanitize a URL for safe logging by stripping any embedded credentials
21
+ * (userinfo component) that a user might accidentally include.
22
+ */
23
+ function sanitizeUrl(raw) {
24
+ try {
25
+ const u = new URL(raw);
26
+ u.username = "";
27
+ u.password = "";
28
+ return u.toString();
29
+ } catch {
30
+ return "<invalid-url>";
31
+ }
32
+ }
33
+ /**
34
+ * Attempt to extract a `baseUrl` from a destination's options object.
35
+ * Handles both `{ url: '...' }` and `{ baseUrl: '...' }` shapes, as
36
+ * different auth plugins use different field names.
37
+ */
38
+ function extractBaseUrl(options) {
39
+ if (!options || typeof options !== "object") return void 0;
40
+ const o = options;
41
+ if (typeof o.url === "string" && o.url.length > 0) return o.url;
42
+ if (typeof o.baseUrl === "string" && o.baseUrl.length > 0) return o.baseUrl;
43
+ }
44
+ function extractClient(options) {
45
+ if (!options || typeof options !== "object") return void 0;
46
+ const o = options;
47
+ if (typeof o.client === "string" && o.client.length > 0) return o.client;
48
+ }
49
+ /**
50
+ * Load system definitions from `adt-config` and expose them as a
51
+ * {@link MultiSystemConfig} for the MCP HTTP server.
52
+ *
53
+ * @param configPath Optional explicit path to `adt.config.ts` / `adt.config.json`.
54
+ * When omitted, `@abapify/adt-config` auto-discovers from `cwd`.
55
+ * @param cwd Working directory for auto-discovery. Defaults to `process.cwd()`.
56
+ */
57
+ async function loadAdtConfigMultiSystem(configPath, cwd) {
58
+ if (configPath?.endsWith(".ts") && typeof globalThis.Bun === "undefined") throw new Error(`ADT_CONFIG_FILE '${configPath}' is TypeScript; plain Node.js cannot load .ts configs. Use adt.config.json, a compiled .mjs config, or run adt-mcp-http with Bun (e.g. bunx nx run adt-mcp:serve).`);
59
+ const loaded = await loadConfig({
60
+ configPath,
61
+ cwd
62
+ });
63
+ const systems = {};
64
+ for (const sid of loaded.listDestinations()) {
65
+ const dest = loaded.getDestination(sid);
66
+ if (!dest) continue;
67
+ let baseUrl;
68
+ let client;
69
+ if (typeof dest === "string") baseUrl = dest;
70
+ else {
71
+ baseUrl = extractBaseUrl(dest.options);
72
+ client = extractClient(dest.options);
73
+ }
74
+ if (!baseUrl) {
75
+ process.stderr.write(`[adt-config-loader] warning: destination '${sid}' has no resolvable URL — skipping.\n`);
76
+ continue;
77
+ }
78
+ systems[sid] = {
79
+ baseUrl,
80
+ ...client ? { client } : {}
81
+ };
82
+ process.stderr.write(`[adt-config-loader] loaded system '${sid}' → ${sanitizeUrl(baseUrl)}\n`);
83
+ }
84
+ return {
85
+ systems,
86
+ resolve(systemId) {
87
+ const entry = systems[systemId];
88
+ if (!entry) return void 0;
89
+ return {
90
+ baseUrl: entry.baseUrl,
91
+ client: entry.client
92
+ };
93
+ }
94
+ };
95
+ }
96
+
97
+ //#endregion
98
+ //#region src/bin/adt-mcp-http.ts
99
+ /**
100
+ * adt-mcp-http — Streamable HTTP entry-point for the MCP server.
101
+ *
102
+ * Usage:
103
+ * adt-mcp-http [--port 3000] [--host 127.0.0.1] [--ttl 1800000]
104
+ * [--auth-token <value>] [--trust-forwarded-auth]
105
+ * [--cors-origin <origin>]...
106
+ *
107
+ * Environment:
108
+ * MCP_PORT Listen port (default 3000).
109
+ * MCP_HOST Bind address (default 127.0.0.1).
110
+ * MCP_ALLOWED_HOSTS Comma-separated additional hostnames for the
111
+ * Host-header allowlist.
112
+ * MCP_AUTH_TOKEN Bearer token. Implies --auth-mode=bearer.
113
+ * TRUST_FORWARDED_AUTH Set to "1" / "true" to enable reverse-proxy
114
+ * (x-forwarded-user) trust mode.
115
+ * MCP_CORS_ORIGIN Comma-separated CORS allow-list.
116
+ * SAP_SYSTEMS_JSON Inline multi-system config as JSON.
117
+ * SAP_SYSTEMS_FILE Path to a multi-system config JSON file.
118
+ * ADT_CONFIG_FILE Path to adt.config.ts/json. When set, system
119
+ * definitions are loaded from adt-config instead
120
+ * of SAP_SYSTEMS_JSON / SAP_SYSTEMS_FILE.
121
+ */
122
+ function parseArgs(argv) {
123
+ const out = {};
124
+ for (let i = 0; i < argv.length; i++) {
125
+ const a = argv[i];
126
+ const next = () => argv[++i];
127
+ switch (a) {
128
+ case "--port":
129
+ case "-p": {
130
+ const v = Number(next());
131
+ if (Number.isFinite(v)) out.port = v;
132
+ break;
133
+ }
134
+ case "--host":
135
+ case "-H":
136
+ out.host = next();
137
+ break;
138
+ case "--ttl": {
139
+ const v = Number(next());
140
+ if (Number.isFinite(v)) out.ttlMs = v;
141
+ break;
142
+ }
143
+ case "--allowed-host": {
144
+ const v = next();
145
+ if (v) (out.allowedHosts ??= []).push(v);
146
+ break;
147
+ }
148
+ case "--auth-token": {
149
+ const v = next();
150
+ if (v) {
151
+ out.authToken = v;
152
+ out.authMode = "bearer";
153
+ }
154
+ break;
155
+ }
156
+ case "--auth-mode": {
157
+ const v = next();
158
+ if (v === "none" || v === "bearer" || v === "proxy" || v === "oauth") out.authMode = v;
159
+ break;
160
+ }
161
+ case "--trust-forwarded-auth":
162
+ out.trustForwardedAuth = true;
163
+ out.authMode = "proxy";
164
+ break;
165
+ case "--oauth-issuer": {
166
+ const v = next();
167
+ if (v) out.oauthIssuer = v;
168
+ break;
169
+ }
170
+ case "--oauth-audience": {
171
+ const v = next();
172
+ if (v) (out.oauthAudience ??= []).push(...v.split(",").map((s) => s.trim()).filter((s) => s.length > 0));
173
+ break;
174
+ }
175
+ case "--oauth-jwks-uri": {
176
+ const v = next();
177
+ if (v) out.oauthJwksUri = v;
178
+ break;
179
+ }
180
+ case "--oauth-required-scope": {
181
+ const v = next();
182
+ if (v) (out.oauthRequiredScopes ??= []).push(...v.split(",").map((s) => s.trim()).filter((s) => s.length > 0));
183
+ break;
184
+ }
185
+ case "--oauth-user-claim": {
186
+ const v = next();
187
+ if (v) out.oauthUserClaim = v;
188
+ break;
189
+ }
190
+ case "--cors-origin": {
191
+ const v = next();
192
+ if (v) (out.allowedOrigins ??= []).push(v);
193
+ break;
194
+ }
195
+ case "--adt-config": {
196
+ const v = next();
197
+ if (v) out.adtConfigFile = v;
198
+ break;
199
+ }
200
+ case "--tls-cert": {
201
+ const v = next();
202
+ if (v) out.tlsCert = v;
203
+ break;
204
+ }
205
+ case "--tls-key": {
206
+ const v = next();
207
+ if (v) out.tlsKey = v;
208
+ break;
209
+ }
210
+ case "--help":
211
+ case "-h":
212
+ process.stdout.write("Usage: adt-mcp-http [--port N] [--host HOST] [--ttl MS]\n [--allowed-host H ...]\n [--auth-token TOKEN | --auth-mode MODE]\n [--trust-forwarded-auth]\n [--oauth-issuer URL] [--oauth-audience VAL]\n [--oauth-jwks-uri URL]\n [--oauth-required-scope SCOPE]\n [--oauth-user-claim NAME]\n [--cors-origin ORIGIN ...]\n [--adt-config PATH]\n [--tls-cert PATH] [--tls-key PATH]\n");
213
+ process.exit(0);
214
+ }
215
+ }
216
+ return out;
217
+ }
218
+ function isTruthyEnv(v) {
219
+ if (!v) return false;
220
+ return [
221
+ "1",
222
+ "true",
223
+ "yes",
224
+ "on"
225
+ ].includes(v.toLowerCase());
226
+ }
227
+ function parseCsvEnv(v) {
228
+ if (!v) return [];
229
+ return v.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
230
+ }
231
+ async function main() {
232
+ const args = parseArgs(process.argv.slice(2));
233
+ const envAllowed = parseCsvEnv(process.env.MCP_ALLOWED_HOSTS);
234
+ const envCorsOrigins = parseCsvEnv(process.env.MCP_CORS_ORIGIN);
235
+ const envTrustForwarded = isTruthyEnv(process.env.TRUST_FORWARDED_AUTH);
236
+ const authToken = args.authToken ?? process.env.MCP_AUTH_TOKEN;
237
+ let authMode = args.authMode ?? "none";
238
+ if (authToken && authMode === "none") authMode = "bearer";
239
+ if ((args.trustForwardedAuth || envTrustForwarded) && authMode === "none") authMode = "proxy";
240
+ const oauthIssuer = args.oauthIssuer ?? process.env.OAUTH_ISSUER;
241
+ const oauthAudience = args.oauthAudience ?? parseCsvEnv(process.env.OAUTH_AUDIENCE);
242
+ const oauthJwksUri = args.oauthJwksUri ?? process.env.OAUTH_JWKS_URI;
243
+ const oauthRequiredScopes = args.oauthRequiredScopes ?? parseCsvEnv(process.env.OAUTH_REQUIRED_SCOPES);
244
+ const oauthUserClaim = args.oauthUserClaim ?? process.env.OAUTH_USER_CLAIM;
245
+ if (authMode === "none" && oauthIssuer) authMode = "oauth";
246
+ if (authMode === "bearer" && (!authToken || authToken.length === 0)) {
247
+ process.stderr.write("[adt-mcp-http] fatal: MCP_AUTH_TOKEN (or --auth-token) required when --auth-mode=bearer\n");
248
+ process.exit(1);
249
+ }
250
+ if (authMode === "oauth" && (!oauthIssuer || oauthIssuer.length === 0)) {
251
+ process.stderr.write("[adt-mcp-http] fatal: --oauth-issuer (or OAUTH_ISSUER) required when --auth-mode=oauth\n");
252
+ process.exit(1);
253
+ }
254
+ let oauthOptions;
255
+ if (authMode === "oauth" && oauthIssuer) oauthOptions = {
256
+ issuer: oauthIssuer,
257
+ audience: oauthAudience && oauthAudience.length > 0 ? oauthAudience.length === 1 ? oauthAudience[0] : oauthAudience : void 0,
258
+ jwksUri: oauthJwksUri,
259
+ requiredScopes: oauthRequiredScopes && oauthRequiredScopes.length > 0 ? oauthRequiredScopes : void 0,
260
+ userClaim: oauthUserClaim
261
+ };
262
+ const host = args.host ?? process.env.MCP_HOST ?? "127.0.0.1";
263
+ const isLoopback = host === "127.0.0.1" || host === "localhost" || host === "::1";
264
+ if (authMode === "none" && !isLoopback) process.stderr.write(`[adt-mcp-http] WARN: auth disabled and bound to non-loopback host '${host}' — anyone with network access can use the server. Set MCP_AUTH_TOKEN or TRUST_FORWARDED_AUTH=1 before exposing.
265
+ `);
266
+ if (authMode === "proxy" && !isLoopback) process.stderr.write(`[adt-mcp-http] WARN: TRUST_FORWARDED_AUTH enabled on non-loopback host '${host}' — x-forwarded-user is trusted unconditionally. Only use this mode behind a reverse proxy that strips these headers from untrusted input.
267
+ `);
268
+ const adtConfigFile = args.adtConfigFile ?? process.env.ADT_CONFIG_FILE;
269
+ let multiSystem;
270
+ if (adtConfigFile) {
271
+ process.stderr.write(`[adt-mcp-http] loading system registry from adt-config: ${adtConfigFile}\n`);
272
+ multiSystem = await loadAdtConfigMultiSystem(adtConfigFile);
273
+ }
274
+ const running = await startHttpServer({
275
+ ...multiSystem ? { multiSystem } : {},
276
+ port: args.port,
277
+ host: args.host,
278
+ ttlMs: args.ttlMs,
279
+ allowedHosts: [...args.allowedHosts ?? [], ...envAllowed],
280
+ authMode,
281
+ authToken,
282
+ trustForwardedAuth: args.trustForwardedAuth || envTrustForwarded,
283
+ oauth: oauthOptions,
284
+ allowedOrigins: [...args.allowedOrigins ?? [], ...envCorsOrigins],
285
+ tlsCert: args.tlsCert,
286
+ tlsKey: args.tlsKey
287
+ });
288
+ if (authMode === "oauth" && oauthOptions) {
289
+ const audDisplay = Array.isArray(oauthOptions.audience) ? oauthOptions.audience.join(",") : oauthOptions.audience ?? "<any>";
290
+ const scopesDisplay = oauthOptions.requiredScopes?.length ? oauthOptions.requiredScopes.join(",") : "<none>";
291
+ process.stderr.write(`[adt-mcp-http] OAuth validation enabled: issuer=${oauthOptions.issuer} audience=${audDisplay} scopes=${scopesDisplay}\n`);
292
+ }
293
+ const shutdown = async (signal) => {
294
+ process.stderr.write(`[adt-mcp-http] received ${signal}, shutting down\n`);
295
+ try {
296
+ await running.close();
297
+ } finally {
298
+ process.exit(0);
299
+ }
300
+ };
301
+ process.on("SIGINT", () => void shutdown("SIGINT"));
302
+ process.on("SIGTERM", () => void shutdown("SIGTERM"));
303
+ }
304
+ main().catch((err) => {
305
+ process.stderr.write(`[adt-mcp-http] fatal: ${err instanceof Error ? err.stack ?? err.message : String(err)}\n`);
306
+ process.exit(1);
307
+ });
308
+
309
+ //#endregion
310
+ export { };
311
+ //# sourceMappingURL=adt-mcp-http.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adt-mcp-http.mjs","names":[],"sources":["../../src/lib/http/adt-config-loader.ts","../../src/bin/adt-mcp-http.ts"],"sourcesContent":["/**\n * adt-config adapter for adt-mcp multi-system registry.\n *\n * Loads SAP system definitions from `adt.config.ts` / `adt.config.json`\n * (via `@abapify/adt-config`) and returns a {@link MultiSystemConfig}\n * compatible object that `startHttpServer()` can consume.\n *\n * Only destinations with a resolvable `url` field in their `options`\n * (or the shorthand string URL) are included. Credentials (username /\n * password) are intentionally NOT loaded — they must be supplied at\n * runtime via the `sap_connect` tool call, matching the security policy\n * of the existing multi-system loader.\n */\n\nimport { loadConfig } from '@abapify/adt-config';\nimport type { MultiSystemConfig } from './multi-system.js';\nimport type { ConnectionParams } from '../types.js';\n\n/**\n * Sanitize a URL for safe logging by stripping any embedded credentials\n * (userinfo component) that a user might accidentally include.\n */\nfunction sanitizeUrl(raw: string): string {\n try {\n const u = new URL(raw);\n u.username = '';\n u.password = '';\n return u.toString();\n } catch {\n return '<invalid-url>';\n }\n}\n\n/**\n * Attempt to extract a `baseUrl` from a destination's options object.\n * Handles both `{ url: '...' }` and `{ baseUrl: '...' }` shapes, as\n * different auth plugins use different field names.\n */\nfunction extractBaseUrl(options: unknown): string | undefined {\n if (!options || typeof options !== 'object') return undefined;\n const o = options as Record<string, unknown>;\n if (typeof o.url === 'string' && o.url.length > 0) return o.url;\n if (typeof o.baseUrl === 'string' && o.baseUrl.length > 0) return o.baseUrl;\n return undefined;\n}\n\nfunction extractClient(options: unknown): string | undefined {\n if (!options || typeof options !== 'object') return undefined;\n const o = options as Record<string, unknown>;\n if (typeof o.client === 'string' && o.client.length > 0) return o.client;\n return undefined;\n}\n\n/**\n * Load system definitions from `adt-config` and expose them as a\n * {@link MultiSystemConfig} for the MCP HTTP server.\n *\n * @param configPath Optional explicit path to `adt.config.ts` / `adt.config.json`.\n * When omitted, `@abapify/adt-config` auto-discovers from `cwd`.\n * @param cwd Working directory for auto-discovery. Defaults to `process.cwd()`.\n */\nexport async function loadAdtConfigMultiSystem(\n configPath?: string,\n cwd?: string,\n): Promise<MultiSystemConfig> {\n // Warn when a TypeScript config file is requested but the current runtime\n // is plain Node.js (not Bun). Node cannot `import()` a `.ts` file directly\n // without a loader, so the config would be silently ignored. Bun natively\n // supports TypeScript, so this is only a concern for production Node deployments.\n if (\n configPath?.endsWith('.ts') &&\n typeof (globalThis as Record<string, unknown>).Bun === 'undefined'\n ) {\n throw new Error(\n `ADT_CONFIG_FILE '${configPath}' is TypeScript; plain Node.js cannot load .ts configs. ` +\n `Use adt.config.json, a compiled .mjs config, or run adt-mcp-http with Bun ` +\n `(e.g. bunx nx run adt-mcp:serve).`,\n );\n }\n\n const loaded = await loadConfig({ configPath, cwd });\n const systems: Record<string, { baseUrl: string; client?: string }> = {};\n\n for (const sid of loaded.listDestinations()) {\n const dest = loaded.getDestination(sid);\n if (!dest) continue;\n\n let baseUrl: string | undefined;\n let client: string | undefined;\n\n if (typeof dest === 'string') {\n baseUrl = dest;\n } else {\n baseUrl = extractBaseUrl(dest.options);\n client = extractClient(dest.options);\n }\n\n if (!baseUrl) {\n process.stderr.write(\n `[adt-config-loader] warning: destination '${sid}' has no resolvable URL — skipping.\\n`,\n );\n continue;\n }\n\n systems[sid] = { baseUrl, ...(client ? { client } : {}) };\n process.stderr.write(\n `[adt-config-loader] loaded system '${sid}' → ${sanitizeUrl(baseUrl)}\\n`,\n );\n }\n\n return {\n systems,\n resolve(systemId: string): ConnectionParams | undefined {\n const entry = systems[systemId];\n if (!entry) return undefined;\n return { baseUrl: entry.baseUrl, client: entry.client };\n },\n };\n}\n","#!/usr/bin/env node\n/**\n * adt-mcp-http — Streamable HTTP entry-point for the MCP server.\n *\n * Usage:\n * adt-mcp-http [--port 3000] [--host 127.0.0.1] [--ttl 1800000]\n * [--auth-token <value>] [--trust-forwarded-auth]\n * [--cors-origin <origin>]...\n *\n * Environment:\n * MCP_PORT Listen port (default 3000).\n * MCP_HOST Bind address (default 127.0.0.1).\n * MCP_ALLOWED_HOSTS Comma-separated additional hostnames for the\n * Host-header allowlist.\n * MCP_AUTH_TOKEN Bearer token. Implies --auth-mode=bearer.\n * TRUST_FORWARDED_AUTH Set to \"1\" / \"true\" to enable reverse-proxy\n * (x-forwarded-user) trust mode.\n * MCP_CORS_ORIGIN Comma-separated CORS allow-list.\n * SAP_SYSTEMS_JSON Inline multi-system config as JSON.\n * SAP_SYSTEMS_FILE Path to a multi-system config JSON file.\n * ADT_CONFIG_FILE Path to adt.config.ts/json. When set, system\n * definitions are loaded from adt-config instead\n * of SAP_SYSTEMS_JSON / SAP_SYSTEMS_FILE.\n */\n\nimport { startHttpServer } from '../lib/http/server.js';\nimport type { OAuthOptions } from '../lib/http/oauth.js';\nimport type { MultiSystemConfig } from '../lib/http/multi-system.js';\nimport { loadAdtConfigMultiSystem } from '../lib/http/adt-config-loader.js';\n\ntype AuthMode = 'none' | 'bearer' | 'proxy' | 'oauth';\n\ninterface ParsedArgs {\n port?: number;\n host?: string;\n ttlMs?: number;\n allowedHosts?: string[];\n authToken?: string;\n authMode?: AuthMode;\n trustForwardedAuth?: boolean;\n allowedOrigins?: string[];\n oauthIssuer?: string;\n oauthAudience?: string[];\n oauthJwksUri?: string;\n oauthRequiredScopes?: string[];\n oauthUserClaim?: string;\n adtConfigFile?: string;\n tlsCert?: string;\n tlsKey?: string;\n}\n\nfunction parseArgs(argv: string[]): ParsedArgs {\n const out: ParsedArgs = {};\n for (let i = 0; i < argv.length; i++) {\n const a = argv[i];\n const next = () => argv[++i];\n switch (a) {\n case '--port':\n case '-p': {\n const v = Number(next());\n if (Number.isFinite(v)) out.port = v;\n break;\n }\n case '--host':\n case '-H': {\n out.host = next();\n break;\n }\n case '--ttl': {\n const v = Number(next());\n if (Number.isFinite(v)) out.ttlMs = v;\n break;\n }\n case '--allowed-host': {\n const v = next();\n if (v) (out.allowedHosts ??= []).push(v);\n break;\n }\n case '--auth-token': {\n const v = next();\n if (v) {\n out.authToken = v;\n out.authMode = 'bearer';\n }\n break;\n }\n case '--auth-mode': {\n const v = next();\n if (v === 'none' || v === 'bearer' || v === 'proxy' || v === 'oauth') {\n out.authMode = v;\n }\n break;\n }\n case '--trust-forwarded-auth': {\n out.trustForwardedAuth = true;\n out.authMode = 'proxy';\n break;\n }\n case '--oauth-issuer': {\n const v = next();\n if (v) out.oauthIssuer = v;\n break;\n }\n case '--oauth-audience': {\n const v = next();\n if (v) {\n (out.oauthAudience ??= []).push(\n ...v\n .split(',')\n .map((s) => s.trim())\n .filter((s) => s.length > 0),\n );\n }\n break;\n }\n case '--oauth-jwks-uri': {\n const v = next();\n if (v) out.oauthJwksUri = v;\n break;\n }\n case '--oauth-required-scope': {\n const v = next();\n if (v) {\n (out.oauthRequiredScopes ??= []).push(\n ...v\n .split(',')\n .map((s) => s.trim())\n .filter((s) => s.length > 0),\n );\n }\n break;\n }\n case '--oauth-user-claim': {\n const v = next();\n if (v) out.oauthUserClaim = v;\n break;\n }\n case '--cors-origin': {\n const v = next();\n if (v) (out.allowedOrigins ??= []).push(v);\n break;\n }\n case '--adt-config': {\n const v = next();\n if (v) out.adtConfigFile = v;\n break;\n }\n case '--tls-cert': {\n const v = next();\n if (v) out.tlsCert = v;\n break;\n }\n case '--tls-key': {\n const v = next();\n if (v) out.tlsKey = v;\n break;\n }\n case '--help':\n case '-h': {\n process.stdout.write(\n 'Usage: adt-mcp-http [--port N] [--host HOST] [--ttl MS]\\n' +\n ' [--allowed-host H ...]\\n' +\n ' [--auth-token TOKEN | --auth-mode MODE]\\n' +\n ' [--trust-forwarded-auth]\\n' +\n ' [--oauth-issuer URL] [--oauth-audience VAL]\\n' +\n ' [--oauth-jwks-uri URL]\\n' +\n ' [--oauth-required-scope SCOPE]\\n' +\n ' [--oauth-user-claim NAME]\\n' +\n ' [--cors-origin ORIGIN ...]\\n' +\n ' [--adt-config PATH]\\n' +\n ' [--tls-cert PATH] [--tls-key PATH]\\n',\n );\n process.exit(0);\n }\n // eslint-disable-next-line no-fallthrough\n default:\n // Unknown flag — ignore for forward compatibility.\n break;\n }\n }\n return out;\n}\n\nfunction isTruthyEnv(v: string | undefined): boolean {\n if (!v) return false;\n return ['1', 'true', 'yes', 'on'].includes(v.toLowerCase());\n}\n\nfunction parseCsvEnv(v: string | undefined): string[] {\n if (!v) return [];\n return v\n .split(',')\n .map((s) => s.trim())\n .filter((s) => s.length > 0);\n}\n\nasync function main(): Promise<void> {\n const args = parseArgs(process.argv.slice(2));\n const envAllowed = parseCsvEnv(process.env.MCP_ALLOWED_HOSTS);\n const envCorsOrigins = parseCsvEnv(process.env.MCP_CORS_ORIGIN);\n const envTrustForwarded = isTruthyEnv(process.env.TRUST_FORWARDED_AUTH);\n\n // CLI flag takes precedence over env. Env MCP_AUTH_TOKEN is used when\n // the flag is absent.\n const authToken = args.authToken ?? process.env.MCP_AUTH_TOKEN;\n let authMode: AuthMode = args.authMode ?? 'none';\n if (authToken && authMode === 'none') authMode = 'bearer';\n // TRUST_FORWARDED_AUTH (env or flag) may only promote a still-unset\n // `authMode` to 'proxy'. An explicit --auth-mode (e.g. oauth) must never\n // be silently downgraded by a stale env var — that would bypass JWT\n // validation. The explicit --trust-forwarded-auth CLI flag also requires\n // authMode to currently be 'none' to win, preserving the \"most specific\n // intent wins, never silently weaken\" rule.\n if ((args.trustForwardedAuth || envTrustForwarded) && authMode === 'none') {\n authMode = 'proxy';\n }\n\n // OAuth config — CLI wins, env fills the gaps.\n const oauthIssuer = args.oauthIssuer ?? process.env.OAUTH_ISSUER;\n const oauthAudience =\n args.oauthAudience ?? parseCsvEnv(process.env.OAUTH_AUDIENCE);\n const oauthJwksUri = args.oauthJwksUri ?? process.env.OAUTH_JWKS_URI;\n const oauthRequiredScopes =\n args.oauthRequiredScopes ?? parseCsvEnv(process.env.OAUTH_REQUIRED_SCOPES);\n const oauthUserClaim = args.oauthUserClaim ?? process.env.OAUTH_USER_CLAIM;\n\n if (authMode === 'none' && oauthIssuer) {\n // If user supplied OAuth config without explicit --auth-mode, assume\n // they meant oauth. Explicit --auth-mode always wins.\n authMode = 'oauth';\n }\n\n // Startup sanity check: bearer mode without a token cannot work.\n if (authMode === 'bearer' && (!authToken || authToken.length === 0)) {\n process.stderr.write(\n '[adt-mcp-http] fatal: MCP_AUTH_TOKEN (or --auth-token) required when --auth-mode=bearer\\n',\n );\n process.exit(1);\n }\n\n // Startup sanity check: oauth mode requires at least an issuer.\n if (authMode === 'oauth' && (!oauthIssuer || oauthIssuer.length === 0)) {\n process.stderr.write(\n '[adt-mcp-http] fatal: --oauth-issuer (or OAUTH_ISSUER) required when --auth-mode=oauth\\n',\n );\n process.exit(1);\n }\n\n let oauthOptions: OAuthOptions | undefined;\n if (authMode === 'oauth' && oauthIssuer) {\n oauthOptions = {\n issuer: oauthIssuer,\n audience:\n oauthAudience && oauthAudience.length > 0\n ? oauthAudience.length === 1\n ? oauthAudience[0]\n : oauthAudience\n : undefined,\n jwksUri: oauthJwksUri,\n requiredScopes:\n oauthRequiredScopes && oauthRequiredScopes.length > 0\n ? oauthRequiredScopes\n : undefined,\n userClaim: oauthUserClaim,\n };\n }\n\n const host = args.host ?? process.env.MCP_HOST ?? '127.0.0.1';\n const isLoopback =\n host === '127.0.0.1' || host === 'localhost' || host === '::1';\n\n if (authMode === 'none' && !isLoopback) {\n process.stderr.write(\n `[adt-mcp-http] WARN: auth disabled and bound to non-loopback host '${host}' — ` +\n 'anyone with network access can use the server. ' +\n 'Set MCP_AUTH_TOKEN or TRUST_FORWARDED_AUTH=1 before exposing.\\n',\n );\n }\n if (authMode === 'proxy' && !isLoopback) {\n process.stderr.write(\n `[adt-mcp-http] WARN: TRUST_FORWARDED_AUTH enabled on non-loopback host '${host}' — ` +\n 'x-forwarded-user is trusted unconditionally. ' +\n 'Only use this mode behind a reverse proxy that strips these headers from untrusted input.\\n',\n );\n }\n\n const adtConfigFile = args.adtConfigFile ?? process.env.ADT_CONFIG_FILE;\n let multiSystem: MultiSystemConfig | undefined;\n if (adtConfigFile) {\n process.stderr.write(\n `[adt-mcp-http] loading system registry from adt-config: ${adtConfigFile}\\n`,\n );\n multiSystem = await loadAdtConfigMultiSystem(adtConfigFile);\n }\n\n const running = await startHttpServer({\n ...(multiSystem ? { multiSystem } : {}),\n port: args.port,\n host: args.host,\n ttlMs: args.ttlMs,\n allowedHosts: [...(args.allowedHosts ?? []), ...envAllowed],\n authMode,\n authToken,\n trustForwardedAuth: args.trustForwardedAuth || envTrustForwarded,\n oauth: oauthOptions,\n allowedOrigins: [...(args.allowedOrigins ?? []), ...envCorsOrigins],\n tlsCert: args.tlsCert,\n tlsKey: args.tlsKey,\n });\n\n if (authMode === 'oauth' && oauthOptions) {\n const audDisplay = Array.isArray(oauthOptions.audience)\n ? oauthOptions.audience.join(',')\n : (oauthOptions.audience ?? '<any>');\n const scopesDisplay = oauthOptions.requiredScopes?.length\n ? oauthOptions.requiredScopes.join(',')\n : '<none>';\n process.stderr.write(\n `[adt-mcp-http] OAuth validation enabled: issuer=${oauthOptions.issuer} audience=${audDisplay} scopes=${scopesDisplay}\\n`,\n );\n }\n\n const shutdown = async (signal: string): Promise<void> => {\n process.stderr.write(`[adt-mcp-http] received ${signal}, shutting down\\n`);\n try {\n await running.close();\n } finally {\n process.exit(0);\n }\n };\n\n process.on('SIGINT', () => void shutdown('SIGINT'));\n process.on('SIGTERM', () => void shutdown('SIGTERM'));\n}\n\nmain().catch((err) => {\n process.stderr.write(\n `[adt-mcp-http] fatal: ${err instanceof Error ? (err.stack ?? err.message) : String(err)}\\n`,\n );\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,YAAY,KAAqB;CACxC,IAAI;EACF,MAAM,IAAI,IAAI,IAAI,GAAG;EACrB,EAAE,WAAW;EACb,EAAE,WAAW;EACb,OAAO,EAAE,SAAS;CACpB,QAAQ;EACN,OAAO;CACT;AACF;;;;;;AAOA,SAAS,eAAe,SAAsC;CAC5D,IAAI,CAAC,WAAW,OAAO,YAAY,UAAU,OAAO;CACpD,MAAM,IAAI;CACV,IAAI,OAAO,EAAE,QAAQ,YAAY,EAAE,IAAI,SAAS,GAAG,OAAO,EAAE;CAC5D,IAAI,OAAO,EAAE,YAAY,YAAY,EAAE,QAAQ,SAAS,GAAG,OAAO,EAAE;AAEtE;AAEA,SA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ServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+
5
+ //#region src/bin/adt-mcp.ts
6
+ /**
7
+ * adt-mcp – stdio entry-point
8
+ *
9
+ * Start with: npx adt-mcp
10
+ * Or pipe via: echo '{}' | adt-mcp
11
+ */
12
+ const server = createMcpServer();
13
+ const transport = new StdioServerTransport();
14
+ await server.connect(transport);
15
+
16
+ //#endregion
17
+ export { };
18
+ //# sourceMappingURL=adt-mcp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adt-mcp.mjs","names":[],"sources":["../../src/bin/adt-mcp.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * adt-mcp – stdio entry-point\n *\n * Start with: npx adt-mcp\n * Or pipe via: echo '{}' | adt-mcp\n */\n\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { createMcpServer } from '../lib/server';\n\nconst server = createMcpServer();\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,SAAS,gBAAgB;AAC/B,MAAM,YAAY,IAAI,qBAAqB;AAC3C,MAAM,OAAO,QAAQ,SAAS"}