discoverMcpServerAuth()
This method discovers authentication configuration required by a target MCP server endpoint.
Usage
The following example shows a basic usage of the backend client from @wacht/nextjs/server.
import { wachtClient } from '@wacht/nextjs/server';export async function example() { const client = await wachtClient(); const request: DiscoverMcpServerAuthRequest = { endpoint_url: 'https://mcp.example.com', }; return client.ai.discoverMcpServerAuth(request);}Signature
function discoverMcpServerAuth( request: DiscoverMcpServerAuthRequest, client?: WachtClient,): Promise<McpServerDiscoveryResponse>Parameters
›request: DiscoverMcpServerAuthRequest;
request: DiscoverMcpServerAuthRequest;Request payload object sent to the backend API.
›endpoint_url?: string | undefined;
endpoint_url?: string | undefined;endpoint url value used by this request.
Return value
›result?: McpServerDiscoveryResponse | undefined;
result?: McpServerDiscoveryResponse | undefined;Operation result payload.
Examples
AI usage pattern
import { wachtClient } from '@wacht/nextjs/server';export async function provisionMcp(actorId: string) { const client = await wachtClient(); const server = await client.ai.createMcpServer({ name: 'Internal MCP', transport: 'sse', endpoint_url: 'https://mcp.example.com', }); const connected = await client.ai.connectActorMcpServer(actorId, server.id); return { server, connected };}