Signature
agent.serve(config?: ServeConfig): XsafAgent.serve() configures MCP serving without opening a socket.
Usage
agent.serve({
path: "/mcp",
name: "support_agent",
version: "0.1.0",
});The built-in server uses HTTP. The path defaults to /mcp; the name defaults to the configured agent name and then xsaf; the version defaults to XSAF’s package version.
Fetch-native hosting
The agent always owns a Hono app with GET /health and POST /invoke. Pass agent.fetch to srvx, a Node adapter, Workers, or another compatible fetch-native host. XSAF mounts routes but does not own the listener.
Call .serve() at most once. An optional driver can replace the built-in MCP mounting implementation. See MCP for protocol and security details.