@mcp-abap-adt/connection 12.0.0 → 14.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 +80 -1
- package/README.md +11 -67
- package/docs/INDEX.md +8 -10
- package/docs/INSTALLATION.md +9 -43
- package/docs/MIGRATION-12.0.md +4 -3
- package/docs/MIGRATION-13.0.md +66 -0
- package/docs/MIGRATION-14.0.md +17 -0
- package/docs/USAGE.md +1 -2
- package/examples/README.md +1 -1
- package/package.json +6 -12
- package/bin/sap-abap-auth.js +0 -761
- package/docs/JWT_AUTH_TOOLS.md +0 -158
package/docs/JWT_AUTH_TOOLS.md
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
# JWT Auth Tools
|
|
2
|
-
|
|
3
|
-
This package ships with a helper CLI (`sap-abap-auth`) to obtain JWT and refresh tokens for SAP BTP ABAP systems.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## Prerequisites
|
|
7
|
-
|
|
8
|
-
- Node.js >= 18
|
|
9
|
-
- Service key JSON for your SAP BTP ABAP instance (from SAP BTP Cockpit)
|
|
10
|
-
- Browser access (for OAuth flow)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Quick Start
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npx sap-abap-auth auth -k path/to/service-key.json
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
This launches the OAuth browser flow and prints a `.env` file containing `SAP_JWT_TOKEN`, `SAP_REFRESH_TOKEN`, `SAP_UAA_URL`, etc.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## Installation Options
|
|
23
|
-
|
|
24
|
-
### Local (Project) Install
|
|
25
|
-
|
|
26
|
-
If `@mcp-abap-adt/connection` is part of your `dependencies` or `devDependencies`, you already have the CLI available:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install @mcp-abap-adt/connection --save-dev
|
|
30
|
-
npx sap-abap-auth auth -k service-key.json
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Pros:
|
|
34
|
-
- CLI travels with your project.
|
|
35
|
-
- No need for global npm installs.
|
|
36
|
-
|
|
37
|
-
### Global Install
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm install -g @mcp-abap-adt/connection
|
|
41
|
-
sap-abap-auth auth -k service-key.json
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Pros:
|
|
45
|
-
- Available system-wide.
|
|
46
|
-
- Useful if you run the tool frequently from the terminal.
|
|
47
|
-
|
|
48
|
-
### On-Demand (One-off) Usage
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npx @mcp-abap-adt/connection sap-abap-auth auth -k service-key.json
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Pros:
|
|
55
|
-
- No install needed.
|
|
56
|
-
- Perfect for quick usage on CI or temporary machines.
|
|
57
|
-
|
|
58
|
-
## CLI Usage
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
# Show help
|
|
62
|
-
sap-abap-auth --help
|
|
63
|
-
|
|
64
|
-
# Authenticate using service key JSON
|
|
65
|
-
sap-abap-auth auth -k service-key.json
|
|
66
|
-
|
|
67
|
-
# Use specific browser (chrome, firefox, edge, system, none)
|
|
68
|
-
sap-abap-auth auth -k service-key.json --browser chrome
|
|
69
|
-
|
|
70
|
-
# Output to custom file (default: .env)
|
|
71
|
-
sap-abap-auth auth -k service-key.json --output .env.production
|
|
72
|
-
|
|
73
|
-
# Print tokens to stdout (no file)
|
|
74
|
-
sap-abap-auth auth -k service-key.json --browser none --output -
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Full Command Reference
|
|
78
|
-
|
|
79
|
-
| Option | Description |
|
|
80
|
-
|-------------------------|------------------------------------------------------|
|
|
81
|
-
| `-k, --key <path>` | Path to service key JSON (required) |
|
|
82
|
-
| `-b, --browser <name>` | Browser to open (chrome, edge, firefox, system, none)|
|
|
83
|
-
| `-o, --output <path>` | Output `.env` path (`-` for stdout, defaults to `.env`) |
|
|
84
|
-
| `--config <path>` | Use config file with saved credentials |
|
|
85
|
-
| `--no-open` | Same as `--browser none` |
|
|
86
|
-
| `--help` | Show help |
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
## Using Generated Tokens
|
|
90
|
-
|
|
91
|
-
After running the CLI, you get `.env` similar to:
|
|
92
|
-
|
|
93
|
-
```
|
|
94
|
-
# Token Expiry Information (auto-generated)
|
|
95
|
-
# JWT Token expires: Monday, December 25, 2025 at 10:30:45 AM UTC
|
|
96
|
-
# JWT Token expires at: 2025-12-25T10:30:45.000Z
|
|
97
|
-
# Refresh Token expires: Tuesday, January 25, 2026 at 10:30:45 AM UTC
|
|
98
|
-
# Refresh Token expires at: 2026-01-25T10:30:45.000Z
|
|
99
|
-
|
|
100
|
-
SAP_URL=https://<your-abap-instance>.abap.whatever.sap
|
|
101
|
-
SAP_AUTH_TYPE=jwt
|
|
102
|
-
SAP_JWT_TOKEN=eyJhbGciOi...
|
|
103
|
-
SAP_REFRESH_TOKEN=eyJraWQiOi...
|
|
104
|
-
SAP_UAA_URL=https://<your>-authentication.<region>.hana.ondemand.com/oauth/token
|
|
105
|
-
SAP_UAA_CLIENT_ID=sb-<id>
|
|
106
|
-
SAP_UAA_CLIENT_SECRET=<secret>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**Note:** The token expiry information at the top of the `.env` file is automatically generated by decoding the JWT tokens. This helps you:
|
|
110
|
-
- Know when tokens will expire
|
|
111
|
-
- Plan token refresh in advance
|
|
112
|
-
- Troubleshoot authentication issues related to expired tokens
|
|
113
|
-
|
|
114
|
-
If a token's expiry cannot be determined (e.g., non-standard JWT format), a comment will indicate this.
|
|
115
|
-
|
|
116
|
-
Load it in your project:
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
source .env
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Or configure `SapConfig` directly:
|
|
124
|
-
|
|
125
|
-
```ts
|
|
126
|
-
import {
|
|
127
|
-
AdtCloudConnector,
|
|
128
|
-
CloudHttpTransport,
|
|
129
|
-
} from "@mcp-abap-adt/connection";
|
|
130
|
-
import { TokenAuthProvider } from "@mcp-abap-adt/auth-providers";
|
|
131
|
-
import type { SapConfig } from "@mcp-abap-adt/connection";
|
|
132
|
-
|
|
133
|
-
const config: SapConfig = {
|
|
134
|
-
url: process.env.SAP_URL!,
|
|
135
|
-
authType: "jwt",
|
|
136
|
-
jwtToken: process.env.SAP_JWT_TOKEN!,
|
|
137
|
-
};
|
|
138
|
-
const logger = console;
|
|
139
|
-
|
|
140
|
-
const connection = new AdtCloudConnector(
|
|
141
|
-
config,
|
|
142
|
-
TokenAuthProvider.fixed(config.jwtToken!),
|
|
143
|
-
new CloudHttpTransport(() => ({}), logger, {
|
|
144
|
-
client: config.client,
|
|
145
|
-
baseUrl: config.url,
|
|
146
|
-
}),
|
|
147
|
-
logger,
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
// Note: Token refresh is handled by @mcp-abap-adt/auth-broker package
|
|
151
|
-
// The refresh token credentials in .env are used by auth-broker, not connection
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
## Automating in CI
|
|
156
|
-
|
|
157
|
-
You can run the CLI once locally, store `.env` in secure storage, then load those variables in CI/CD to feed `@mcp-abap-adt/connection`. بهدف
|
|
158
|
-
|