getMcpServer()
This method manages MCP server configuration or actor-level MCP connectivity.
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 mcpServerId: string = 'mcpserverid-123'; return client.ai.getMcpServer(mcpServerId);}Signature
function getMcpServer( mcpServerId: string, client?: WachtClient,): Promise<McpServer>Parameters
›mcpServerId: string;
mcpServerId: string;Target MCP server id.
Return value
›id?: string | undefined;
id?: string | undefined;MCP server id.
›name?: string | undefined;
name?: string | undefined;MCP server display name.
›transport?: string | undefined;
transport?: string | undefined;MCP transport mode (for example `sse`).
›endpoint_url?: string | undefined;
endpoint_url?: string | undefined;MCP endpoint URL.
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 };}