@loop_ouroboros/mcp-hub-lite 1.2.5 → 1.2.7

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 (107) hide show
  1. package/CHANGELOG.md +659 -626
  2. package/dist/client/assets/HomeView-CgEri1kD.js +1 -0
  3. package/dist/client/assets/{ResourceDetailView-BGBtmsyc.js → ResourceDetailView-B8Qo1_jK.js} +1 -1
  4. package/dist/client/assets/ResourcesView-B12FzUdo.js +1 -0
  5. package/dist/client/assets/ServerDashboard-B3O-crvv.js +1 -0
  6. package/dist/client/assets/ServerDetail-Bz5_9yOY.js +2 -0
  7. package/dist/client/assets/{ServerDetail-CtnNKJGx.css → ServerDetail-CXg8rI3q.css} +1 -1
  8. package/dist/client/assets/{ServerListView-C7kcd4GC.js → ServerListView-SlZN8ppC.js} +2 -2
  9. package/dist/client/assets/{ServerStatusTags.vue_vue_type_script_setup_true_lang-BHhwEuGe.js → ServerStatusTags.vue_vue_type_script_setup_true_lang-DmGg4uuV.js} +1 -1
  10. package/dist/client/assets/SettingsView-D8fiOG0O.js +1 -0
  11. package/dist/client/assets/ToolCallDialog-DYEdhnCk.js +1 -0
  12. package/dist/client/assets/ToolsView-BreAl-yn.js +1 -0
  13. package/dist/client/assets/{_baseClone-kbJbcBJT.js → _baseClone-BYxCbA_9.js} +1 -1
  14. package/dist/client/assets/{el-form-item-iQ0G8e97.js → el-form-item-ySymCPMr.js} +2 -2
  15. package/dist/client/assets/el-input-C85p6Nqj.js +1 -0
  16. package/dist/client/assets/el-loading-DIjKEx81.js +1 -0
  17. package/dist/client/assets/{el-overlay-Cy5xg31y.js → el-overlay-B_CxiSem.js} +1 -1
  18. package/dist/client/assets/el-radio-group-BjkTCPRf.js +1 -0
  19. package/dist/client/assets/el-skeleton-item-CupTKK6n.js +1 -0
  20. package/dist/client/assets/{el-switch-KpjV93lm.js → el-switch-BosIJ9jf.js} +1 -1
  21. package/dist/client/assets/el-tab-pane-BydxdJoc.js +1 -0
  22. package/dist/client/assets/{el-table-column-fofd_2n-.js → el-table-column-DV5TZOUW.js} +1 -1
  23. package/dist/client/assets/index-kC4mf0Vo.js +2 -0
  24. package/dist/client/assets/{index-DpH6ZSbs.css → index-xJkq2euk.css} +1 -1
  25. package/dist/client/assets/omit-DxDGRttI.js +1 -0
  26. package/dist/client/assets/{raf-MWAHt9ca.js → raf-Y9AoxecD.js} +1 -1
  27. package/dist/client/assets/{vue-vendor-CbgVSHIh.js → vue-vendor-Dwcr0jep.js} +1 -1
  28. package/dist/client/index.html +3 -3
  29. package/dist/server/shared/types/websocket.types.d.ts +28 -19
  30. package/dist/server/shared/types/websocket.types.d.ts.map +1 -1
  31. package/dist/server/shared/types/websocket.types.js +3 -2
  32. package/dist/server/src/api/ws/ws-handler.d.ts.map +1 -1
  33. package/dist/server/src/api/ws/ws-handler.js +4 -3
  34. package/dist/server/src/app.d.ts.map +1 -1
  35. package/dist/server/src/app.js +46 -0
  36. package/dist/server/src/models/event.model.d.ts +0 -13
  37. package/dist/server/src/models/event.model.d.ts.map +1 -1
  38. package/dist/server/src/models/server.model.d.ts +0 -29
  39. package/dist/server/src/models/server.model.d.ts.map +1 -1
  40. package/dist/server/src/models/types.d.ts +1 -70
  41. package/dist/server/src/models/types.d.ts.map +1 -1
  42. package/dist/server/src/models/types.js +1 -67
  43. package/dist/server/src/server/dev-server.js +24 -6
  44. package/dist/server/src/services/connection/connection-manager.d.ts +19 -0
  45. package/dist/server/src/services/connection/connection-manager.d.ts.map +1 -1
  46. package/dist/server/src/services/connection/connection-manager.js +145 -5
  47. package/dist/server/src/services/event-bus.service.d.ts +0 -4
  48. package/dist/server/src/services/event-bus.service.d.ts.map +1 -1
  49. package/dist/server/src/services/event-bus.service.js +1 -6
  50. package/dist/server/src/services/gateway/request-handlers/initialize-handler.d.ts.map +1 -1
  51. package/dist/server/src/services/gateway/request-handlers/initialize-handler.js +1 -0
  52. package/dist/server/src/services/hub-tools/instance-selector.d.ts +8 -1
  53. package/dist/server/src/services/hub-tools/instance-selector.d.ts.map +1 -1
  54. package/dist/server/src/services/hub-tools/instance-selector.js +24 -10
  55. package/dist/server/src/services/hub-tools/resource-generator.d.ts.map +1 -1
  56. package/dist/server/src/services/hub-tools/resource-generator.js +4 -19
  57. package/dist/server/src/services/hub-tools.service.d.ts.map +1 -1
  58. package/dist/server/src/services/hub-tools.service.js +22 -5
  59. package/dist/server/src/services/mcp-oauth/index.d.ts +5 -0
  60. package/dist/server/src/services/mcp-oauth/index.d.ts.map +1 -0
  61. package/dist/server/src/services/mcp-oauth/index.js +3 -0
  62. package/dist/server/src/services/mcp-oauth/oauth-callback-server.d.ts +19 -0
  63. package/dist/server/src/services/mcp-oauth/oauth-callback-server.d.ts.map +1 -0
  64. package/dist/server/src/services/mcp-oauth/oauth-callback-server.js +100 -0
  65. package/dist/server/src/services/mcp-oauth/oauth-provider.d.ts +42 -0
  66. package/dist/server/src/services/mcp-oauth/oauth-provider.d.ts.map +1 -0
  67. package/dist/server/src/services/mcp-oauth/oauth-provider.js +121 -0
  68. package/dist/server/src/services/mcp-oauth/oauth-token-storage.d.ts +23 -0
  69. package/dist/server/src/services/mcp-oauth/oauth-token-storage.d.ts.map +1 -0
  70. package/dist/server/src/services/mcp-oauth/oauth-token-storage.js +92 -0
  71. package/dist/server/src/services/mcp-oauth/oauth-types.d.ts +21 -0
  72. package/dist/server/src/services/mcp-oauth/oauth-types.d.ts.map +1 -0
  73. package/dist/server/src/services/mcp-oauth/oauth-types.js +4 -0
  74. package/dist/server/src/utils/network-security.d.ts +33 -0
  75. package/dist/server/src/utils/network-security.d.ts.map +1 -0
  76. package/dist/server/src/utils/network-security.js +83 -0
  77. package/dist/server/src/utils/transports/streamable-http-transport.d.ts +12 -1
  78. package/dist/server/src/utils/transports/streamable-http-transport.d.ts.map +1 -1
  79. package/dist/server/src/utils/transports/streamable-http-transport.js +20 -1
  80. package/dist/server/src/utils/transports/transport-factory.d.ts +2 -0
  81. package/dist/server/src/utils/transports/transport-factory.d.ts.map +1 -1
  82. package/dist/server/src/utils/transports/transport-factory.js +17 -2
  83. package/dist/server/src/utils/transports/transport.interface.d.ts +2 -0
  84. package/dist/server/src/utils/transports/transport.interface.d.ts.map +1 -1
  85. package/dist/server/tests/unit/services/hub-tools/instance-selector.test.js +21 -16
  86. package/dist/server/tests/unit/services/hub-tools.service.test.js +36 -35
  87. package/dist/server/tests/unit/utils/network-security.test.d.ts +2 -0
  88. package/dist/server/tests/unit/utils/network-security.test.d.ts.map +1 -0
  89. package/dist/server/tests/unit/utils/network-security.test.js +123 -0
  90. package/dist/server/vite.config.js +1 -1
  91. package/package.json +111 -111
  92. package/dist/client/assets/HomeView-BnO4yIT9.js +0 -1
  93. package/dist/client/assets/ResourcesView-B5Xg0ynh.js +0 -1
  94. package/dist/client/assets/ServerDashboard-DYAVrrUk.js +0 -1
  95. package/dist/client/assets/ServerDetail-q94ZFfjL.js +0 -2
  96. package/dist/client/assets/SettingsView-BM6P5yrT.js +0 -1
  97. package/dist/client/assets/ToolCallDialog-BoAGxlB5.js +0 -1
  98. package/dist/client/assets/ToolsView-lqFhr7Bk.js +0 -1
  99. package/dist/client/assets/el-input-DkJq57wP.js +0 -1
  100. package/dist/client/assets/el-loading-C3v6a9xV.js +0 -1
  101. package/dist/client/assets/el-radio-group-C9QUL5mm.js +0 -1
  102. package/dist/client/assets/el-skeleton-item-Bbmpc0Xz.js +0 -1
  103. package/dist/client/assets/el-tab-pane-YsYuBcem.js +0 -1
  104. package/dist/client/assets/index-5tzIwwtS.js +0 -1
  105. package/dist/client/assets/index-MqHvQjDP.js +0 -2
  106. package/dist/client/assets/omit-CB4hTeTH.js +0 -1
  107. package/dist/client/assets/typescript-Bp3YSIOJ.js +0 -1
@@ -0,0 +1,42 @@
1
+ /**
2
+ * MCP OAuth Client Provider implementing the SDK's OAuthClientProvider interface.
3
+ *
4
+ * Handles the full OAuth 2.0 authorization code flow with PKCE for MCP servers:
5
+ * - Persists tokens and client info to JSON files
6
+ * - Opens system browser for user authorization
7
+ * - Manages a local HTTP callback server for auth code capture
8
+ * - Supports token refresh and credential invalidation
9
+ */
10
+ import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
11
+ import type { OAuthClientInformationMixed, OAuthTokens, OAuthClientMetadata } from '@modelcontextprotocol/sdk/shared/auth.js';
12
+ import { OAuthCallbackServer } from './oauth-callback-server.js';
13
+ import type { McpOAuthProviderOptions } from './oauth-types.js';
14
+ export declare class McpOAuthClientProvider implements OAuthClientProvider {
15
+ private _callbackServer;
16
+ private storage;
17
+ private _configDir;
18
+ private _callbackPort;
19
+ private _serverUrlHash;
20
+ constructor(options: McpOAuthProviderOptions);
21
+ get redirectUrl(): string;
22
+ get clientMetadata(): OAuthClientMetadata;
23
+ clientInformation(): OAuthClientInformationMixed | undefined;
24
+ saveClientInformation(info: OAuthClientInformationMixed): void;
25
+ tokens(): OAuthTokens | undefined;
26
+ saveTokens(tokens: OAuthTokens): void;
27
+ redirectToAuthorization(authorizationUrl: URL): Promise<void>;
28
+ saveCodeVerifier(codeVerifier: string): void;
29
+ codeVerifier(): string;
30
+ invalidateCredentials(scope: 'all' | 'client' | 'tokens' | 'verifier' | 'discovery'): Promise<void>;
31
+ /**
32
+ * Starts the local callback server for auth code capture.
33
+ * Idempotent — returns existing server if already running.
34
+ */
35
+ startCallbackServer(): Promise<OAuthCallbackServer>;
36
+ /**
37
+ * Stops the callback server after auth flow completes.
38
+ */
39
+ stopCallbackServer(): Promise<void>;
40
+ getCallbackServer(): OAuthCallbackServer | null;
41
+ }
42
+ //# sourceMappingURL=oauth-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-provider.d.ts","sourceRoot":"","sources":["../../../../../src/services/mcp-oauth/oauth-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,KAAK,EACV,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACpB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAMhE,qBAAa,sBAAuB,YAAW,mBAAmB;IAChE,OAAO,CAAC,eAAe,CAAoC;IAC3D,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,cAAc,CAAS;gBAEnB,OAAO,EAAE,uBAAuB;IAO5C,IAAI,WAAW,IAAI,MAAM,CAGxB;IAED,IAAI,cAAc,IAAI,mBAAmB,CAQxC;IAED,iBAAiB,IAAI,2BAA2B,GAAG,SAAS;IAI5D,qBAAqB,CAAC,IAAI,EAAE,2BAA2B,GAAG,IAAI;IAI9D,MAAM,IAAI,WAAW,GAAG,SAAS;IAIjC,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAI/B,uBAAuB,CAAC,gBAAgB,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BnE,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAI5C,YAAY,IAAI,MAAM;IAIhB,qBAAqB,CACzB,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,GAC5D,OAAO,CAAC,IAAI,CAAC;IAKhB;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IASzD;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAOzC,iBAAiB,IAAI,mBAAmB,GAAG,IAAI;CAGhD"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * MCP OAuth Client Provider implementing the SDK's OAuthClientProvider interface.
3
+ *
4
+ * Handles the full OAuth 2.0 authorization code flow with PKCE for MCP servers:
5
+ * - Persists tokens and client info to JSON files
6
+ * - Opens system browser for user authorization
7
+ * - Manages a local HTTP callback server for auth code capture
8
+ * - Supports token refresh and credential invalidation
9
+ */
10
+ import { exec } from 'node:child_process';
11
+ import { promisify } from 'node:util';
12
+ import path from 'node:path';
13
+ import os from 'node:os';
14
+ import { OAuthTokenStorage } from './oauth-token-storage.js';
15
+ import { OAuthCallbackServer } from './oauth-callback-server.js';
16
+ const execAsync = promisify(exec);
17
+ const DEFAULT_CONFIG_DIR = path.join(os.homedir(), '.mcp-hub-lite', 'oauth');
18
+ export class McpOAuthClientProvider {
19
+ _callbackServer = null;
20
+ storage;
21
+ _configDir;
22
+ _callbackPort;
23
+ _serverUrlHash;
24
+ constructor(options) {
25
+ this._serverUrlHash = options.serverUrlHash;
26
+ this._configDir = options.configDir || DEFAULT_CONFIG_DIR;
27
+ this._callbackPort = options.callbackPort || 0;
28
+ this.storage = new OAuthTokenStorage(this._configDir, this._serverUrlHash);
29
+ }
30
+ get redirectUrl() {
31
+ if (!this._callbackServer)
32
+ return '';
33
+ return this._callbackServer.redirectUrl;
34
+ }
35
+ get clientMetadata() {
36
+ return {
37
+ redirect_uris: [this.redirectUrl],
38
+ token_endpoint_auth_method: 'none',
39
+ grant_types: ['authorization_code', 'refresh_token'],
40
+ response_types: ['code'],
41
+ client_name: 'MCP Hub Lite'
42
+ };
43
+ }
44
+ clientInformation() {
45
+ return this.storage.getClientInfo();
46
+ }
47
+ saveClientInformation(info) {
48
+ this.storage.saveClientInfo(info);
49
+ }
50
+ tokens() {
51
+ return this.storage.getTokens();
52
+ }
53
+ saveTokens(tokens) {
54
+ this.storage.saveTokens(tokens);
55
+ }
56
+ async redirectToAuthorization(authorizationUrl) {
57
+ const urlStr = authorizationUrl.toString();
58
+ const platform = process.platform;
59
+ let command;
60
+ if (platform === 'win32') {
61
+ command = `start "" "${urlStr}"`;
62
+ }
63
+ else if (platform === 'darwin') {
64
+ command = `open "${urlStr}"`;
65
+ }
66
+ else {
67
+ command = `xdg-open "${urlStr}"`;
68
+ }
69
+ try {
70
+ await execAsync(command);
71
+ }
72
+ catch {
73
+ // Fallback: spawn detached
74
+ const { spawn } = await import('node:child_process');
75
+ if (platform === 'win32') {
76
+ spawn('cmd', ['/c', 'start', '', urlStr], { detached: true, stdio: 'ignore' }).unref();
77
+ }
78
+ else if (platform === 'darwin') {
79
+ spawn('open', [urlStr], { detached: true, stdio: 'ignore' }).unref();
80
+ }
81
+ else {
82
+ spawn('xdg-open', [urlStr], { detached: true, stdio: 'ignore' }).unref();
83
+ }
84
+ }
85
+ }
86
+ saveCodeVerifier(codeVerifier) {
87
+ this.storage.saveCodeVerifier(codeVerifier);
88
+ }
89
+ codeVerifier() {
90
+ return this.storage.getCodeVerifier() || '';
91
+ }
92
+ async invalidateCredentials(scope) {
93
+ if (scope === 'discovery')
94
+ return; // Not persisted
95
+ this.storage.clear(scope);
96
+ }
97
+ /**
98
+ * Starts the local callback server for auth code capture.
99
+ * Idempotent — returns existing server if already running.
100
+ */
101
+ async startCallbackServer() {
102
+ if (this._callbackServer) {
103
+ return this._callbackServer;
104
+ }
105
+ this._callbackServer = new OAuthCallbackServer(this._callbackPort);
106
+ await this._callbackServer.start();
107
+ return this._callbackServer;
108
+ }
109
+ /**
110
+ * Stops the callback server after auth flow completes.
111
+ */
112
+ async stopCallbackServer() {
113
+ if (this._callbackServer) {
114
+ await this._callbackServer.stop();
115
+ this._callbackServer = null;
116
+ }
117
+ }
118
+ getCallbackServer() {
119
+ return this._callbackServer;
120
+ }
121
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * JSON file-based OAuth token persistence.
3
+ *
4
+ * Stores OAuth credentials (client info, tokens, code verifier) as JSON files
5
+ * in the config directory. Uses atomic writes (tmp + rename) to prevent corruption.
6
+ */
7
+ import type { OAuthClientInformationMixed, OAuthTokens } from './oauth-types.js';
8
+ export declare class OAuthTokenStorage {
9
+ private cache;
10
+ private filePath;
11
+ constructor(configDir: string, serverUrlHash: string);
12
+ private ensureDir;
13
+ private loadFromFile;
14
+ private saveToFile;
15
+ getClientInfo(): OAuthClientInformationMixed | undefined;
16
+ saveClientInfo(info: OAuthClientInformationMixed): void;
17
+ getTokens(): OAuthTokens | undefined;
18
+ saveTokens(tokens: OAuthTokens): void;
19
+ getCodeVerifier(): string | undefined;
20
+ saveCodeVerifier(verifier: string): void;
21
+ clear(scope: 'all' | 'client' | 'tokens' | 'verifier'): void;
22
+ }
23
+ //# sourceMappingURL=oauth-token-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-token-storage.d.ts","sourceRoot":"","sources":["../../../../../src/services/mcp-oauth/oauth-token-storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,2BAA2B,EAC3B,WAAW,EAEZ,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAA4B;IACzC,OAAO,CAAC,QAAQ,CAAS;gBAEb,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAIpD,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,UAAU;IAclB,aAAa,IAAI,2BAA2B,GAAG,SAAS;IAOxD,cAAc,CAAC,IAAI,EAAE,2BAA2B,GAAG,IAAI;IAKvD,SAAS,IAAI,WAAW,GAAG,SAAS;IAOpC,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAKrC,eAAe,IAAI,MAAM,GAAG,SAAS;IAOrC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAKxC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,IAAI;CAiB7D"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * JSON file-based OAuth token persistence.
3
+ *
4
+ * Stores OAuth credentials (client info, tokens, code verifier) as JSON files
5
+ * in the config directory. Uses atomic writes (tmp + rename) to prevent corruption.
6
+ */
7
+ import fs from 'node:fs';
8
+ import path from 'node:path';
9
+ import { logger, LOG_MODULES } from '../../utils/logger/index.js';
10
+ export class OAuthTokenStorage {
11
+ cache = {};
12
+ filePath;
13
+ constructor(configDir, serverUrlHash) {
14
+ this.filePath = path.join(configDir, `${serverUrlHash}_oauth.json`);
15
+ }
16
+ ensureDir() {
17
+ const dir = path.dirname(this.filePath);
18
+ if (!fs.existsSync(dir)) {
19
+ fs.mkdirSync(dir, { recursive: true });
20
+ }
21
+ }
22
+ loadFromFile() {
23
+ try {
24
+ if (fs.existsSync(this.filePath)) {
25
+ const raw = fs.readFileSync(this.filePath, 'utf-8');
26
+ return JSON.parse(raw);
27
+ }
28
+ }
29
+ catch (error) {
30
+ logger.warn(`Failed to read OAuth storage file: ${error instanceof Error ? error.message : String(error)}`, LOG_MODULES.dynamic('oauth-storage'));
31
+ }
32
+ return {};
33
+ }
34
+ saveToFile(data) {
35
+ try {
36
+ this.ensureDir();
37
+ const tmpPath = `${this.filePath}.tmp`;
38
+ fs.writeFileSync(tmpPath, JSON.stringify(data, null, 2), 'utf-8');
39
+ fs.renameSync(tmpPath, this.filePath);
40
+ }
41
+ catch (error) {
42
+ logger.error(`Failed to write OAuth storage file: ${error instanceof Error ? error.message : String(error)}`, LOG_MODULES.dynamic('oauth-storage'));
43
+ }
44
+ }
45
+ getClientInfo() {
46
+ if (!this.cache.clientInfo) {
47
+ this.cache = this.loadFromFile();
48
+ }
49
+ return this.cache.clientInfo;
50
+ }
51
+ saveClientInfo(info) {
52
+ this.cache.clientInfo = info;
53
+ this.saveToFile(this.cache);
54
+ }
55
+ getTokens() {
56
+ if (!this.cache.tokens) {
57
+ this.cache = this.loadFromFile();
58
+ }
59
+ return this.cache.tokens;
60
+ }
61
+ saveTokens(tokens) {
62
+ this.cache.tokens = tokens;
63
+ this.saveToFile(this.cache);
64
+ }
65
+ getCodeVerifier() {
66
+ if (!this.cache.codeVerifier) {
67
+ this.cache = this.loadFromFile();
68
+ }
69
+ return this.cache.codeVerifier;
70
+ }
71
+ saveCodeVerifier(verifier) {
72
+ this.cache.codeVerifier = verifier;
73
+ this.saveToFile(this.cache);
74
+ }
75
+ clear(scope) {
76
+ switch (scope) {
77
+ case 'all':
78
+ this.cache = {};
79
+ break;
80
+ case 'client':
81
+ delete this.cache.clientInfo;
82
+ break;
83
+ case 'tokens':
84
+ delete this.cache.tokens;
85
+ break;
86
+ case 'verifier':
87
+ delete this.cache.codeVerifier;
88
+ break;
89
+ }
90
+ this.saveToFile(this.cache);
91
+ }
92
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Type definitions for MCP OAuth authentication.
3
+ */
4
+ import type { OAuthClientInformationMixed, OAuthTokens, OAuthClientMetadata } from '@modelcontextprotocol/sdk/shared/auth.js';
5
+ export interface OAuthPersistenceData {
6
+ clientInfo?: OAuthClientInformationMixed;
7
+ tokens?: OAuthTokens;
8
+ codeVerifier?: string;
9
+ }
10
+ export interface McpOAuthConfig {
11
+ enabled?: boolean;
12
+ callbackPort?: number;
13
+ configDir?: string;
14
+ }
15
+ export interface McpOAuthProviderOptions {
16
+ serverUrlHash: string;
17
+ configDir: string;
18
+ callbackPort?: number;
19
+ }
20
+ export type { OAuthClientInformationMixed, OAuthTokens, OAuthClientMetadata };
21
+ //# sourceMappingURL=oauth-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-types.d.ts","sourceRoot":"","sources":["../../../../../src/services/mcp-oauth/oauth-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACpB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,2BAA2B,CAAC;IACzC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,YAAY,EAAE,2BAA2B,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Type definitions for MCP OAuth authentication.
3
+ */
4
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * CIDR-based IP allowlist matching utility.
3
+ * Zero dependencies — pure functions operating on IPv4 dotted-decimal strings.
4
+ */
5
+ /**
6
+ * Convert dotted-decimal IPv4 string to a 32-bit unsigned integer.
7
+ * Returns NaN for invalid inputs.
8
+ */
9
+ export declare function ip4ToInt(ip: string): number;
10
+ /**
11
+ * Normalize an IP string for IPv4 CIDR matching.
12
+ * - Strips "::ffff:" prefix from IPv4-mapped IPv6 addresses
13
+ * - Maps "::1" (IPv6 loopback) to "127.0.0.1"
14
+ * - Returns other values unchanged
15
+ */
16
+ export declare function normalizeIp(ip: string): string;
17
+ /**
18
+ * Parse a CIDR string "x.x.x.x/prefix" into network and mask.
19
+ * If no prefix is provided, assume /32 (single host).
20
+ * Returns null for invalid input.
21
+ */
22
+ export declare function parseCidr(cidr: string): {
23
+ network: number;
24
+ mask: number;
25
+ } | null;
26
+ /**
27
+ * Check whether an IP address is allowed by any CIDR in the allowlist.
28
+ * - Empty/null/undefined list → true (allow all)
29
+ * - Invalid IP → false (block, safety default)
30
+ * - Invalid CIDR entries in the list are silently skipped
31
+ */
32
+ export declare function isIpAllowed(ip: string, allowedNetworks: string[]): boolean;
33
+ //# sourceMappingURL=network-security.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network-security.d.ts","sourceRoot":"","sources":["../../../../src/utils/network-security.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAW3C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAK9C;AAQD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAehF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,OAAO,CAY1E"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * CIDR-based IP allowlist matching utility.
3
+ * Zero dependencies — pure functions operating on IPv4 dotted-decimal strings.
4
+ */
5
+ /**
6
+ * Convert dotted-decimal IPv4 string to a 32-bit unsigned integer.
7
+ * Returns NaN for invalid inputs.
8
+ */
9
+ export function ip4ToInt(ip) {
10
+ const parts = ip.split('.');
11
+ if (parts.length !== 4)
12
+ return NaN;
13
+ let result = 0;
14
+ for (const part of parts) {
15
+ const octet = parseInt(part, 10);
16
+ if (octet < 0 || octet > 255 || String(octet) !== part)
17
+ return NaN;
18
+ result = ((result << 8) | octet) >>> 0;
19
+ }
20
+ return result;
21
+ }
22
+ /**
23
+ * Normalize an IP string for IPv4 CIDR matching.
24
+ * - Strips "::ffff:" prefix from IPv4-mapped IPv6 addresses
25
+ * - Maps "::1" (IPv6 loopback) to "127.0.0.1"
26
+ * - Returns other values unchanged
27
+ */
28
+ export function normalizeIp(ip) {
29
+ if (!ip)
30
+ return ip;
31
+ if (ip === '::1')
32
+ return '127.0.0.1';
33
+ if (ip.startsWith('::ffff:'))
34
+ return ip.slice(7);
35
+ return ip;
36
+ }
37
+ function cidrMask(prefix) {
38
+ if (prefix <= 0)
39
+ return 0;
40
+ if (prefix >= 32)
41
+ return 0xffffffff >>> 0;
42
+ return (~0 << (32 - prefix)) >>> 0;
43
+ }
44
+ /**
45
+ * Parse a CIDR string "x.x.x.x/prefix" into network and mask.
46
+ * If no prefix is provided, assume /32 (single host).
47
+ * Returns null for invalid input.
48
+ */
49
+ export function parseCidr(cidr) {
50
+ if (!cidr)
51
+ return null;
52
+ const slashIdx = cidr.indexOf('/');
53
+ const ipPart = slashIdx === -1 ? cidr : cidr.slice(0, slashIdx);
54
+ const prefixPart = slashIdx === -1 ? '32' : cidr.slice(slashIdx + 1);
55
+ const ip = ip4ToInt(ipPart);
56
+ if (isNaN(ip))
57
+ return null;
58
+ const prefix = parseInt(prefixPart, 10);
59
+ if (isNaN(prefix) || String(prefix) !== prefixPart || prefix < 0 || prefix > 32)
60
+ return null;
61
+ const mask = cidrMask(prefix);
62
+ return { network: (ip & mask) >>> 0, mask };
63
+ }
64
+ /**
65
+ * Check whether an IP address is allowed by any CIDR in the allowlist.
66
+ * - Empty/null/undefined list → true (allow all)
67
+ * - Invalid IP → false (block, safety default)
68
+ * - Invalid CIDR entries in the list are silently skipped
69
+ */
70
+ export function isIpAllowed(ip, allowedNetworks) {
71
+ if (!allowedNetworks || allowedNetworks.length === 0)
72
+ return true;
73
+ const normalized = normalizeIp(ip);
74
+ const ipInt = ip4ToInt(normalized);
75
+ if (isNaN(ipInt))
76
+ return false;
77
+ for (const cidr of allowedNetworks) {
78
+ const parsed = parseCidr(cidr);
79
+ if (parsed && (ipInt & parsed.mask) >>> 0 === parsed.network)
80
+ return true;
81
+ }
82
+ return false;
83
+ }
@@ -1,5 +1,7 @@
1
1
  import { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
2
2
  import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
3
+ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
4
+ import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
3
5
  /**
4
6
  * Streamable HTTP Transport implementation for MCP (Model Context Protocol)
5
7
  *
@@ -30,6 +32,7 @@ export declare class StreamableHttpTransport implements Transport {
30
32
  private headers;
31
33
  private timeout;
32
34
  private proxy?;
35
+ private authProvider?;
33
36
  /**
34
37
  * Internal reference to the underlying MCP SDK transport instance
35
38
  * @private
@@ -80,7 +83,7 @@ export declare class StreamableHttpTransport implements Transport {
80
83
  */
81
84
  constructor(url: string, headers?: Record<string, string>, timeout?: number, proxy?: {
82
85
  url: string;
83
- } | undefined, serverName?: string, compositeKey?: string);
86
+ } | undefined, authProvider?: OAuthClientProvider | undefined, serverName?: string, compositeKey?: string);
84
87
  /**
85
88
  * Helper method to format log messages with server context.
86
89
  *
@@ -135,6 +138,14 @@ export declare class StreamableHttpTransport implements Transport {
135
138
  * // Transport is now closed and cannot send/receive messages
136
139
  * ```
137
140
  */
141
+ /**
142
+ * Returns the OAuth provider if configured, for connection manager to handle auth flow.
143
+ */
144
+ getOAuthProvider(): OAuthClientProvider | undefined;
145
+ /**
146
+ * Returns the underlying SDK transport for auth flow management.
147
+ */
148
+ getSdkTransport(): StreamableHTTPClientTransport | null;
138
149
  close(): Promise<void>;
139
150
  /**
140
151
  * Sends a JSON-RPC message to the connected MCP server
@@ -1 +1 @@
1
- {"version":3,"file":"streamable-http-transport.d.ts","sourceRoot":"","sources":["../../../../../src/utils/transports/streamable-http-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAM1E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,uBAAwB,YAAW,SAAS;IAyDrD,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,KAAK,CAAC;IA3DhB;;;OAGG;IACH,OAAO,CAAC,SAAS,CAA8C;IAE/D;;;;OAIG;IACH,OAAO,CAAC,SAAS,CAAS;IAE1B;;;OAGG;IACH,OAAO,CAAC,WAAW,CAAC,CAAS;IAE7B;;;OAGG;IACH,OAAO,CAAC,aAAa,CAAC,CAAS;IAE/B;;;OAGG;IACI,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAErD;;;OAGG;IACI,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAExC;;;OAGG;IACI,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B;;;;;;;;;;;OAWG;gBAEO,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACpC,OAAO,GAAE,MAAc,EACvB,KAAK,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,YAAA,EAC/B,UAAU,CAAC,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM;IAMvB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA6G5B;;;;;;;;;;;;;;;;;;;OAmBG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAS5B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CA6BnD"}
1
+ {"version":3,"file":"streamable-http-transport.d.ts","sourceRoot":"","sources":["../../../../../src/utils/transports/streamable-http-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE1E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAIpF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,uBAAwB,YAAW,SAAS;IAyDrD,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,KAAK,CAAC;IACd,OAAO,CAAC,YAAY,CAAC;IA5DvB;;;OAGG;IACH,OAAO,CAAC,SAAS,CAA8C;IAE/D;;;;OAIG;IACH,OAAO,CAAC,SAAS,CAAS;IAE1B;;;OAGG;IACH,OAAO,CAAC,WAAW,CAAC,CAAS;IAE7B;;;OAGG;IACH,OAAO,CAAC,aAAa,CAAC,CAAS;IAE/B;;;OAGG;IACI,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAErD;;;OAGG;IACI,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAExC;;;OAGG;IACI,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B;;;;;;;;;;;OAWG;gBAEO,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACpC,OAAO,GAAE,MAAc,EACvB,KAAK,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,YAAA,EACvB,YAAY,CAAC,EAAE,mBAAmB,YAAA,EAC1C,UAAU,CAAC,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM;IAMvB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAsH5B;;;;;;;;;;;;;;;;;;;OAmBG;IACH;;OAEG;IACH,gBAAgB,IAAI,mBAAmB,GAAG,SAAS;IAInD;;OAEG;IACH,eAAe,IAAI,6BAA6B,GAAG,IAAI;IAIjD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAS5B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CA6BnD"}
@@ -32,6 +32,7 @@ export class StreamableHttpTransport {
32
32
  headers;
33
33
  timeout;
34
34
  proxy;
35
+ authProvider;
35
36
  /**
36
37
  * Internal reference to the underlying MCP SDK transport instance
37
38
  * @private
@@ -80,11 +81,12 @@ export class StreamableHttpTransport {
80
81
  * @param serverName - Optional server name for logging
81
82
  * @param compositeKey - Optional composite key (serverName-serverIndex) for logging
82
83
  */
83
- constructor(url, headers = {}, timeout = 30000, proxy, serverName, compositeKey) {
84
+ constructor(url, headers = {}, timeout = 30000, proxy, authProvider, serverName, compositeKey) {
84
85
  this.url = url;
85
86
  this.headers = headers;
86
87
  this.timeout = timeout;
87
88
  this.proxy = proxy;
89
+ this.authProvider = authProvider;
88
90
  this._serverName = serverName;
89
91
  this._compositeKey = compositeKey;
90
92
  }
@@ -151,6 +153,11 @@ export class StreamableHttpTransport {
151
153
  const transportOptions = {
152
154
  requestInit
153
155
  };
156
+ // Pass OAuth provider if configured
157
+ if (this.authProvider) {
158
+ transportOptions.authProvider = this.authProvider;
159
+ logger.info(this.formatLogMessage('Streamable HTTP transport configured with OAuth provider'), LOG_MODULES.HTTP_TRANSPORT);
160
+ }
154
161
  // Add proxy support if configured
155
162
  if (this.proxy?.url) {
156
163
  const agent = new ProxyAgent(this.proxy.url);
@@ -215,6 +222,18 @@ export class StreamableHttpTransport {
215
222
  * // Transport is now closed and cannot send/receive messages
216
223
  * ```
217
224
  */
225
+ /**
226
+ * Returns the OAuth provider if configured, for connection manager to handle auth flow.
227
+ */
228
+ getOAuthProvider() {
229
+ return this.authProvider;
230
+ }
231
+ /**
232
+ * Returns the underlying SDK transport for auth flow management.
233
+ */
234
+ getSdkTransport() {
235
+ return this.transport;
236
+ }
218
237
  async close() {
219
238
  this.isClosing = true;
220
239
  if (this.transport) {
@@ -1,4 +1,5 @@
1
1
  import type { ServerRuntimeConfig } from '../../../shared/models/server.model.js';
2
+ import { McpOAuthClientProvider } from '../../services/mcp-oauth/index.js';
2
3
  /**
3
4
  * Transport Factory - creates appropriate transport client based on server configuration
4
5
  */
@@ -16,6 +17,7 @@ export declare class TransportFactory {
16
17
  }, compositeKey?: string, options?: {
17
18
  readyPatterns?: string[];
18
19
  readyTimeout?: number;
20
+ authProvider?: McpOAuthClientProvider;
19
21
  }): import('@modelcontextprotocol/sdk/shared/transport.js').Transport;
20
22
  /**
21
23
  * Build system environment variables
@@ -1 +1 @@
1
- {"version":3,"file":"transport-factory.d.ts","sourceRoot":"","sources":["../../../../../src/utils/transports/transport-factory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAG1E;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;;;;;;OAOG;IACH,MAAM,CAAC,eAAe,CACpB,MAAM,EAAE,mBAAmB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAC9C,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;QACR,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;QACzB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GACA,OAAO,+CAA+C,EAAE,SAAS;IA+DpE;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAW7B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAW9B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,wBAAwB;CA8CxC"}
1
+ {"version":3,"file":"transport-factory.d.ts","sourceRoot":"","sources":["../../../../../src/utils/transports/transport-factory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAKtE;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;;;;;;OAOG;IACH,MAAM,CAAC,eAAe,CACpB,MAAM,EAAE,mBAAmB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAC9C,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;QACR,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;QACzB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,sBAAsB,CAAC;KACvC,GACA,OAAO,+CAA+C,EAAE,SAAS;IA4EpE;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAW7B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAW9B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,wBAAwB;CA8CxC"}
@@ -2,6 +2,10 @@ import { StdioTransport } from './stdio-transport.js';
2
2
  import { SseTransport } from './sse-transport.js';
3
3
  import { StreamableHttpTransport } from './streamable-http-transport.js';
4
4
  import { logStorage } from '../../services/log-storage.service.js';
5
+ import { McpOAuthClientProvider } from '../../services/mcp-oauth/index.js';
6
+ import { createHash } from 'node:crypto';
7
+ import path from 'node:path';
8
+ import os from 'node:os';
5
9
  /**
6
10
  * Transport Factory - creates appropriate transport client based on server configuration
7
11
  */
@@ -41,11 +45,22 @@ export class TransportFactory {
41
45
  }
42
46
  return new SseTransport(config.url, config.headers, config.reconnectInterval, config.maxReconnectAttempts, config.proxy, server.name, compositeKey);
43
47
  case 'streamable-http':
44
- case 'http': // Compatibility with http type, treat as streamable-http
48
+ case 'http': {
49
+ // Compatibility with http type, treat as streamable-http
45
50
  if (!config.url) {
46
51
  throw new Error('Streamable HTTP transport requires a URL');
47
52
  }
48
- return new StreamableHttpTransport(config.url, config.headers, config.timeout, config.proxy, server.name, compositeKey);
53
+ // Use existing authProvider if given, otherwise create one (SDK auto-discovers OAuth)
54
+ const authProvider = options?.authProvider ||
55
+ (() => {
56
+ const serverUrlHash = createHash('md5').update(config.url).digest('hex').slice(0, 16);
57
+ return new McpOAuthClientProvider({
58
+ serverUrlHash,
59
+ configDir: path.join(os.homedir(), '.mcp-hub-lite', 'oauth')
60
+ });
61
+ })();
62
+ return new StreamableHttpTransport(config.url, config.headers, config.timeout, config.proxy, authProvider, server.name, compositeKey);
63
+ }
49
64
  default:
50
65
  throw new Error(`Unsupported transport type: ${config.type || 'undefined'}`);
51
66
  }
@@ -22,6 +22,7 @@ export interface SseTransportConfig {
22
22
  url: string;
23
23
  };
24
24
  }
25
+ import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
25
26
  /**
26
27
  * Streamable HTTP transport configuration
27
28
  */
@@ -33,6 +34,7 @@ export interface StreamableHttpTransportConfig {
33
34
  proxy?: {
34
35
  url: string;
35
36
  };
37
+ authProvider?: OAuthClientProvider;
36
38
  }
37
39
  /**
38
40
  * Generic server configuration
@@ -1 +1 @@
1
- {"version":3,"file":"transport.interface.d.ts","sourceRoot":"","sources":["../../../../../src/utils/transports/transport.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,oBAAoB,GACpB,kBAAkB,GAClB,6BAA6B,CAAC"}
1
+ {"version":3,"file":"transport.interface.d.ts","sourceRoot":"","sources":["../../../../../src/utils/transports/transport.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,oBAAoB,GACpB,kBAAkB,GAClB,6BAA6B,CAAC"}