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.
- package/LICENSE.txt +89 -0
- package/README.md +51 -27
- package/dist/commands/agent-network/project/build.d.ts +1 -1
- package/dist/commands/agent-network/project/build.js +21 -14
- package/dist/commands/agent-network/project/build.js.map +1 -1
- package/dist/commands/agent-network/project/create.d.ts +4 -1
- package/dist/commands/agent-network/project/create.js +67 -39
- package/dist/commands/agent-network/project/create.js.map +1 -1
- package/dist/commands/agent-network/project/deploy.d.ts +8 -4
- package/dist/commands/agent-network/project/deploy.js +195 -78
- package/dist/commands/agent-network/project/deploy.js.map +1 -1
- package/dist/commands/agent-network/project/mcp/introspect.d.ts +226 -0
- package/dist/commands/agent-network/project/mcp/introspect.js +910 -0
- package/dist/commands/agent-network/project/mcp/introspect.js.map +1 -0
- package/dist/commands/agent-network/project/publish.d.ts +2 -4
- package/dist/commands/agent-network/project/publish.js +44 -50
- package/dist/commands/agent-network/project/publish.js.map +1 -1
- package/dist/commands/agent-network/project/undeploy.d.ts +29 -0
- package/dist/commands/agent-network/project/undeploy.js +142 -0
- package/dist/commands/agent-network/project/undeploy.js.map +1 -0
- package/dist/commands/agent-network/project/unpublish.d.ts +28 -0
- package/dist/commands/agent-network/project/unpublish.js +143 -0
- package/dist/commands/agent-network/project/unpublish.js.map +1 -0
- package/dist/commands/agent-network/setup/dependencies.js +11 -8
- package/dist/commands/agent-network/setup/dependencies.js.map +1 -1
- package/dist/commands/agent-network/setup/gateways.d.ts +10 -4
- package/dist/commands/agent-network/setup/gateways.js +160 -97
- package/dist/commands/agent-network/setup/gateways.js.map +1 -1
- package/dist/errors/base-error.js +5 -0
- package/dist/errors/base-error.js.map +1 -1
- package/dist/errors/error-factory.d.ts +80 -16
- package/dist/errors/error-factory.js +348 -69
- package/dist/errors/error-factory.js.map +1 -1
- package/dist/helpers/connection-id.js +6 -2
- package/dist/helpers/connection-id.js.map +1 -1
- package/dist/helpers/connection.d.ts +20 -0
- package/dist/helpers/connection.js +93 -0
- package/dist/helpers/connection.js.map +1 -0
- package/dist/helpers/dependency-manager.d.ts +2 -2
- package/dist/helpers/dependency-manager.js +18 -12
- package/dist/helpers/dependency-manager.js.map +1 -1
- package/dist/helpers/entitlement-utils.js +8 -3
- package/dist/helpers/entitlement-utils.js.map +1 -1
- package/dist/helpers/policy-helper.d.ts +27 -29
- package/dist/helpers/policy-helper.js +125 -55
- package/dist/helpers/policy-helper.js.map +1 -1
- package/dist/helpers/project/api-project-dependency-fetcher.js +18 -14
- package/dist/helpers/project/api-project-dependency-fetcher.js.map +1 -1
- package/dist/helpers/project/constants.d.ts +4 -4
- package/dist/helpers/project/constants.js +10 -3
- package/dist/helpers/project/constants.js.map +1 -1
- package/dist/helpers/project/debug-messages.js +5 -0
- package/dist/helpers/project/debug-messages.js.map +1 -1
- package/dist/helpers/project/templates.js +6 -1
- package/dist/helpers/project/templates.js.map +1 -1
- package/dist/helpers/project/uris.js +5 -0
- package/dist/helpers/project/uris.js.map +1 -1
- package/dist/helpers/project/validation-commons.d.ts +4 -0
- package/dist/helpers/project/validation-commons.js +33 -5
- package/dist/helpers/project/validation-commons.js.map +1 -1
- package/dist/helpers/request-logging.d.ts +36 -0
- package/dist/helpers/request-logging.js +185 -0
- package/dist/helpers/request-logging.js.map +1 -0
- package/dist/helpers/request-utils.d.ts +1 -1
- package/dist/helpers/request-utils.js +6 -1
- package/dist/helpers/request-utils.js.map +1 -1
- package/dist/helpers/types.js +5 -0
- package/dist/helpers/types.js.map +1 -1
- package/dist/helpers/utils.d.ts +23 -15
- package/dist/helpers/utils.js +206 -104
- package/dist/helpers/utils.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/dist/resources/mcp-server-schema.json +574 -0
- package/dist/types/agent-network-v2.d.ts +379 -0
- package/dist/types/agent-network-v2.js +28 -0
- package/dist/types/agent-network-v2.js.map +1 -0
- package/dist/types/agent-network.d.ts +226 -219
- package/dist/types/agent-network.js +16 -14
- package/dist/types/agent-network.js.map +1 -1
- package/dist/types/types.d.ts +57 -17
- package/dist/types/types.js +5 -0
- package/dist/types/types.js.map +1 -1
- package/dist/utils/access-management.js +7 -1
- package/dist/utils/access-management.js.map +1 -1
- package/dist/utils/builders/builder.d.ts +12 -0
- package/dist/utils/builders/builder.js +215 -11
- package/dist/utils/builders/builder.js.map +1 -1
- package/dist/utils/builders/common/agent-metadata.d.ts +21 -0
- package/dist/utils/builders/common/agent-metadata.js +73 -0
- package/dist/utils/builders/common/agent-metadata.js.map +1 -0
- package/dist/utils/builders/common/asset-file-resolver.d.ts +3 -0
- package/dist/utils/builders/common/asset-file-resolver.js +33 -0
- package/dist/utils/builders/common/asset-file-resolver.js.map +1 -0
- package/dist/utils/builders/common/connection-facet-helpers.d.ts +26 -0
- package/dist/utils/builders/common/connection-facet-helpers.js +47 -0
- package/dist/utils/builders/common/connection-facet-helpers.js.map +1 -0
- package/dist/utils/builders/common/connection-metadata.d.ts +5 -0
- package/dist/utils/builders/common/connection-metadata.js +25 -0
- package/dist/utils/builders/common/connection-metadata.js.map +1 -0
- package/dist/utils/builders/common/network-builder-helpers.d.ts +7 -0
- package/dist/utils/builders/common/network-builder-helpers.js +25 -0
- package/dist/utils/builders/common/network-builder-helpers.js.map +1 -0
- package/dist/utils/builders/common/network-metadata.d.ts +5 -0
- package/dist/utils/builders/common/network-metadata.js +26 -0
- package/dist/utils/builders/common/network-metadata.js.map +1 -0
- package/dist/utils/builders/common/registry-entry.d.ts +2 -0
- package/dist/utils/builders/common/registry-entry.js +21 -0
- package/dist/utils/builders/common/registry-entry.js.map +1 -0
- package/dist/utils/builders/common/types.d.ts +38 -0
- package/dist/utils/builders/common/types.js +8 -0
- package/dist/utils/builders/common/types.js.map +1 -0
- package/dist/utils/builders/network-lock.d.ts +38 -0
- package/dist/utils/builders/network-lock.js +108 -0
- package/dist/utils/builders/network-lock.js.map +1 -0
- package/dist/utils/builders/policies-factory.d.ts +8 -1
- package/dist/utils/builders/policies-factory.js +43 -10
- package/dist/utils/builders/policies-factory.js.map +1 -1
- package/dist/utils/builders/project-builder-impl.d.ts +70 -17
- package/dist/utils/builders/project-builder-impl.js +189 -28
- package/dist/utils/builders/project-builder-impl.js.map +1 -1
- package/dist/utils/builders/project-builder.d.ts +75 -11
- package/dist/utils/builders/project-builder.js +18 -3
- package/dist/utils/builders/project-builder.js.map +1 -1
- package/dist/utils/builders/remote-space-resolver.d.ts +21 -0
- package/dist/utils/builders/remote-space-resolver.js +232 -0
- package/dist/utils/builders/remote-space-resolver.js.map +1 -0
- package/dist/utils/builders/space-serializer.d.ts +16 -2
- package/dist/utils/builders/space-serializer.js +136 -29
- package/dist/utils/builders/space-serializer.js.map +1 -1
- package/dist/utils/builders/tooling-metadata.d.ts +8 -0
- package/dist/utils/builders/tooling-metadata.js +69 -0
- package/dist/utils/builders/tooling-metadata.js.map +1 -0
- package/dist/utils/builders/v1/agent-builder.d.ts +15 -0
- package/dist/utils/builders/v1/agent-builder.js +78 -0
- package/dist/utils/builders/v1/agent-builder.js.map +1 -0
- package/dist/utils/builders/{broker-builder.d.ts → v1/broker-builder.d.ts} +8 -1
- package/dist/utils/builders/v1/broker-builder.js +259 -0
- package/dist/utils/builders/v1/broker-builder.js.map +1 -0
- package/dist/utils/builders/{connections-builder.d.ts → v1/connections-builder.d.ts} +4 -3
- package/dist/utils/builders/v1/connections-builder.js +189 -0
- package/dist/utils/builders/v1/connections-builder.js.map +1 -0
- package/dist/utils/builders/{llm-builder.d.ts → v1/llm-builder.d.ts} +5 -2
- package/dist/utils/builders/v1/llm-builder.js +76 -0
- package/dist/utils/builders/v1/llm-builder.js.map +1 -0
- package/dist/utils/builders/{mcp-builder.d.ts → v1/mcp-builder.d.ts} +5 -2
- package/dist/utils/builders/v1/mcp-builder.js +64 -0
- package/dist/utils/builders/v1/mcp-builder.js.map +1 -0
- package/dist/utils/builders/{network-builder.d.ts → v1/network-builder.d.ts} +2 -1
- package/dist/utils/builders/v1/network-builder.js +79 -0
- package/dist/utils/builders/v1/network-builder.js.map +1 -0
- package/dist/utils/builders/{path.d.ts → v1/path.d.ts} +1 -1
- package/dist/utils/builders/{path.js → v1/path.js} +6 -1
- package/dist/utils/builders/v1/path.js.map +1 -0
- package/dist/utils/builders/v2/agent-builder.d.ts +17 -0
- package/dist/utils/builders/v2/agent-builder.js +142 -0
- package/dist/utils/builders/v2/agent-builder.js.map +1 -0
- package/dist/utils/builders/v2/broker-builder.d.ts +21 -0
- package/dist/utils/builders/v2/broker-builder.js +168 -0
- package/dist/utils/builders/v2/broker-builder.js.map +1 -0
- package/dist/utils/builders/v2/connections-builder.d.ts +18 -0
- package/dist/utils/builders/v2/connections-builder.js +196 -0
- package/dist/utils/builders/v2/connections-builder.js.map +1 -0
- package/dist/utils/builders/v2/llm-builder.d.ts +11 -0
- package/dist/utils/builders/v2/llm-builder.js +68 -0
- package/dist/utils/builders/v2/llm-builder.js.map +1 -0
- package/dist/utils/builders/v2/mcp-builder.d.ts +10 -0
- package/dist/utils/builders/v2/mcp-builder.js +66 -0
- package/dist/utils/builders/v2/mcp-builder.js.map +1 -0
- package/dist/utils/builders/v2/network-builder.d.ts +14 -0
- package/dist/utils/builders/v2/network-builder.js +123 -0
- package/dist/utils/builders/v2/network-builder.js.map +1 -0
- package/dist/utils/builders/v2/path.d.ts +12 -0
- package/dist/utils/builders/v2/path.js +46 -0
- package/dist/utils/builders/v2/path.js.map +1 -0
- package/dist/utils/constants.d.ts +42 -2
- package/dist/utils/constants.js +61 -5
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/exchange.d.ts +5 -6
- package/dist/utils/exchange.js +83 -73
- package/dist/utils/exchange.js.map +1 -1
- package/dist/utils/facets/abstract-facet.d.ts +4 -28
- package/dist/utils/facets/abstract-facet.js +10 -29
- package/dist/utils/facets/abstract-facet.js.map +1 -1
- package/dist/utils/facets/agent-graph-facet.d.ts +17 -0
- package/dist/utils/facets/agent-graph-facet.js +276 -0
- package/dist/utils/facets/agent-graph-facet.js.map +1 -0
- package/dist/utils/facets/api-instance-facet.d.ts +4 -2
- package/dist/utils/facets/api-instance-facet.js +54 -32
- package/dist/utils/facets/api-instance-facet.js.map +1 -1
- package/dist/utils/facets/apim-policy-helpers.d.ts +24 -0
- package/dist/utils/facets/apim-policy-helpers.js +43 -0
- package/dist/utils/facets/apim-policy-helpers.js.map +1 -0
- package/dist/utils/facets/asset-facet.d.ts +7 -3
- package/dist/utils/facets/asset-facet.js +158 -82
- package/dist/utils/facets/asset-facet.js.map +1 -1
- package/dist/utils/facets/connection-facet.d.ts +4 -2
- package/dist/utils/facets/connection-facet.js +54 -32
- package/dist/utils/facets/connection-facet.js.map +1 -1
- package/dist/utils/facets/deployment-helpers.d.ts +28 -1
- package/dist/utils/facets/deployment-helpers.js +87 -4
- package/dist/utils/facets/deployment-helpers.js.map +1 -1
- package/dist/utils/facets/deployment-runner.d.ts +12 -0
- package/dist/utils/facets/deployment-runner.js +62 -0
- package/dist/utils/facets/deployment-runner.js.map +1 -0
- package/dist/utils/facets/facets.d.ts +4 -0
- package/dist/utils/facets/facets.js +98 -7
- package/dist/utils/facets/facets.js.map +1 -1
- package/dist/utils/facets/mule-application-facet.d.ts +3 -7
- package/dist/utils/facets/mule-application-facet.js +54 -85
- package/dist/utils/facets/mule-application-facet.js.map +1 -1
- package/dist/utils/facets/publication-metadata-patcher.d.ts +2 -0
- package/dist/utils/facets/publication-metadata-patcher.js +68 -0
- package/dist/utils/facets/publication-metadata-patcher.js.map +1 -0
- package/dist/utils/facets/publication-rank.d.ts +4 -0
- package/dist/utils/facets/publication-rank.js +33 -0
- package/dist/utils/facets/publication-rank.js.map +1 -0
- package/dist/utils/facets/undeploy-helpers.d.ts +6 -0
- package/dist/utils/facets/undeploy-helpers.js +73 -0
- package/dist/utils/facets/undeploy-helpers.js.map +1 -0
- package/dist/utils/facets/unpublish-preflight.d.ts +2 -0
- package/dist/utils/facets/unpublish-preflight.js +59 -0
- package/dist/utils/facets/unpublish-preflight.js.map +1 -0
- package/dist/utils/files.d.ts +0 -1
- package/dist/utils/files.js +15 -2
- package/dist/utils/files.js.map +1 -1
- package/dist/utils/gateway-mode.d.ts +22 -0
- package/dist/utils/gateway-mode.js +43 -0
- package/dist/utils/gateway-mode.js.map +1 -0
- package/dist/utils/gateway.d.ts +24 -6
- package/dist/utils/gateway.js +115 -35
- package/dist/utils/gateway.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.js +25 -14
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/mcp/mcp-metadata-mapper.d.ts +26 -0
- package/dist/utils/mcp/mcp-metadata-mapper.js +58 -0
- package/dist/utils/mcp/mcp-metadata-mapper.js.map +1 -0
- package/dist/utils/mcp/project-registrar.d.ts +21 -0
- package/dist/utils/mcp/project-registrar.js +96 -0
- package/dist/utils/mcp/project-registrar.js.map +1 -0
- package/dist/utils/mcp/registry-key.d.ts +7 -0
- package/dist/utils/mcp/registry-key.js +72 -0
- package/dist/utils/mcp/registry-key.js.map +1 -0
- package/dist/utils/naming.js +7 -3
- package/dist/utils/naming.js.map +1 -1
- package/dist/utils/promise/promiseCreator.js +5 -0
- package/dist/utils/promise/promiseCreator.js.map +1 -1
- package/dist/utils/report/junit-report.js +5 -0
- package/dist/utils/report/junit-report.js.map +1 -1
- package/dist/utils/report/validation-report.js +5 -0
- package/dist/utils/report/validation-report.js.map +1 -1
- package/dist/utils/request-executor.d.ts +17 -0
- package/dist/utils/request-executor.js +121 -0
- package/dist/utils/request-executor.js.map +1 -0
- package/dist/utils/uris.d.ts +4 -4
- package/dist/utils/uris.js +19 -6
- package/dist/utils/uris.js.map +1 -1
- package/dist/utils/variables.d.ts +3 -4
- package/dist/utils/variables.js +25 -9
- package/dist/utils/variables.js.map +1 -1
- package/dist/utils/zip-utils.d.ts +8 -0
- package/dist/utils/zip-utils.js +24 -0
- package/dist/utils/zip-utils.js.map +1 -0
- package/package.json +22 -11
- package/scripts/resolve-version.sh +89 -0
- package/scripts/resolve-version.test.sh +81 -0
- package/scripts/test-publish-npm.sh +130 -0
- package/templates/{agent-network.yaml.template → agent-network/agent-network.yaml.template} +1 -1
- package/templates/{exchange.json.template → agent-network/exchange.json.template} +1 -0
- package/templates/agentic-network/agent-network.yaml.template +93 -0
- package/templates/agentic-network/brokers/broker1.agent.template +102 -0
- package/templates/agentic-network/exchange.json.template +37 -0
- package/dist/utils/builders/agent-builder.d.ts +0 -11
- package/dist/utils/builders/agent-builder.js +0 -79
- package/dist/utils/builders/agent-builder.js.map +0 -1
- package/dist/utils/builders/broker-builder.js +0 -292
- package/dist/utils/builders/broker-builder.js.map +0 -1
- package/dist/utils/builders/connections-builder.js +0 -233
- package/dist/utils/builders/connections-builder.js.map +0 -1
- package/dist/utils/builders/llm-builder.js +0 -64
- package/dist/utils/builders/llm-builder.js.map +0 -1
- package/dist/utils/builders/mcp-builder.js +0 -48
- package/dist/utils/builders/mcp-builder.js.map +0 -1
- package/dist/utils/builders/network-builder.js +0 -77
- package/dist/utils/builders/network-builder.js.map +0 -1
- 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 {};
|