NewWacht Bench is live — AI-assisted development for Wacht

createMcpServer()

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 request: CreateMcpServerRequest = {    name: 'Internal MCP',    transport: 'sse',    endpoint_url: 'https://mcp.example.com',  };  return client.ai.createMcpServer(request);}

Signature

function createMcpServer(  request: CreateMcpServerRequest,  client?: WachtClient,): Promise<McpServerCreateResponse>

Parameters

request: CreateMcpServerRequest;
Request payload object sent to the backend API.
name?: string | undefined;
Display name for the target resource.
transport?: string | undefined;
transport value used by this request.
endpoint_url?: string | undefined;
endpoint url value used by this request.

Return value

id?: string | undefined;
MCP server id.
name?: string | undefined;
MCP server display name.
transport?: string | undefined;
MCP transport mode (for example `sse`).
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 };}

On this page