export interface MCPTool { name: string; description: string; inputSchema: any; outputSchema?: any; tags?: string[]; } export interface MCPFetchResult { requiresAuth: boolean; tools: MCPTool[]; authMetadataUrl?: string; } /** * Fetch MCP tool definitions from a remote MCP server using the MCP JSON-RPC protocol. * Uses StreamableHTTP transport via the @modelcontextprotocol/sdk. * * @param serverUrl - The URL of the remote MCP server * @returns MCPFetchResult with tools if no auth, or requiresAuth flag if auth needed */ export declare function fetchMCPTools(serverUrl: string): Promise; /** * Read and parse MCP tool definitions from a JSON file. * Accepts two formats: * - `{ tools: [{ name, description, inputSchema }] }` (mcp-tools.json format) * - `[{ name, description, inputSchema }]` (raw array of tools) * * @param filePath - Path to the JSON file containing tool definitions * @returns Array of MCPTool objects */ export declare function readMCPToolsFromFile(filePath: string): Promise; export interface MCPAuthProbeResult { requiresAuth: boolean; authMetadataUrl?: string; } /** * Lightweight probe to check if an MCP server requires authentication. * Sends a POST `initialize` JSON-RPC request (matching the MCP streamable-http * transport) and checks for a 401 response + WWW-Authenticate header. GET is * not reliable: spec-compliant MCP servers (Figma, etc.) return 405 to GET and * only emit the WWW-Authenticate challenge on POST. * * Does NOT attempt to fetch tools via MCP protocol. * * @param serverUrl - The URL of the remote MCP server * @returns Whether auth is required and the resource_metadata URL if available */ export declare function probeMCPServerAuth(serverUrl: string): Promise; export interface MCPOAuthMetadata { authorizationUrl: string; tokenUrl: string; refreshUrl?: string; /** * Resolved RFC 8414 well-known URL (the URL `authorization_endpoint` / * `token_endpoint` were fetched from). Returned so callers that need the * authorization-server metadata location — e.g. `dcr/register`'s * `wellKnownAuthorizationServer` — do not have to repeat the probe. */ wellKnownUrl: string; } /** * Resolve OAuth metadata (authorization_endpoint, token_endpoint, refresh_endpoint) from an MCP server's * resource metadata URL. Follows the MCP auth flow: * 1. Fetch the resource metadata URL (from WWW-Authenticate header's resource_metadata) * 2. Extract authorization_servers[0] * 3. Construct the RFC 8414 well-known URL * 4. Fetch authorization_endpoint / token_endpoint from that well-known URL * * @param authMetadataUrl - The resource_metadata URL from the 401 WWW-Authenticate header * @param wellKnownUrl - Optional: if already known, skip discovery and use this URL directly * @returns MCPOAuthMetadata with authorization and token URLs */ export declare function resolveMCPOAuthMetadata(authMetadataUrl?: string, wellKnownUrl?: string): Promise; //# sourceMappingURL=mcpToolFetcher.d.ts.map