mulesoft-anypoint-cli-agent-fabric-plugin 1.0.11 → 1.1.1-beta

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 (288) hide show
  1. package/LICENSE.txt +89 -0
  2. package/README.md +51 -27
  3. package/dist/commands/agent-network/project/build.d.ts +1 -1
  4. package/dist/commands/agent-network/project/build.js +21 -14
  5. package/dist/commands/agent-network/project/build.js.map +1 -1
  6. package/dist/commands/agent-network/project/create.d.ts +4 -1
  7. package/dist/commands/agent-network/project/create.js +67 -39
  8. package/dist/commands/agent-network/project/create.js.map +1 -1
  9. package/dist/commands/agent-network/project/deploy.d.ts +8 -4
  10. package/dist/commands/agent-network/project/deploy.js +195 -78
  11. package/dist/commands/agent-network/project/deploy.js.map +1 -1
  12. package/dist/commands/agent-network/project/mcp/introspect.d.ts +226 -0
  13. package/dist/commands/agent-network/project/mcp/introspect.js +910 -0
  14. package/dist/commands/agent-network/project/mcp/introspect.js.map +1 -0
  15. package/dist/commands/agent-network/project/publish.d.ts +2 -4
  16. package/dist/commands/agent-network/project/publish.js +44 -50
  17. package/dist/commands/agent-network/project/publish.js.map +1 -1
  18. package/dist/commands/agent-network/project/undeploy.d.ts +29 -0
  19. package/dist/commands/agent-network/project/undeploy.js +142 -0
  20. package/dist/commands/agent-network/project/undeploy.js.map +1 -0
  21. package/dist/commands/agent-network/project/unpublish.d.ts +28 -0
  22. package/dist/commands/agent-network/project/unpublish.js +143 -0
  23. package/dist/commands/agent-network/project/unpublish.js.map +1 -0
  24. package/dist/commands/agent-network/setup/dependencies.js +11 -8
  25. package/dist/commands/agent-network/setup/dependencies.js.map +1 -1
  26. package/dist/commands/agent-network/setup/gateways.d.ts +10 -4
  27. package/dist/commands/agent-network/setup/gateways.js +160 -97
  28. package/dist/commands/agent-network/setup/gateways.js.map +1 -1
  29. package/dist/errors/base-error.js +5 -0
  30. package/dist/errors/base-error.js.map +1 -1
  31. package/dist/errors/error-factory.d.ts +80 -16
  32. package/dist/errors/error-factory.js +348 -69
  33. package/dist/errors/error-factory.js.map +1 -1
  34. package/dist/helpers/connection-id.js +6 -2
  35. package/dist/helpers/connection-id.js.map +1 -1
  36. package/dist/helpers/connection.d.ts +20 -0
  37. package/dist/helpers/connection.js +93 -0
  38. package/dist/helpers/connection.js.map +1 -0
  39. package/dist/helpers/dependency-manager.d.ts +2 -2
  40. package/dist/helpers/dependency-manager.js +18 -12
  41. package/dist/helpers/dependency-manager.js.map +1 -1
  42. package/dist/helpers/entitlement-utils.js +8 -3
  43. package/dist/helpers/entitlement-utils.js.map +1 -1
  44. package/dist/helpers/policy-helper.d.ts +27 -29
  45. package/dist/helpers/policy-helper.js +125 -55
  46. package/dist/helpers/policy-helper.js.map +1 -1
  47. package/dist/helpers/project/api-project-dependency-fetcher.js +18 -14
  48. package/dist/helpers/project/api-project-dependency-fetcher.js.map +1 -1
  49. package/dist/helpers/project/constants.d.ts +4 -4
  50. package/dist/helpers/project/constants.js +10 -3
  51. package/dist/helpers/project/constants.js.map +1 -1
  52. package/dist/helpers/project/debug-messages.js +5 -0
  53. package/dist/helpers/project/debug-messages.js.map +1 -1
  54. package/dist/helpers/project/templates.js +6 -1
  55. package/dist/helpers/project/templates.js.map +1 -1
  56. package/dist/helpers/project/uris.js +5 -0
  57. package/dist/helpers/project/uris.js.map +1 -1
  58. package/dist/helpers/project/validation-commons.d.ts +4 -0
  59. package/dist/helpers/project/validation-commons.js +33 -5
  60. package/dist/helpers/project/validation-commons.js.map +1 -1
  61. package/dist/helpers/request-logging.d.ts +36 -0
  62. package/dist/helpers/request-logging.js +185 -0
  63. package/dist/helpers/request-logging.js.map +1 -0
  64. package/dist/helpers/request-utils.d.ts +1 -1
  65. package/dist/helpers/request-utils.js +6 -1
  66. package/dist/helpers/request-utils.js.map +1 -1
  67. package/dist/helpers/types.js +5 -0
  68. package/dist/helpers/types.js.map +1 -1
  69. package/dist/helpers/utils.d.ts +23 -15
  70. package/dist/helpers/utils.js +206 -104
  71. package/dist/helpers/utils.js.map +1 -1
  72. package/dist/index.d.ts +3 -0
  73. package/dist/index.js +18 -9
  74. package/dist/index.js.map +1 -1
  75. package/dist/resources/mcp-server-schema.json +574 -0
  76. package/dist/types/agent-network-v2.d.ts +379 -0
  77. package/dist/types/agent-network-v2.js +28 -0
  78. package/dist/types/agent-network-v2.js.map +1 -0
  79. package/dist/types/agent-network.d.ts +226 -219
  80. package/dist/types/agent-network.js +16 -14
  81. package/dist/types/agent-network.js.map +1 -1
  82. package/dist/types/types.d.ts +57 -17
  83. package/dist/types/types.js +5 -0
  84. package/dist/types/types.js.map +1 -1
  85. package/dist/utils/access-management.js +7 -1
  86. package/dist/utils/access-management.js.map +1 -1
  87. package/dist/utils/builders/builder.d.ts +12 -0
  88. package/dist/utils/builders/builder.js +215 -11
  89. package/dist/utils/builders/builder.js.map +1 -1
  90. package/dist/utils/builders/common/agent-metadata.d.ts +21 -0
  91. package/dist/utils/builders/common/agent-metadata.js +73 -0
  92. package/dist/utils/builders/common/agent-metadata.js.map +1 -0
  93. package/dist/utils/builders/common/asset-file-resolver.d.ts +3 -0
  94. package/dist/utils/builders/common/asset-file-resolver.js +33 -0
  95. package/dist/utils/builders/common/asset-file-resolver.js.map +1 -0
  96. package/dist/utils/builders/common/connection-facet-helpers.d.ts +26 -0
  97. package/dist/utils/builders/common/connection-facet-helpers.js +47 -0
  98. package/dist/utils/builders/common/connection-facet-helpers.js.map +1 -0
  99. package/dist/utils/builders/common/connection-metadata.d.ts +5 -0
  100. package/dist/utils/builders/common/connection-metadata.js +25 -0
  101. package/dist/utils/builders/common/connection-metadata.js.map +1 -0
  102. package/dist/utils/builders/common/network-builder-helpers.d.ts +7 -0
  103. package/dist/utils/builders/common/network-builder-helpers.js +25 -0
  104. package/dist/utils/builders/common/network-builder-helpers.js.map +1 -0
  105. package/dist/utils/builders/common/network-metadata.d.ts +5 -0
  106. package/dist/utils/builders/common/network-metadata.js +26 -0
  107. package/dist/utils/builders/common/network-metadata.js.map +1 -0
  108. package/dist/utils/builders/common/registry-entry.d.ts +2 -0
  109. package/dist/utils/builders/common/registry-entry.js +21 -0
  110. package/dist/utils/builders/common/registry-entry.js.map +1 -0
  111. package/dist/utils/builders/common/types.d.ts +38 -0
  112. package/dist/utils/builders/common/types.js +8 -0
  113. package/dist/utils/builders/common/types.js.map +1 -0
  114. package/dist/utils/builders/network-lock.d.ts +38 -0
  115. package/dist/utils/builders/network-lock.js +108 -0
  116. package/dist/utils/builders/network-lock.js.map +1 -0
  117. package/dist/utils/builders/policies-factory.d.ts +8 -1
  118. package/dist/utils/builders/policies-factory.js +43 -10
  119. package/dist/utils/builders/policies-factory.js.map +1 -1
  120. package/dist/utils/builders/project-builder-impl.d.ts +70 -17
  121. package/dist/utils/builders/project-builder-impl.js +189 -28
  122. package/dist/utils/builders/project-builder-impl.js.map +1 -1
  123. package/dist/utils/builders/project-builder.d.ts +75 -11
  124. package/dist/utils/builders/project-builder.js +18 -3
  125. package/dist/utils/builders/project-builder.js.map +1 -1
  126. package/dist/utils/builders/remote-space-resolver.d.ts +21 -0
  127. package/dist/utils/builders/remote-space-resolver.js +232 -0
  128. package/dist/utils/builders/remote-space-resolver.js.map +1 -0
  129. package/dist/utils/builders/space-serializer.d.ts +16 -2
  130. package/dist/utils/builders/space-serializer.js +136 -29
  131. package/dist/utils/builders/space-serializer.js.map +1 -1
  132. package/dist/utils/builders/tooling-metadata.d.ts +8 -0
  133. package/dist/utils/builders/tooling-metadata.js +69 -0
  134. package/dist/utils/builders/tooling-metadata.js.map +1 -0
  135. package/dist/utils/builders/v1/agent-builder.d.ts +15 -0
  136. package/dist/utils/builders/v1/agent-builder.js +78 -0
  137. package/dist/utils/builders/v1/agent-builder.js.map +1 -0
  138. package/dist/utils/builders/{broker-builder.d.ts → v1/broker-builder.d.ts} +8 -1
  139. package/dist/utils/builders/v1/broker-builder.js +259 -0
  140. package/dist/utils/builders/v1/broker-builder.js.map +1 -0
  141. package/dist/utils/builders/{connections-builder.d.ts → v1/connections-builder.d.ts} +4 -3
  142. package/dist/utils/builders/v1/connections-builder.js +189 -0
  143. package/dist/utils/builders/v1/connections-builder.js.map +1 -0
  144. package/dist/utils/builders/{llm-builder.d.ts → v1/llm-builder.d.ts} +5 -2
  145. package/dist/utils/builders/v1/llm-builder.js +76 -0
  146. package/dist/utils/builders/v1/llm-builder.js.map +1 -0
  147. package/dist/utils/builders/{mcp-builder.d.ts → v1/mcp-builder.d.ts} +5 -2
  148. package/dist/utils/builders/v1/mcp-builder.js +64 -0
  149. package/dist/utils/builders/v1/mcp-builder.js.map +1 -0
  150. package/dist/utils/builders/{network-builder.d.ts → v1/network-builder.d.ts} +2 -1
  151. package/dist/utils/builders/v1/network-builder.js +79 -0
  152. package/dist/utils/builders/v1/network-builder.js.map +1 -0
  153. package/dist/utils/builders/{path.d.ts → v1/path.d.ts} +1 -1
  154. package/dist/utils/builders/{path.js → v1/path.js} +6 -1
  155. package/dist/utils/builders/v1/path.js.map +1 -0
  156. package/dist/utils/builders/v2/agent-builder.d.ts +17 -0
  157. package/dist/utils/builders/v2/agent-builder.js +142 -0
  158. package/dist/utils/builders/v2/agent-builder.js.map +1 -0
  159. package/dist/utils/builders/v2/broker-builder.d.ts +21 -0
  160. package/dist/utils/builders/v2/broker-builder.js +168 -0
  161. package/dist/utils/builders/v2/broker-builder.js.map +1 -0
  162. package/dist/utils/builders/v2/connections-builder.d.ts +18 -0
  163. package/dist/utils/builders/v2/connections-builder.js +196 -0
  164. package/dist/utils/builders/v2/connections-builder.js.map +1 -0
  165. package/dist/utils/builders/v2/llm-builder.d.ts +11 -0
  166. package/dist/utils/builders/v2/llm-builder.js +68 -0
  167. package/dist/utils/builders/v2/llm-builder.js.map +1 -0
  168. package/dist/utils/builders/v2/mcp-builder.d.ts +10 -0
  169. package/dist/utils/builders/v2/mcp-builder.js +66 -0
  170. package/dist/utils/builders/v2/mcp-builder.js.map +1 -0
  171. package/dist/utils/builders/v2/network-builder.d.ts +14 -0
  172. package/dist/utils/builders/v2/network-builder.js +123 -0
  173. package/dist/utils/builders/v2/network-builder.js.map +1 -0
  174. package/dist/utils/builders/v2/path.d.ts +12 -0
  175. package/dist/utils/builders/v2/path.js +46 -0
  176. package/dist/utils/builders/v2/path.js.map +1 -0
  177. package/dist/utils/constants.d.ts +42 -2
  178. package/dist/utils/constants.js +61 -5
  179. package/dist/utils/constants.js.map +1 -1
  180. package/dist/utils/exchange.d.ts +5 -6
  181. package/dist/utils/exchange.js +83 -73
  182. package/dist/utils/exchange.js.map +1 -1
  183. package/dist/utils/facets/abstract-facet.d.ts +4 -28
  184. package/dist/utils/facets/abstract-facet.js +10 -29
  185. package/dist/utils/facets/abstract-facet.js.map +1 -1
  186. package/dist/utils/facets/agent-graph-facet.d.ts +17 -0
  187. package/dist/utils/facets/agent-graph-facet.js +276 -0
  188. package/dist/utils/facets/agent-graph-facet.js.map +1 -0
  189. package/dist/utils/facets/api-instance-facet.d.ts +4 -2
  190. package/dist/utils/facets/api-instance-facet.js +54 -32
  191. package/dist/utils/facets/api-instance-facet.js.map +1 -1
  192. package/dist/utils/facets/apim-policy-helpers.d.ts +24 -0
  193. package/dist/utils/facets/apim-policy-helpers.js +43 -0
  194. package/dist/utils/facets/apim-policy-helpers.js.map +1 -0
  195. package/dist/utils/facets/asset-facet.d.ts +7 -3
  196. package/dist/utils/facets/asset-facet.js +158 -82
  197. package/dist/utils/facets/asset-facet.js.map +1 -1
  198. package/dist/utils/facets/connection-facet.d.ts +4 -2
  199. package/dist/utils/facets/connection-facet.js +54 -32
  200. package/dist/utils/facets/connection-facet.js.map +1 -1
  201. package/dist/utils/facets/deployment-helpers.d.ts +28 -1
  202. package/dist/utils/facets/deployment-helpers.js +87 -4
  203. package/dist/utils/facets/deployment-helpers.js.map +1 -1
  204. package/dist/utils/facets/deployment-runner.d.ts +12 -0
  205. package/dist/utils/facets/deployment-runner.js +62 -0
  206. package/dist/utils/facets/deployment-runner.js.map +1 -0
  207. package/dist/utils/facets/facets.d.ts +4 -0
  208. package/dist/utils/facets/facets.js +98 -7
  209. package/dist/utils/facets/facets.js.map +1 -1
  210. package/dist/utils/facets/mule-application-facet.d.ts +3 -7
  211. package/dist/utils/facets/mule-application-facet.js +54 -85
  212. package/dist/utils/facets/mule-application-facet.js.map +1 -1
  213. package/dist/utils/facets/publication-metadata-patcher.d.ts +2 -0
  214. package/dist/utils/facets/publication-metadata-patcher.js +68 -0
  215. package/dist/utils/facets/publication-metadata-patcher.js.map +1 -0
  216. package/dist/utils/facets/publication-rank.d.ts +4 -0
  217. package/dist/utils/facets/publication-rank.js +33 -0
  218. package/dist/utils/facets/publication-rank.js.map +1 -0
  219. package/dist/utils/facets/undeploy-helpers.d.ts +6 -0
  220. package/dist/utils/facets/undeploy-helpers.js +73 -0
  221. package/dist/utils/facets/undeploy-helpers.js.map +1 -0
  222. package/dist/utils/facets/unpublish-preflight.d.ts +2 -0
  223. package/dist/utils/facets/unpublish-preflight.js +59 -0
  224. package/dist/utils/facets/unpublish-preflight.js.map +1 -0
  225. package/dist/utils/files.d.ts +0 -1
  226. package/dist/utils/files.js +15 -2
  227. package/dist/utils/files.js.map +1 -1
  228. package/dist/utils/gateway-mode.d.ts +22 -0
  229. package/dist/utils/gateway-mode.js +43 -0
  230. package/dist/utils/gateway-mode.js.map +1 -0
  231. package/dist/utils/gateway.d.ts +24 -6
  232. package/dist/utils/gateway.js +115 -35
  233. package/dist/utils/gateway.js.map +1 -1
  234. package/dist/utils/logger.d.ts +1 -0
  235. package/dist/utils/logger.js +25 -14
  236. package/dist/utils/logger.js.map +1 -1
  237. package/dist/utils/mcp/mcp-metadata-mapper.d.ts +26 -0
  238. package/dist/utils/mcp/mcp-metadata-mapper.js +58 -0
  239. package/dist/utils/mcp/mcp-metadata-mapper.js.map +1 -0
  240. package/dist/utils/mcp/project-registrar.d.ts +21 -0
  241. package/dist/utils/mcp/project-registrar.js +96 -0
  242. package/dist/utils/mcp/project-registrar.js.map +1 -0
  243. package/dist/utils/mcp/registry-key.d.ts +7 -0
  244. package/dist/utils/mcp/registry-key.js +72 -0
  245. package/dist/utils/mcp/registry-key.js.map +1 -0
  246. package/dist/utils/naming.js +7 -3
  247. package/dist/utils/naming.js.map +1 -1
  248. package/dist/utils/promise/promiseCreator.js +5 -0
  249. package/dist/utils/promise/promiseCreator.js.map +1 -1
  250. package/dist/utils/report/junit-report.js +5 -0
  251. package/dist/utils/report/junit-report.js.map +1 -1
  252. package/dist/utils/report/validation-report.js +5 -0
  253. package/dist/utils/report/validation-report.js.map +1 -1
  254. package/dist/utils/request-executor.d.ts +17 -0
  255. package/dist/utils/request-executor.js +121 -0
  256. package/dist/utils/request-executor.js.map +1 -0
  257. package/dist/utils/uris.d.ts +4 -4
  258. package/dist/utils/uris.js +19 -6
  259. package/dist/utils/uris.js.map +1 -1
  260. package/dist/utils/variables.d.ts +3 -4
  261. package/dist/utils/variables.js +25 -9
  262. package/dist/utils/variables.js.map +1 -1
  263. package/dist/utils/zip-utils.d.ts +8 -0
  264. package/dist/utils/zip-utils.js +24 -0
  265. package/dist/utils/zip-utils.js.map +1 -0
  266. package/package.json +22 -11
  267. package/scripts/resolve-version.sh +89 -0
  268. package/scripts/resolve-version.test.sh +81 -0
  269. package/scripts/test-publish-npm.sh +130 -0
  270. package/templates/{agent-network.yaml.template → agent-network/agent-network.yaml.template} +1 -1
  271. package/templates/{exchange.json.template → agent-network/exchange.json.template} +1 -0
  272. package/templates/agentic-network/agent-network.yaml.template +93 -0
  273. package/templates/agentic-network/brokers/broker1.agent.template +102 -0
  274. package/templates/agentic-network/exchange.json.template +37 -0
  275. package/dist/utils/builders/agent-builder.d.ts +0 -11
  276. package/dist/utils/builders/agent-builder.js +0 -79
  277. package/dist/utils/builders/agent-builder.js.map +0 -1
  278. package/dist/utils/builders/broker-builder.js +0 -292
  279. package/dist/utils/builders/broker-builder.js.map +0 -1
  280. package/dist/utils/builders/connections-builder.js +0 -233
  281. package/dist/utils/builders/connections-builder.js.map +0 -1
  282. package/dist/utils/builders/llm-builder.js +0 -64
  283. package/dist/utils/builders/llm-builder.js.map +0 -1
  284. package/dist/utils/builders/mcp-builder.js +0 -48
  285. package/dist/utils/builders/mcp-builder.js.map +0 -1
  286. package/dist/utils/builders/network-builder.js +0 -77
  287. package/dist/utils/builders/network-builder.js.map +0 -1
  288. package/dist/utils/builders/path.js.map +0 -1
@@ -0,0 +1,226 @@
1
+ import { Command } from '@oclif/core';
2
+ import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
3
+ import { OAuthClientMetadata, OAuthClientInformation, OAuthClientInformationFull, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
4
+ import * as url from 'node:url';
5
+ declare const TRANSPORT_STREAMABLE_HTTP = "streamable-http";
6
+ /**
7
+ * Escapes the five HTML-significant characters so untrusted values can be
8
+ * safely embedded in an HTML response body. The OAuth `error` and
9
+ * `error_description` query parameters come from the authorization server
10
+ * (RFC 6749 §4.1.2.1 allows arbitrary text) and from the query string, so
11
+ * both are untrusted. Without escaping they enable XSS at the loopback
12
+ * origin (http://127.0.0.1:3000).
13
+ */
14
+ export declare function escapeHtml(value: string): string;
15
+ /**
16
+ * Creates a temporary HTTP server to receive the OAuth callback
17
+ */
18
+ export declare class CallbackServer {
19
+ private server?;
20
+ private readonly port;
21
+ constructor(port?: number);
22
+ /**
23
+ * Starts the server and waits for the OAuth callback
24
+ * Returns the authorization code and state or throws on timeout/error
25
+ */
26
+ waitForCallback(timeoutMs?: number): Promise<{
27
+ code: string;
28
+ state?: string;
29
+ }>;
30
+ close(): void;
31
+ }
32
+ /**
33
+ * Data structure for OAuth session storage
34
+ */
35
+ export interface OAuthSession {
36
+ clientInformation?: OAuthClientInformation | OAuthClientInformationFull;
37
+ tokens?: OAuthTokens;
38
+ codeVerifier?: string;
39
+ state?: string;
40
+ }
41
+ /**
42
+ * Storage interface for OAuth data (allows mocking in tests)
43
+ */
44
+ export interface OAuthStorage {
45
+ getSession(sessionId: string): OAuthSession | undefined;
46
+ saveSession(sessionId: string, session: OAuthSession): void;
47
+ clearSession(sessionId: string): void;
48
+ }
49
+ /**
50
+ * Default storage implementation using the conf library via anypoint-cli-command
51
+ */
52
+ export declare class ConfOAuthStorage implements OAuthStorage {
53
+ getSession(sessionId: string): OAuthSession | undefined;
54
+ saveSession(sessionId: string, session: OAuthSession): void;
55
+ clearSession(sessionId: string): void;
56
+ }
57
+ /**
58
+ * CLI OAuth Provider implementation for MCP authentication
59
+ * Implements the OAuth 2.1 Authorization Code flow with PKCE
60
+ */
61
+ export declare class CLIOAuthProvider implements OAuthClientProvider {
62
+ private readonly sessionId;
63
+ private readonly _redirectUrl;
64
+ private readonly _clientName;
65
+ private readonly callbackServer;
66
+ private authorizationCodePromise?;
67
+ private readonly storage;
68
+ constructor(serverUrl: string, clientName: string, storage?: OAuthStorage, redirectUrl?: string, callbackServer?: CallbackServer);
69
+ get redirectUrl(): string | URL;
70
+ get clientMetadata(): OAuthClientMetadata;
71
+ private getSession;
72
+ private updateSession;
73
+ clientInformation(): OAuthClientInformation | undefined;
74
+ saveClientInformation(clientInformation: OAuthClientInformationFull): void;
75
+ tokens(): OAuthTokens | undefined;
76
+ saveTokens(tokens: OAuthTokens): void;
77
+ redirectToAuthorization(authorizationUrl: URL): Promise<void>;
78
+ saveCodeVerifier(codeVerifier: string): void;
79
+ codeVerifier(): string;
80
+ state(): string;
81
+ invalidateCredentials(): void;
82
+ /**
83
+ * Returns the authorization code received from the callback
84
+ */
85
+ getAuthorizationCode(): Promise<string | undefined>;
86
+ cleanup(): void;
87
+ private openBrowser;
88
+ }
89
+ /**
90
+ * Checks if an error indicates OAuth authentication is required (HTTP 401).
91
+ * Only returns true for explicit 401 status codes on structured error objects.
92
+ */
93
+ export declare function isOAuthRequired(error: {
94
+ message?: string;
95
+ status?: number;
96
+ code?: number;
97
+ response?: {
98
+ status?: number;
99
+ };
100
+ }): boolean;
101
+ /**
102
+ * Builds the full MCP endpoint URL from base URL and transport path.
103
+ * If the base URL already contains the transport path, it is returned as-is
104
+ * (preserving any trailing slash the user provided, which may be required
105
+ * by some servers).
106
+ * Otherwise, the transport path is appended to the base URL.
107
+ */
108
+ export declare function buildMcpUrl(baseUrl: string, transportPath: string): string;
109
+ /**
110
+ * Checks if the current Node.js version supports OAuth crypto requirements
111
+ */
112
+ export declare function isNodeVersionSupported(version?: string): boolean;
113
+ export type AuthType = 'none' | 'bearer' | 'apikey';
114
+ /**
115
+ * Platform-specific argv to open a URL in the default browser.
116
+ * Returned as { command, args } so callers can invoke it via spawn
117
+ * without a shell — critical because the URL may be attacker-controlled
118
+ * (OAuth authorization URL sourced from a remote MCP server's discovery
119
+ * document). Using a shell string would allow $() and backtick injection.
120
+ * Exported for testing.
121
+ */
122
+ export declare function browserOpenArgs(targetUrl: string, platform: NodeJS.Platform): {
123
+ command: string;
124
+ args: string[];
125
+ };
126
+ /**
127
+ * Builds the authentication header for the MCP request.
128
+ *
129
+ * - bearer: sets "<header>: Bearer <value>" (default header: Authorization)
130
+ * - apikey: sets "<header>: <value>" (default header: x-api-key)
131
+ * - none: returns an empty object
132
+ */
133
+ export declare function buildAuthHeaders(authType: AuthType, authValue?: string, authHeader?: string): Record<string, string>;
134
+ /**
135
+ * Signature of the MCP SDK's auth() entry point, narrowed to the call shape
136
+ * we use. Exposed as a parameter type so tests can pass in a stub.
137
+ */
138
+ export type AuthFn = (provider: OAuthClientProvider, options: {
139
+ serverUrl: string | URL;
140
+ authorizationCode?: string;
141
+ }) => Promise<'AUTHORIZED' | 'REDIRECT'>;
142
+ /**
143
+ * Attempts a silent token refresh via the provided auth() function. Returns
144
+ * the refreshed access token on success, or `undefined` if refresh is not
145
+ * possible (no refresh token, server rejected the refresh, etc.). The caller
146
+ * is responsible for falling back to an interactive browser flow when this
147
+ * returns `undefined`.
148
+ *
149
+ * Extracted so the token-refresh decision tree is unit-testable without an
150
+ * oclif test harness or a real OAuth server.
151
+ */
152
+ export declare function attemptSilentRefresh(provider: {
153
+ tokens(): OAuthTokens | undefined | Promise<OAuthTokens | undefined>;
154
+ } & OAuthClientProvider, serverUrl: string, authFn: AuthFn): Promise<string | undefined>;
155
+ /**
156
+ * Remote transport type as defined by the MCP server schema. These
157
+ * values are also the accepted options for the --transport flag so
158
+ * that users see the same identifiers throughout the tool.
159
+ */
160
+ export type RemoteTransport = typeof TRANSPORT_STREAMABLE_HTTP | 'sse';
161
+ export declare const REMOTE_TRANSPORTS: readonly RemoteTransport[];
162
+ export interface ServerJsonRemote {
163
+ type: RemoteTransport;
164
+ url: string;
165
+ headers?: unknown;
166
+ }
167
+ export interface ServerJson {
168
+ name: string;
169
+ description: string;
170
+ version: string;
171
+ title?: string;
172
+ websiteUrl?: string;
173
+ remotes?: ServerJsonRemote[];
174
+ }
175
+ /**
176
+ * Loads the bundled MCP server schema. The file is committed to
177
+ * src/resources/mcp-server-schema.json and copied to dist/resources
178
+ * as part of the build.
179
+ */
180
+ export declare function loadMcpServerSchema(schemaPath?: string): object;
181
+ /**
182
+ * Validates a server.json object against the MCP server schema.
183
+ * Throws an Error with a formatted message on validation failure.
184
+ */
185
+ export declare function validateServerJson(data: unknown, schema?: object): ServerJson;
186
+ /**
187
+ * Picks the remote to use from a server.json and returns both the URL
188
+ * and the transport. Rules:
189
+ * - If remotes is missing or empty, throws.
190
+ * - If exactly one remote is present, uses it (ignores requestedTransport).
191
+ * - If multiple remotes are present, requestedTransport is required and
192
+ * must match one of them.
193
+ */
194
+ export declare function resolveRemoteFromServerJson(server: ServerJson, requestedTransport: RemoteTransport | undefined): {
195
+ url: string;
196
+ transport: RemoteTransport;
197
+ };
198
+ /**
199
+ * Reads, parses, and validates a server.json file from disk.
200
+ */
201
+ export declare function loadServerJson(filePath: string): ServerJson;
202
+ export default class Introspect extends Command {
203
+ static description: string;
204
+ static examples: string[];
205
+ static hidden: boolean;
206
+ static flags: {
207
+ url: import("@oclif/core/lib/interfaces").OptionFlag<url.URL | undefined>;
208
+ 'server-json': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
209
+ transport: import("@oclif/core/lib/interfaces").OptionFlag<string>;
210
+ 'transport-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
211
+ output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
212
+ format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
213
+ 'oauth-reset': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
214
+ 'auth-type': import("@oclif/core/lib/interfaces").OptionFlag<string>;
215
+ 'auth-value': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
216
+ 'auth-header': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
217
+ path: import("@oclif/core/lib/interfaces").OptionFlag<string>;
218
+ name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
219
+ };
220
+ run(): Promise<void>;
221
+ private handleOAuthFlow;
222
+ private connectWithToken;
223
+ private safeList;
224
+ private connectAndIntrospect;
225
+ }
226
+ export {};