mcp-use TypeScript API
    Preparing search index...

    Function createMcpMount

    • Create the MCP Streamable HTTP endpoint as a fetch handler.

      Returns the underlying McpHttpHandler so callers can call close() on shutdown to abort in-flight exchanges, and use notify/bus for list-changed notifications.

      Compose the returned fetch into a larger app with composeFetch from mcp-use, and put Host/Origin validation in front when binding locally or exposing the process directly.

      Parameters

      Returns McpMount

      const { handler, fetch: mcpFetch } = createMcpMount(factory);
      const app = composeFetch(mcpFetch, jsonBodyMiddleware(), hostValidationMiddleware(hosts));