UNPKG

@n8n/n8n-nodes-langchain

Version:
54 lines (53 loc) 2.74 kB
import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { type Result } from '@n8n/utils/result'; import type { ICredentialDataDecryptedObject, IExecuteFunctions, ILoadOptionsFunctions, McpOAuth2CredentialType, McpRegistryConnection, INode, ISupplyDataFunctions, NodeEgressFilter, PrepareMcpRegistryConnectionInput, PrepareMcpRegistryConnectionResult } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow'; import { type McpAuthenticationOption, type McpServerTransport, type McpTool } from './types'; export declare function getAllTools(client: Client, cursor?: string): Promise<McpTool[]>; type OnUnauthorizedHandler = (headers?: Record<string, string>) => Promise<Record<string, string> | null>; type ConnectMcpClientError = { type: 'invalid_url'; error: Error; } | { type: 'connection'; error: Error; } | { type: 'auth'; error: Error; } | { type: 'cancelled'; error: Error; }; export declare function mapToNodeOperationError(node: INode, error: ConnectMcpClientError): NodeOperationError; export declare function connectMcpClient({ headers, serverTransport, endpointUrl, name, version, onUnauthorized, signal, allowedDomains, secureEgressFilter, }: { serverTransport: McpServerTransport; endpointUrl: string; headers?: Record<string, string>; name: string; version: number; onUnauthorized?: OnUnauthorizedHandler; signal?: AbortSignal; allowedDomains?: string; secureEgressFilter: NodeEgressFilter; }): Promise<Result<Client, ConnectMcpClientError>>; export declare function getAuthHeaders(ctx: IExecuteFunctions | ISupplyDataFunctions | ILoadOptionsFunctions, authentication: McpAuthenticationOption): Promise<{ headers?: Record<string, string>; credentials?: ICredentialDataDecryptedObject; }>; export declare function tryRefreshOAuth2Token(ctx: IExecuteFunctions | ISupplyDataFunctions | ILoadOptionsFunctions, authentication: McpAuthenticationOption, headers?: Record<string, string>): Promise<{ Authorization: string; } | null>; export declare function connectMcpClientForCredential(ctx: IExecuteFunctions | ILoadOptionsFunctions | ISupplyDataFunctions, config: { authentication: McpAuthenticationOption; serverTransport: McpServerTransport; endpointUrl: string; registryCredential?: { connection: McpRegistryConnection; credentialType: McpOAuth2CredentialType; prepareConnection(input: PrepareMcpRegistryConnectionInput): PrepareMcpRegistryConnectionResult; }; surface: string; signal?: AbortSignal; }): Promise<Result<Client, ConnectMcpClientError>>; export declare function isStructuredContent(value: unknown): value is Record<string, unknown>; export {};