@mcp-abap-adt/core 18.0.0 → 19.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.
Files changed (131) hide show
  1. package/README.md +26 -5
  2. package/bin/mcp-abap-adt.js +15 -15
  3. package/dist/StdioServer.d.ts +68 -14
  4. package/dist/StdioServer.d.ts.map +1 -1
  5. package/dist/StdioServer.js +101 -31
  6. package/dist/StdioServer.js.map +1 -1
  7. package/dist/auth/IAuthBrokerFactory.d.ts +62 -0
  8. package/dist/auth/IAuthBrokerFactory.d.ts.map +1 -0
  9. package/dist/auth/IAuthBrokerFactory.js +8 -0
  10. package/dist/auth/IAuthBrokerFactory.js.map +1 -0
  11. package/dist/auth/IAuthBrokerFactoryConfig.d.ts +90 -0
  12. package/dist/auth/IAuthBrokerFactoryConfig.d.ts.map +1 -0
  13. package/dist/auth/IAuthBrokerFactoryConfig.js +8 -0
  14. package/dist/auth/IAuthBrokerFactoryConfig.js.map +1 -0
  15. package/dist/auth/brokerFactory.d.ts +93 -0
  16. package/dist/auth/brokerFactory.d.ts.map +1 -0
  17. package/dist/auth/brokerFactory.js +341 -0
  18. package/dist/auth/brokerFactory.js.map +1 -0
  19. package/dist/auth/browser.d.ts +60 -0
  20. package/dist/auth/browser.d.ts.map +1 -0
  21. package/dist/auth/browser.js +116 -0
  22. package/dist/auth/browser.js.map +1 -0
  23. package/dist/auth/countedProvider.d.ts +43 -0
  24. package/dist/auth/countedProvider.d.ts.map +1 -0
  25. package/dist/auth/countedProvider.js +105 -0
  26. package/dist/auth/countedProvider.js.map +1 -0
  27. package/dist/auth/destinationFailure.d.ts +69 -0
  28. package/dist/auth/destinationFailure.d.ts.map +1 -0
  29. package/dist/auth/destinationFailure.js +183 -0
  30. package/dist/auth/destinationFailure.js.map +1 -0
  31. package/dist/auth/destinationStores.d.ts +55 -0
  32. package/dist/auth/destinationStores.d.ts.map +1 -0
  33. package/dist/auth/destinationStores.js +158 -0
  34. package/dist/auth/destinationStores.js.map +1 -0
  35. package/dist/auth/handlers/basic.d.ts +3 -0
  36. package/dist/auth/handlers/basic.d.ts.map +1 -0
  37. package/dist/auth/handlers/basic.js +8 -0
  38. package/dist/auth/handlers/basic.js.map +1 -0
  39. package/dist/auth/handlers/index.d.ts +15 -0
  40. package/dist/auth/handlers/index.d.ts.map +1 -0
  41. package/dist/auth/handlers/index.js +32 -0
  42. package/dist/auth/handlers/index.js.map +1 -0
  43. package/dist/auth/handlers/jwtAuthorizationCode.d.ts +8 -0
  44. package/dist/auth/handlers/jwtAuthorizationCode.d.ts.map +1 -0
  45. package/dist/auth/handlers/jwtAuthorizationCode.js +32 -0
  46. package/dist/auth/handlers/jwtAuthorizationCode.js.map +1 -0
  47. package/dist/auth/handlers/snc.d.ts +3 -0
  48. package/dist/auth/handlers/snc.d.ts.map +1 -0
  49. package/dist/auth/handlers/snc.js +14 -0
  50. package/dist/auth/handlers/snc.js.map +1 -0
  51. package/dist/auth/handlers/types.d.ts +30 -0
  52. package/dist/auth/handlers/types.d.ts.map +1 -0
  53. package/dist/auth/handlers/types.js +3 -0
  54. package/dist/auth/handlers/types.js.map +1 -0
  55. package/dist/auth/index.d.ts +15 -0
  56. package/dist/auth/index.d.ts.map +1 -0
  57. package/dist/auth/index.js +38 -0
  58. package/dist/auth/index.js.map +1 -0
  59. package/dist/auth/serverLogin.d.ts +75 -0
  60. package/dist/auth/serverLogin.d.ts.map +1 -0
  61. package/dist/auth/serverLogin.js +138 -0
  62. package/dist/auth/serverLogin.js.map +1 -0
  63. package/dist/auth/serverSentences.d.ts +39 -0
  64. package/dist/auth/serverSentences.d.ts.map +1 -0
  65. package/dist/auth/serverSentences.js +49 -0
  66. package/dist/auth/serverSentences.js.map +1 -0
  67. package/dist/auth/vocabulary.d.ts +28 -0
  68. package/dist/auth/vocabulary.d.ts.map +1 -0
  69. package/dist/auth/vocabulary.js +67 -0
  70. package/dist/auth/vocabulary.js.map +1 -0
  71. package/dist/config/coreParameters.d.ts +125 -0
  72. package/dist/config/coreParameters.d.ts.map +1 -0
  73. package/dist/config/coreParameters.js +331 -0
  74. package/dist/config/coreParameters.js.map +1 -0
  75. package/dist/config/envFileContext.d.ts +26 -0
  76. package/dist/config/envFileContext.d.ts.map +1 -0
  77. package/dist/config/envFileContext.js +90 -0
  78. package/dist/config/envFileContext.js.map +1 -0
  79. package/dist/config/envResolver.d.ts +6 -0
  80. package/dist/config/envResolver.d.ts.map +1 -0
  81. package/dist/config/envResolver.js +81 -0
  82. package/dist/config/envResolver.js.map +1 -0
  83. package/dist/config/platformPaths.d.ts +28 -0
  84. package/dist/config/platformPaths.d.ts.map +1 -0
  85. package/dist/config/platformPaths.js +152 -0
  86. package/dist/config/platformPaths.js.map +1 -0
  87. package/dist/destinationSource.d.ts +26 -0
  88. package/dist/destinationSource.d.ts.map +1 -0
  89. package/dist/destinationSource.js +43 -0
  90. package/dist/destinationSource.js.map +1 -0
  91. package/dist/index.d.ts +9 -5
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +16 -11
  94. package/dist/index.js.map +1 -1
  95. package/dist/launcher.d.ts +102 -59
  96. package/dist/launcher.d.ts.map +1 -1
  97. package/dist/launcher.js +419 -286
  98. package/dist/launcher.js.map +1 -1
  99. package/dist/shutdown.d.ts +76 -24
  100. package/dist/shutdown.d.ts.map +1 -1
  101. package/dist/shutdown.js +114 -57
  102. package/dist/shutdown.js.map +1 -1
  103. package/package.json +22 -39
  104. package/dist/InstancePool.d.ts +0 -87
  105. package/dist/InstancePool.d.ts.map +0 -1
  106. package/dist/InstancePool.js +0 -240
  107. package/dist/InstancePool.js.map +0 -1
  108. package/dist/SseServer.d.ts +0 -144
  109. package/dist/SseServer.d.ts.map +0 -1
  110. package/dist/SseServer.js +0 -359
  111. package/dist/SseServer.js.map +0 -1
  112. package/dist/StreamableHttpServer.d.ts +0 -143
  113. package/dist/StreamableHttpServer.d.ts.map +0 -1
  114. package/dist/StreamableHttpServer.js +0 -349
  115. package/dist/StreamableHttpServer.js.map +0 -1
  116. package/dist/destinationRequest.d.ts +0 -38
  117. package/dist/destinationRequest.d.ts.map +0 -1
  118. package/dist/destinationRequest.js +0 -85
  119. package/dist/destinationRequest.js.map +0 -1
  120. package/dist/dnsRebindingProtection.d.ts +0 -21
  121. package/dist/dnsRebindingProtection.d.ts.map +0 -1
  122. package/dist/dnsRebindingProtection.js +0 -45
  123. package/dist/dnsRebindingProtection.js.map +0 -1
  124. package/dist/stateClose.d.ts +0 -8
  125. package/dist/stateClose.d.ts.map +0 -1
  126. package/dist/stateClose.js +0 -14
  127. package/dist/stateClose.js.map +0 -1
  128. package/dist/tlsUtils.d.ts +0 -19
  129. package/dist/tlsUtils.d.ts.map +0 -1
  130. package/dist/tlsUtils.js +0 -77
  131. package/dist/tlsUtils.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envFileContext.js","sourceRoot":"","sources":["../../src/config/envFileContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,0EAgBC;AAtDD,4CAA8B;AAC9B,+CAAiC;AAEjC;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,qBAAqB,GAAG;IACnC,YAAY;IACZ,qBAAqB;IACrB,iBAAiB;IACjB,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,WAAW;IACX,eAAe;CACP,CAAC;AAEX;;;;GAIG;AACH,SAAgB,+BAA+B,CAC7C,WAAoB,EACpB,MAAyB,OAAO,CAAC,GAAG;IAEpC,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO;IAExD,IAAI,MAA8B,CAAC;IACnC,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;IACT,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,6BAAqB,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC3C,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare function resolveEnvFilePath(options: {
2
+ envDestination?: string;
3
+ envPath?: string;
4
+ authBrokerPath?: string;
5
+ }): string | undefined;
6
+ //# sourceMappingURL=envResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envResolver.d.ts","sourceRoot":"","sources":["../../src/config/envResolver.ts"],"names":[],"mappings":"AA0BA,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,GAAG,SAAS,CAmBrB"}
@@ -0,0 +1,81 @@
1
+ "use strict";
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.resolveEnvFilePath = resolveEnvFilePath;
37
+ const path = __importStar(require("node:path"));
38
+ const platformPaths_1 = require("./platformPaths");
39
+ function normalizeEnvFileName(input) {
40
+ const trimmed = input.trim();
41
+ if (!trimmed)
42
+ return trimmed;
43
+ return trimmed.toLowerCase().endsWith('.env') ? trimmed : `${trimmed}.env`;
44
+ }
45
+ function isLikelyPath(input) {
46
+ if (!input)
47
+ return false;
48
+ if (input.includes('/') || input.includes('\\'))
49
+ return true;
50
+ if (input.startsWith('.') || input.startsWith('~'))
51
+ return true;
52
+ if (path.isAbsolute(input))
53
+ return true;
54
+ return false;
55
+ }
56
+ function resolvePathLike(input) {
57
+ if (path.isAbsolute(input))
58
+ return input;
59
+ return path.resolve(process.cwd(), input);
60
+ }
61
+ function firstPlatformSessionsDir(customPath) {
62
+ return (0, platformPaths_1.getPlatformPaths)(customPath, 'sessions')[0];
63
+ }
64
+ function resolveEnvFilePath(options) {
65
+ const envPath = options.envPath?.trim();
66
+ if (envPath) {
67
+ return resolvePathLike(envPath);
68
+ }
69
+ const envDestination = options.envDestination?.trim();
70
+ if (!envDestination) {
71
+ return undefined;
72
+ }
73
+ // Backward compatibility: if --env was passed with a path, treat it as a path.
74
+ if (isLikelyPath(envDestination)) {
75
+ return resolvePathLike(envDestination);
76
+ }
77
+ const fileName = normalizeEnvFileName(envDestination);
78
+ const sessionsDir = firstPlatformSessionsDir(options.authBrokerPath);
79
+ return path.join(sessionsDir, fileName);
80
+ }
81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,SAAgB,kBAAkB,CAAC,OAIlC;IACC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;IACxC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC;IACtD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,+EAA+E;IAC/E,IAAI,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;QACjC,OAAO,eAAe,CAAC,cAAc,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,QAAQ,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,wBAAwB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACrE,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Platform-specific path resolution for mcp-abap-adt
3
+ *
4
+ * Defines default paths for service keys and sessions:
5
+ * - Unix: ~/.config/mcp-abap-adt/service-keys, ~/.config/mcp-abap-adt/sessions
6
+ * - Windows: %USERPROFILE%\Documents\mcp-abap-adt\service-keys, %USERPROFILE%\Documents\mcp-abap-adt\sessions
7
+ */
8
+ /**
9
+ * Get platform-specific default paths for service keys and sessions
10
+ *
11
+ * Priority:
12
+ * 1. Custom path (if provided)
13
+ * 2. AUTH_BROKER_PATH environment variable
14
+ * 3. Platform-specific standard paths:
15
+ * - Unix: ~/.config/mcp-abap-adt/service-keys, ~/.config/mcp-abap-adt/sessions
16
+ * - Windows: %USERPROFILE%\Documents\mcp-abap-adt\service-keys, %USERPROFILE%\Documents\mcp-abap-adt\sessions
17
+ *
18
+ * Never the working directory: nothing is looked up where the process happens
19
+ * to start (a server started inside someone else's project must not take
20
+ * their stores). A relative custom path or AUTH_BROKER_PATH entry is named by
21
+ * the user, so it still resolves against the working directory.
22
+ *
23
+ * @param customPath Optional custom path (highest priority)
24
+ * @param subfolder Subfolder name ('service-keys' or 'sessions')
25
+ * @returns Array of resolved absolute paths
26
+ */
27
+ export declare function getPlatformPaths(customPath?: string | string[], subfolder?: 'service-keys' | 'sessions'): string[];
28
+ //# sourceMappingURL=platformPaths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformPaths.d.ts","sourceRoot":"","sources":["../../src/config/platformPaths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC9B,SAAS,CAAC,EAAE,cAAc,GAAG,UAAU,GACtC,MAAM,EAAE,CA4FV"}
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ /**
3
+ * Platform-specific path resolution for mcp-abap-adt
4
+ *
5
+ * Defines default paths for service keys and sessions:
6
+ * - Unix: ~/.config/mcp-abap-adt/service-keys, ~/.config/mcp-abap-adt/sessions
7
+ * - Windows: %USERPROFILE%\Documents\mcp-abap-adt\service-keys, %USERPROFILE%\Documents\mcp-abap-adt\sessions
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.getPlatformPaths = getPlatformPaths;
44
+ const os = __importStar(require("node:os"));
45
+ const path = __importStar(require("node:path"));
46
+ /**
47
+ * Get platform-specific default paths for service keys and sessions
48
+ *
49
+ * Priority:
50
+ * 1. Custom path (if provided)
51
+ * 2. AUTH_BROKER_PATH environment variable
52
+ * 3. Platform-specific standard paths:
53
+ * - Unix: ~/.config/mcp-abap-adt/service-keys, ~/.config/mcp-abap-adt/sessions
54
+ * - Windows: %USERPROFILE%\Documents\mcp-abap-adt\service-keys, %USERPROFILE%\Documents\mcp-abap-adt\sessions
55
+ *
56
+ * Never the working directory: nothing is looked up where the process happens
57
+ * to start (a server started inside someone else's project must not take
58
+ * their stores). A relative custom path or AUTH_BROKER_PATH entry is named by
59
+ * the user, so it still resolves against the working directory.
60
+ *
61
+ * @param customPath Optional custom path (highest priority)
62
+ * @param subfolder Subfolder name ('service-keys' or 'sessions')
63
+ * @returns Array of resolved absolute paths
64
+ */
65
+ function getPlatformPaths(customPath, subfolder) {
66
+ const paths = [];
67
+ const isWindows = process.platform === 'win32';
68
+ // Priority 1: Custom path from constructor
69
+ // customPath is ALWAYS a base path - we add subfolder to it
70
+ if (customPath) {
71
+ if (Array.isArray(customPath)) {
72
+ // For arrays, add subfolder to each path if subfolder is specified
73
+ paths.push(...customPath.map((p) => {
74
+ let resolved = path.resolve(p);
75
+ // If path already ends with subfolder, use parent directory as base
76
+ if (subfolder && path.basename(resolved) === subfolder) {
77
+ resolved = path.dirname(resolved);
78
+ }
79
+ return subfolder ? path.join(resolved, subfolder) : resolved;
80
+ }));
81
+ }
82
+ else {
83
+ // For single path, add subfolder if specified
84
+ // customPath is ALWAYS a base path - we add subfolder to it
85
+ let resolved = path.resolve(customPath);
86
+ // If path already ends with subfolder, use parent directory as base
87
+ if (subfolder && path.basename(resolved) === subfolder) {
88
+ resolved = path.dirname(resolved);
89
+ }
90
+ paths.push(subfolder ? path.join(resolved, subfolder) : resolved);
91
+ }
92
+ }
93
+ // Priority 2: AUTH_BROKER_PATH environment variable
94
+ // AUTH_BROKER_PATH is ALWAYS a base path - we add subfolder to it
95
+ const envPath = process.env.AUTH_BROKER_PATH;
96
+ if (envPath) {
97
+ // Only semicolon separates paths on Windows. Splitting on ':' as well
98
+ // tears an absolute path in two at its drive letter: "D:\tools\project"
99
+ // becomes "D" and "\tools\project", the second resolving against
100
+ // whatever drive the process is on — a bogus directory added beside the
101
+ // real one, or no match at all when run from another drive.
102
+ const envPaths = envPath
103
+ .split(isWindows ? /;/ : /[:;]/)
104
+ .map((p) => p.trim())
105
+ .filter((p) => p.length > 0);
106
+ paths.push(...envPaths.map((p) => {
107
+ let resolved = path.resolve(p);
108
+ // If path already ends with subfolder, use parent directory as base
109
+ if (subfolder && path.basename(resolved) === subfolder) {
110
+ resolved = path.dirname(resolved);
111
+ }
112
+ return subfolder ? path.join(resolved, subfolder) : resolved;
113
+ }));
114
+ }
115
+ // Priority 3: Platform-specific standard paths
116
+ if (paths.length === 0) {
117
+ // Only add platform-specific paths if no custom paths were provided
118
+ const homeDir = os.homedir();
119
+ if (isWindows) {
120
+ // Windows: %USERPROFILE%\Documents\mcp-abap-adt\{subfolder}
121
+ const basePath = path.join(homeDir, 'Documents', 'mcp-abap-adt');
122
+ if (subfolder) {
123
+ paths.push(path.join(basePath, subfolder));
124
+ }
125
+ else {
126
+ paths.push(basePath);
127
+ }
128
+ }
129
+ else {
130
+ // Unix (Linux/macOS): ~/.config/mcp-abap-adt/{subfolder}
131
+ const basePath = path.join(homeDir, '.config', 'mcp-abap-adt');
132
+ if (subfolder) {
133
+ paths.push(path.join(basePath, subfolder));
134
+ }
135
+ else {
136
+ paths.push(basePath);
137
+ }
138
+ }
139
+ }
140
+ // Remove duplicates while preserving order
141
+ const uniquePaths = [];
142
+ const seen = new Set();
143
+ for (const p of paths) {
144
+ const normalized = path.normalize(p);
145
+ if (!seen.has(normalized)) {
146
+ seen.add(normalized);
147
+ uniquePaths.push(normalized);
148
+ }
149
+ }
150
+ return uniquePaths;
151
+ }
152
+ //# sourceMappingURL=platformPaths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformPaths.js","sourceRoot":"","sources":["../../src/config/platformPaths.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBH,4CA+FC;AArHD,4CAA8B;AAC9B,gDAAkC;AAElC;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,gBAAgB,CAC9B,UAA8B,EAC9B,SAAuC;IAEvC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;IAE/C,2CAA2C;IAC3C,4DAA4D;IAC5D,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,mEAAmE;YACnE,KAAK,CAAC,IAAI,CACR,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACtB,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBAC/B,oEAAoE;gBACpE,IAAI,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,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ACvB,CAAC;QACH,CAAC;IACH,CAAC;IAED,2CAA2C;IAC3C,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACrB,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * core's `ConnectionSource`: the destination the process serves,
3
+ * through the destination layer. Per request — with the request's signal —
4
+ * the settings (read once per process by the factory), the provider
5
+ * (`getProvider(destination, { signal })`: the broker's provider, the same
6
+ * one for the process's life) and what the destination's own `.env` states
7
+ * about who creates objects.
8
+ *
9
+ * Each of the three waits races the request's signal: they are shared
10
+ * work (one read, one build, one lookup for every caller), so a cancelled
11
+ * caller settles at once while the work runs on for the others, and a late
12
+ * rejection is handled.
13
+ *
14
+ * The server keeps no provider: asking `getProvider` per request is what
15
+ * carries renewal, a failed session write's refusal and the cancel of a
16
+ * login. On stdio the user is fixed for the process: the session is renewed
17
+ * (refresh token, or a new login when the refresh fails) and written back by
18
+ * that same provider — the same user. The instance's connection is kept
19
+ * while the source answers the same provider, and replaced only when
20
+ * SAP already lost the session, built with the provider `getProvider`
21
+ * answers — the same one.
22
+ */
23
+ import { type ConnectionSource } from '@mcp-abap-adt/lib/embeddable';
24
+ import type { IDestinations } from './auth/IAuthBrokerFactory.js';
25
+ export declare function destinationSource(destination: string, destinations: IDestinations): ConnectionSource;
26
+ //# sourceMappingURL=destinationSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"destinationSource.d.ts","sourceRoot":"","sources":["../src/destinationSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,aAAa,GAC1B,gBAAgB,CAyBlB"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * core's `ConnectionSource`: the destination the process serves,
4
+ * through the destination layer. Per request — with the request's signal —
5
+ * the settings (read once per process by the factory), the provider
6
+ * (`getProvider(destination, { signal })`: the broker's provider, the same
7
+ * one for the process's life) and what the destination's own `.env` states
8
+ * about who creates objects.
9
+ *
10
+ * Each of the three waits races the request's signal: they are shared
11
+ * work (one read, one build, one lookup for every caller), so a cancelled
12
+ * caller settles at once while the work runs on for the others, and a late
13
+ * rejection is handled.
14
+ *
15
+ * The server keeps no provider: asking `getProvider` per request is what
16
+ * carries renewal, a failed session write's refusal and the cancel of a
17
+ * login. On stdio the user is fixed for the process: the session is renewed
18
+ * (refresh token, or a new login when the refresh fails) and written back by
19
+ * that same provider — the same user. The instance's connection is kept
20
+ * while the source answers the same provider, and replaced only when
21
+ * SAP already lost the session, built with the provider `getProvider`
22
+ * answers — the same one.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.destinationSource = destinationSource;
26
+ const embeddable_1 = require("@mcp-abap-adt/lib/embeddable");
27
+ function destinationSource(destination, destinations) {
28
+ return {
29
+ async resolve(signal) {
30
+ const settings = await (0, embeddable_1.raceRequestSignal)(destinations.settingsFor(destination), signal);
31
+ const credential = await (0, embeddable_1.raceRequestSignal)(destinations.getProvider(destination, { signal }), signal);
32
+ const systemContext = destinations.systemContextFor === undefined
33
+ ? undefined
34
+ : await (0, embeddable_1.raceRequestSignal)(destinations.systemContextFor(destination), signal);
35
+ return {
36
+ settings: { ...settings },
37
+ credential,
38
+ ...(systemContext !== undefined ? { systemContext } : {}),
39
+ };
40
+ },
41
+ };
42
+ }
43
+ //# sourceMappingURL=destinationSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"destinationSource.js","sourceRoot":"","sources":["../src/destinationSource.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;AAQH,8CA4BC;AAlCD,6DAGsC;AAGtC,SAAgB,iBAAiB,CAC/B,WAAmB,EACnB,YAA2B;IAE3B,OAAO;QACL,KAAK,CAAC,OAAO,CAAC,MAAmB;YAC/B,MAAM,QAAQ,GAAG,MAAM,IAAA,8BAAiB,EACtC,YAAY,CAAC,WAAW,CAAC,WAAW,CAAC,EACrC,MAAM,CACP,CAAC;YACF,MAAM,UAAU,GAAG,MAAM,IAAA,8BAAiB,EACxC,YAAY,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,EACjD,MAAM,CACP,CAAC;YACF,MAAM,aAAa,GACjB,YAAY,CAAC,gBAAgB,KAAK,SAAS;gBACzC,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,MAAM,IAAA,8BAAiB,EACrB,YAAY,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAC1C,MAAM,CACP,CAAC;YACR,OAAO;gBACL,QAAQ,EAAE,EAAE,GAAG,QAAQ,EAAE;gBACzB,UAAU;gBACV,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC1D,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,13 +1,17 @@
1
1
  /**
2
- * `@mcp-abap-adt/core` — the standalone MCP server, AGPL-3.0-only.
2
+ * `@mcp-abap-adt/core` — the standalone MCP server over stdio, AGPL-3.0-only.
3
+ *
4
+ * Streamable HTTP is `@mcp-abap-adt/http` and HTTP+SSE `@mcp-abap-adt/sse`:
5
+ * packages of their own, serving credentials from each request's headers.
3
6
  *
4
7
  * Importing from here links AGPL code. If you are embedding ADT tools in your
5
8
  * own application, you want `@mcp-abap-adt/lib` instead: it carries the
6
9
  * handlers and the embeddable server under Apache-2.0, and no transport.
7
10
  */
8
- export * from './dnsRebindingProtection.js';
9
- export * from './SseServer.js';
11
+ export * from './config/coreParameters.js';
12
+ export * from './config/envFileContext.js';
13
+ export * from './config/envResolver.js';
14
+ export * from './config/platformPaths.js';
15
+ export * from './destinationSource.js';
10
16
  export * from './StdioServer.js';
11
- export * from './StreamableHttpServer.js';
12
- export * from './tlsUtils.js';
13
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,14 @@
1
1
  "use strict";
2
+ /**
3
+ * `@mcp-abap-adt/core` — the standalone MCP server over stdio, AGPL-3.0-only.
4
+ *
5
+ * Streamable HTTP is `@mcp-abap-adt/http` and HTTP+SSE `@mcp-abap-adt/sse`:
6
+ * packages of their own, serving credentials from each request's headers.
7
+ *
8
+ * Importing from here links AGPL code. If you are embedding ADT tools in your
9
+ * own application, you want `@mcp-abap-adt/lib` instead: it carries the
10
+ * handlers and the embeddable server under Apache-2.0, and no transport.
11
+ */
2
12
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
13
  if (k2 === undefined) k2 = k;
4
14
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -14,16 +24,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
24
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
25
  };
16
26
  Object.defineProperty(exports, "__esModule", { value: true });
17
- /**
18
- * `@mcp-abap-adt/core` — the standalone MCP server, AGPL-3.0-only.
19
- *
20
- * Importing from here links AGPL code. If you are embedding ADT tools in your
21
- * own application, you want `@mcp-abap-adt/lib` instead: it carries the
22
- * handlers and the embeddable server under Apache-2.0, and no transport.
23
- */
24
- __exportStar(require("./dnsRebindingProtection.js"), exports);
25
- __exportStar(require("./SseServer.js"), exports);
27
+ // core's parameter table and the destination's env file
28
+ __exportStar(require("./config/coreParameters.js"), exports);
29
+ __exportStar(require("./config/envFileContext.js"), exports);
30
+ __exportStar(require("./config/envResolver.js"), exports);
31
+ __exportStar(require("./config/platformPaths.js"), exports);
32
+ __exportStar(require("./destinationSource.js"), exports);
26
33
  __exportStar(require("./StdioServer.js"), exports);
27
- __exportStar(require("./StreamableHttpServer.js"), exports);
28
- __exportStar(require("./tlsUtils.js"), exports);
29
34
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,8DAA4C;AAC5C,iDAA+B;AAC/B,mDAAiC;AACjC,4DAA0C;AAC1C,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;AAEH,wDAAwD;AACxD,6DAA2C;AAC3C,6DAA2C;AAC3C,0DAAwC;AACxC,4DAA0C;AAC1C,yDAAuC;AACvC,mDAAiC"}