@mcp-abap-adt/proxy 0.2.0 → 1.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/CHANGELOG.md +35 -7
- package/README.md +9 -9
- package/bin/mcp-abap-adt-proxy.js +2 -2
- package/dist/lib/config.js +1 -1
- package/dist/proxy/btpProxy.d.ts +2 -2
- package/dist/proxy/btpProxy.js +5 -5
- package/dist/router/headerAnalyzer.d.ts +3 -3
- package/dist/router/headerAnalyzer.js +7 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.0] - 2026-04-07
|
|
11
|
+
|
|
12
|
+
### Breaking Changes
|
|
13
|
+
- **Header renamed: `x-btp-destination` → `x-sap-destination`**
|
|
14
|
+
- The proxy now uses `x-sap-destination` header (same as MCP server) instead of the proxy-specific `x-btp-destination`
|
|
15
|
+
- The `--btp` CLI parameter is unchanged
|
|
16
|
+
- Clients sending `x-btp-destination` header must update to `x-sap-destination`
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- **Transparent reverse proxy for BTP request forwarding**
|
|
20
|
+
- Replaced buffered axios-based proxy with Node.js native HTTP streaming reverse proxy
|
|
21
|
+
- Supports any HTTP API including OpenAI-compatible streaming endpoints
|
|
22
|
+
- `targetUrl` parameter for explicit target URL override (`--target-url`/`--url` or `x-target-url` header)
|
|
23
|
+
- **Interactive configuration wizard (TUI)**
|
|
24
|
+
- `npx @mcp-abap-adt/proxy --tui` launches interactive setup wizard
|
|
25
|
+
- Service key existence checker validates BTP destination before configuration
|
|
26
|
+
- Generates YAML config files with inline comments
|
|
27
|
+
- Supports BTP and Direct URL scenarios with advanced settings
|
|
28
|
+
- **Dependencies updated**
|
|
29
|
+
- `@mcp-abap-adt/interfaces` bumped to v5
|
|
30
|
+
- `@mcp-abap-adt/auth-stores` bumped to v1.0.4
|
|
31
|
+
- Added `@inquirer/prompts` for TUI wizard
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
- **Header validation skipped in reverse proxy mode** when config provides destination
|
|
35
|
+
- **YAML config file now correctly loads transport/port settings** (`--config` flag)
|
|
36
|
+
- **targetUrl loading from YAML config** now works correctly
|
|
37
|
+
|
|
10
38
|
## [0.1.9] - 2026-02-12
|
|
11
39
|
|
|
12
40
|
### Changed
|
|
@@ -45,7 +73,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
45
73
|
|
|
46
74
|
### Added
|
|
47
75
|
- **Separate AuthBroker instances for BTP and ABAP destinations**
|
|
48
|
-
- `btpAuthBroker` with `XsuaaTokenProvider` for BTP destinations (`--btp` or `x-
|
|
76
|
+
- `btpAuthBroker` with `XsuaaTokenProvider` for BTP destinations (`--btp` or `x-sap-destination`)
|
|
49
77
|
- `abapAuthBroker` with `BtpTokenProvider` for ABAP destinations (`--mcp` or `x-mcp-destination`)
|
|
50
78
|
- Proper separation ensures correct token provider is used for each destination type
|
|
51
79
|
- **Client Setup Guide** (`docs/CLIENT_SETUP.md`)
|
|
@@ -89,7 +117,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
89
117
|
- **Documentation for BTP-Only authentication mode**
|
|
90
118
|
- Added "Scenario 2: BTP Authentication Only (No SAP Configuration)" in `docs/USAGE.md`
|
|
91
119
|
- Documented use case for connecting to any BTP service without SAP ABAP configuration
|
|
92
|
-
- Explained that `x-mcp-destination` is optional when using `x-
|
|
120
|
+
- Explained that `x-mcp-destination` is optional when using `x-sap-destination` or `--btp`
|
|
93
121
|
- Updated README.md with "BTP-Only Mode" section explaining behavior when only `--btp` is provided
|
|
94
122
|
- **Enhanced help text in `bin/mcp-abap-adt-proxy.js`**
|
|
95
123
|
- Added detailed "Usage Modes" section with three modes:
|
|
@@ -111,7 +139,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
111
139
|
### Fixed
|
|
112
140
|
- **Unit tests updated to match new routing logic**
|
|
113
141
|
- Fixed tests that expected `UNKNOWN` strategy when only `x-mcp-destination` or `x-mcp-url` is provided
|
|
114
|
-
- Updated test expectations to reflect that `x-
|
|
142
|
+
- Updated test expectations to reflect that `x-sap-destination` is now optional
|
|
115
143
|
- Added tests for `x-mcp-url` header support
|
|
116
144
|
- Updated `shouldProxy` function tests to cover all routing scenarios (BTP, MCP destination, MCP URL)
|
|
117
145
|
- All 51 unit tests now pass successfully
|
|
@@ -134,7 +162,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
134
162
|
|
|
135
163
|
### Added
|
|
136
164
|
- **Local testing mode without BTP authentication**
|
|
137
|
-
- Proxy can now run with only `--mcp` or `x-mcp-destination` (without `--btp` or `x-
|
|
165
|
+
- Proxy can now run with only `--mcp` or `x-mcp-destination` (without `--btp` or `x-sap-destination`)
|
|
138
166
|
- Enables local integration testing without BTP authentication
|
|
139
167
|
- MCP server URL can be obtained from MCP destination service key or specified directly via `--mcp-url`
|
|
140
168
|
- **`--mcp-url` parameter support**
|
|
@@ -149,16 +177,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
149
177
|
- Default configuration: ADT on port 3000 (HTTP), Proxy on port 3001 (HTTP)
|
|
150
178
|
- Available via `npm run test:servers`
|
|
151
179
|
- **Flexible routing requirements**
|
|
152
|
-
- Proxy accepts either `x-
|
|
180
|
+
- Proxy accepts either `x-sap-destination/--btp`, `x-mcp-destination/--mcp`, or `x-mcp-url/--mcp-url`
|
|
153
181
|
- Removed strict requirement for BTP destination when using MCP destination or URL
|
|
154
182
|
|
|
155
183
|
### Changed
|
|
156
184
|
- **Routing logic updated**
|
|
157
|
-
- `x-
|
|
185
|
+
- `x-sap-destination` is now optional (was required)
|
|
158
186
|
- Proxy can work with only `x-mcp-destination` or `x-mcp-url` for local testing
|
|
159
187
|
- MCP URL can be obtained from multiple sources (priority order):
|
|
160
188
|
1. `x-mcp-url` header or `--mcp-url` parameter (direct URL)
|
|
161
|
-
2. Service key for `x-
|
|
189
|
+
2. Service key for `x-sap-destination` (if provided)
|
|
162
190
|
3. Service key for `x-mcp-destination` (if only MCP destination is provided)
|
|
163
191
|
- **Token retrieval made optional for MCP destination**
|
|
164
192
|
- Token retrieval for `mcpDestination` is now optional (won't fail if token unavailable)
|
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ For detailed setup instructions for Cline and GitHub Copilot, see the **[Client
|
|
|
76
76
|
"type": "streamableHttp",
|
|
77
77
|
"url": "http://localhost:3001/mcp/stream/http",
|
|
78
78
|
"headers": {
|
|
79
|
-
"x-
|
|
79
|
+
"x-sap-destination": "btp-cloud"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -84,10 +84,10 @@ For detailed setup instructions for Cline and GitHub Copilot, see the **[Client
|
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
**Required Headers:**
|
|
87
|
-
- `x-
|
|
87
|
+
- `x-sap-destination` - Destination name for BTP Cloud authorization token and MCP server URL
|
|
88
88
|
|
|
89
89
|
**Command Line Overrides:**
|
|
90
|
-
- `--btp=<destination>` - Overrides `x-
|
|
90
|
+
- `--btp=<destination>` - Overrides `x-sap-destination` header (takes precedence)
|
|
91
91
|
- `--url=<url>` - Overrides MCP server URL (required if service key lacks URL)
|
|
92
92
|
- `--browser=<browser>` - Browser to use: `system` (default), `chrome`, `edge`, `firefox`, `headless`
|
|
93
93
|
- `--browser-auth-port=<port>` - Port for OAuth2 callback (default: 3333)
|
|
@@ -97,7 +97,7 @@ For detailed setup instructions for Cline and GitHub Copilot, see the **[Client
|
|
|
97
97
|
|
|
98
98
|
The proxy uses BTP/XSUAA authentication:
|
|
99
99
|
|
|
100
|
-
1. **BTP Authentication** (if `--btp` or `x-
|
|
100
|
+
1. **BTP Authentication** (if `--btp` or `x-sap-destination` is present):
|
|
101
101
|
- Uses `AuthorizationCodeProvider` (browser-based OAuth2 flow)
|
|
102
102
|
- **Eager Authentication**: Opens browser immediately on startup to get token
|
|
103
103
|
- Injects/overwrites `Authorization: Bearer <token>` header
|
|
@@ -106,7 +106,7 @@ The proxy uses BTP/XSUAA authentication:
|
|
|
106
106
|
|
|
107
107
|
**BTP Authentication Mode** (with `--btp`):
|
|
108
108
|
1. Proxy starts → Opens browser for login (Eager Auth) → Gets/Refreshes JWT token
|
|
109
|
-
2. `x-
|
|
109
|
+
2. `x-sap-destination` (or `--btp`) → Adds `Authorization: Bearer <token>` header
|
|
110
110
|
3. MCP server URL obtained from service key OR `--url` parameter
|
|
111
111
|
|
|
112
112
|
## Documentation
|
|
@@ -126,16 +126,16 @@ The proxy uses BTP/XSUAA authentication:
|
|
|
126
126
|
|
|
127
127
|
The proxy performs the following steps for each request:
|
|
128
128
|
|
|
129
|
-
1. **Extract Headers**: Reads `x-
|
|
129
|
+
1. **Extract Headers**: Reads `x-sap-destination` header
|
|
130
130
|
2. **Apply Command Line Overrides**: `--btp` parameter overrides header (if provided)
|
|
131
|
-
3. **Validate Routing Requirements**: Requires `x-
|
|
132
|
-
4. **BTP Authentication** (if `x-
|
|
131
|
+
3. **Validate Routing Requirements**: Requires `x-sap-destination/--btp`
|
|
132
|
+
4. **BTP Authentication** (if `x-sap-destination` or `--btp` is provided):
|
|
133
133
|
- Uses `AuthorizationCodeProvider` (browser-based login)
|
|
134
134
|
- **Eagerly** obtains token on startup (if configured via `--btp`)
|
|
135
135
|
- Retrieves JWT token using cached refresh token or opens browser
|
|
136
136
|
- Injects/overwrites `Authorization: Bearer <token>` header
|
|
137
137
|
5. **Get MCP Server URL**:
|
|
138
|
-
- From service key for `x-
|
|
138
|
+
- From service key for `x-sap-destination`
|
|
139
139
|
6. **Forward Request**: Sends request to MCP server URL with all injected headers
|
|
140
140
|
7. **Return Response**: Forwards the response back to the client
|
|
141
141
|
|
|
@@ -55,7 +55,7 @@ Options:
|
|
|
55
55
|
--sse-port=<port> SSE server port (default: 3002)
|
|
56
56
|
--http-host=<host> HTTP server host (default: 0.0.0.0)
|
|
57
57
|
--sse-host=<host> SSE server host (default: 0.0.0.0)
|
|
58
|
-
--btp=<destination> Override x-
|
|
58
|
+
--btp=<destination> Override x-sap-destination header (for BTP Cloud authorization)
|
|
59
59
|
Required for stdio/SSE transports unless provided in headers
|
|
60
60
|
--target-url=<url> Override target URL (separates Auth from Connection)
|
|
61
61
|
Useful for direct OData service testing or non-standard MCP URLs
|
|
@@ -100,7 +100,7 @@ Usage Modes:
|
|
|
100
100
|
Example: mcp-abap-adt-proxy --btp=ai
|
|
101
101
|
|
|
102
102
|
Headers (for HTTP/SSE transports):
|
|
103
|
-
- x-
|
|
103
|
+
- x-sap-destination: Destination for BTP Cloud authorization (optional if --btp is used)
|
|
104
104
|
|
|
105
105
|
At least one of the above headers (or corresponding --btp parameter) is required.
|
|
106
106
|
|
package/dist/lib/config.js
CHANGED
|
@@ -217,7 +217,7 @@ function validateConfig(config) {
|
|
|
217
217
|
// Check if BTP destination is provided
|
|
218
218
|
const hasDestination = config.btpDestination;
|
|
219
219
|
if (!hasDestination) {
|
|
220
|
-
warnings.push('No BTP destination provided (--btp). Proxy will not work unless requests include x-
|
|
220
|
+
warnings.push('No BTP destination provided (--btp). Proxy will not work unless requests include x-sap-destination header.');
|
|
221
221
|
}
|
|
222
222
|
if (config.httpPort < 1 || config.httpPort > 65535) {
|
|
223
223
|
errors.push('MCP_HTTP_PORT must be between 1 and 65535');
|
package/dist/proxy/btpProxy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* BTP Proxy - Proxies requests to MCP servers with JWT authentication
|
|
3
3
|
*
|
|
4
|
-
* For requests with x-
|
|
4
|
+
* For requests with x-sap-destination, proxies to target MCP server
|
|
5
5
|
* with JWT token from auth-broker (XSUAA/BTP)
|
|
6
6
|
*/
|
|
7
7
|
import { AuthBroker } from '@mcp-abap-adt/auth-broker';
|
|
@@ -79,7 +79,7 @@ export declare class BtpProxy {
|
|
|
79
79
|
* Process flow:
|
|
80
80
|
*
|
|
81
81
|
* 1. BTP Authentication (XSUAA):
|
|
82
|
-
* 1.1 If x-
|
|
82
|
+
* 1.1 If x-sap-destination header exists:
|
|
83
83
|
* - Check map for broker with key = destination, get or create, save to map
|
|
84
84
|
* - Get token from xsuaa broker
|
|
85
85
|
* - Add/replace Authorization: Bearer <token> header
|
package/dist/proxy/btpProxy.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* BTP Proxy - Proxies requests to MCP servers with JWT authentication
|
|
4
4
|
*
|
|
5
|
-
* For requests with x-
|
|
5
|
+
* For requests with x-sap-destination, proxies to target MCP server
|
|
6
6
|
* with JWT token from auth-broker (XSUAA/BTP)
|
|
7
7
|
*/
|
|
8
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
@@ -437,7 +437,7 @@ class BtpProxy {
|
|
|
437
437
|
* Process flow:
|
|
438
438
|
*
|
|
439
439
|
* 1. BTP Authentication (XSUAA):
|
|
440
|
-
* 1.1 If x-
|
|
440
|
+
* 1.1 If x-sap-destination header exists:
|
|
441
441
|
* - Check map for broker with key = destination, get or create, save to map
|
|
442
442
|
* - Get token from xsuaa broker
|
|
443
443
|
* - Add/replace Authorization: Bearer <token> header
|
|
@@ -464,21 +464,21 @@ class BtpProxy {
|
|
|
464
464
|
// ============================================
|
|
465
465
|
// BTP Authentication (XSUAA)
|
|
466
466
|
// ============================================
|
|
467
|
-
const btpDestinationHeader = this.getHeaderValue(originalHeaders[interfaces_1.
|
|
467
|
+
const btpDestinationHeader = this.getHeaderValue(originalHeaders[interfaces_1.HEADER_SAP_DESTINATION]);
|
|
468
468
|
const btpDestinationFromParam = routingDecision.btpDestination && !btpDestinationHeader
|
|
469
469
|
? routingDecision.btpDestination
|
|
470
470
|
: undefined;
|
|
471
471
|
let btpDestination;
|
|
472
472
|
if (btpDestinationHeader) {
|
|
473
473
|
btpDestination = btpDestinationHeader;
|
|
474
|
-
logger_js_1.logger?.debug('Using x-
|
|
474
|
+
logger_js_1.logger?.debug('Using x-sap-destination from header', {
|
|
475
475
|
type: 'BTP_DESTINATION_FROM_HEADER',
|
|
476
476
|
destination: btpDestination,
|
|
477
477
|
});
|
|
478
478
|
}
|
|
479
479
|
else if (btpDestinationFromParam) {
|
|
480
480
|
btpDestination = btpDestinationFromParam;
|
|
481
|
-
logger_js_1.logger?.debug('Using x-
|
|
481
|
+
logger_js_1.logger?.debug('Using x-sap-destination from parameter', {
|
|
482
482
|
type: 'BTP_DESTINATION_FROM_PARAM',
|
|
483
483
|
destination: btpDestination,
|
|
484
484
|
});
|
|
@@ -18,17 +18,17 @@ export interface RoutingDecision {
|
|
|
18
18
|
* Analyze headers and extract routing information
|
|
19
19
|
*
|
|
20
20
|
* Proxy validates only one header for authentication:
|
|
21
|
-
* - x-
|
|
21
|
+
* - x-sap-destination (or --btp): destination for BTP Cloud authorization token (Authorization: Bearer) and MCP server URL
|
|
22
22
|
*
|
|
23
23
|
|
|
24
24
|
*
|
|
25
25
|
* Command-line overrides (take precedence over headers):
|
|
26
|
-
* - --btp=<destination>: overrides x-
|
|
26
|
+
* - --btp=<destination>: overrides x-sap-destination header
|
|
27
27
|
*
|
|
28
28
|
* Other headers are passed directly to MCP server without validation.
|
|
29
29
|
*
|
|
30
30
|
* MPC server URL is obtained from:
|
|
31
|
-
* - service key for x-
|
|
31
|
+
* - service key for x-sap-destination (via auth-broker)
|
|
32
32
|
*
|
|
33
33
|
*
|
|
34
34
|
* Note: Proxy does NOT use .env files for connection configuration. Only destinations via auth-broker (service key files) are used.
|
|
@@ -19,17 +19,17 @@ var RoutingStrategy;
|
|
|
19
19
|
* Analyze headers and extract routing information
|
|
20
20
|
*
|
|
21
21
|
* Proxy validates only one header for authentication:
|
|
22
|
-
* - x-
|
|
22
|
+
* - x-sap-destination (or --btp): destination for BTP Cloud authorization token (Authorization: Bearer) and MCP server URL
|
|
23
23
|
*
|
|
24
24
|
|
|
25
25
|
*
|
|
26
26
|
* Command-line overrides (take precedence over headers):
|
|
27
|
-
* - --btp=<destination>: overrides x-
|
|
27
|
+
* - --btp=<destination>: overrides x-sap-destination header
|
|
28
28
|
*
|
|
29
29
|
* Other headers are passed directly to MCP server without validation.
|
|
30
30
|
*
|
|
31
31
|
* MPC server URL is obtained from:
|
|
32
|
-
* - service key for x-
|
|
32
|
+
* - service key for x-sap-destination (via auth-broker)
|
|
33
33
|
*
|
|
34
34
|
*
|
|
35
35
|
* Note: Proxy does NOT use .env files for connection configuration. Only destinations via auth-broker (service key files) are used.
|
|
@@ -48,9 +48,9 @@ function analyzeHeaders(headers, configOverrides) {
|
|
|
48
48
|
}
|
|
49
49
|
return typeof headerValue === 'string' ? headerValue.trim() : undefined;
|
|
50
50
|
};
|
|
51
|
-
// Extract authorization destination for BTP Cloud (x-
|
|
51
|
+
// Extract authorization destination for BTP Cloud (x-sap-destination)
|
|
52
52
|
// Command-line parameter --btp takes precedence over header
|
|
53
|
-
const btpDestinationHeader = getHeaderValue(interfaces_1.
|
|
53
|
+
const btpDestinationHeader = getHeaderValue(interfaces_1.HEADER_SAP_DESTINATION);
|
|
54
54
|
const extractedBtpDestination = configOverrides?.btpDestination
|
|
55
55
|
? configOverrides.btpDestination
|
|
56
56
|
: btpDestinationHeader;
|
|
@@ -72,10 +72,10 @@ function analyzeHeaders(headers, configOverrides) {
|
|
|
72
72
|
if (!extractedBtpDestination) {
|
|
73
73
|
return {
|
|
74
74
|
strategy: RoutingStrategy.UNKNOWN,
|
|
75
|
-
reason: 'No BTP destination provided (missing x-
|
|
75
|
+
reason: 'No BTP destination provided (missing x-sap-destination or --btp)',
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
// If x-
|
|
78
|
+
// If x-sap-destination is present, we can proxy with BTP authentication (URL will be obtained from service key)
|
|
79
79
|
// If x-mcp-url is provided, we can use it directly (for local testing)
|
|
80
80
|
logger_js_1.logger?.debug('Routing decision: PROXY', {
|
|
81
81
|
btpDestination: extractedBtpDestination,
|
package/package.json
CHANGED