src/server.ts
127.0.0.1 by default. The route is /mcp. A managed listener’s default allowed hosts match loopback authorities on its actual bound port; binding and host validation are separate settings.
Call it
Compile and start the server from your project directory:Existing applications
If your framework owns the listener, usecreateHttpHandler() from @toolgrain/http for Web Request/Response, or createNodeHttpHandler() from @toolgrain/node for Node middleware. The combined handlers own MCP and auth metadata routing; mount them at the application root before body parsing.
See HTTP behavior and framework recipes.
Before exposing the endpoint
Configure exact publicallowedHosts, handle trusted proxy normalization in the application, and add authorization when the tools require it. allowedOrigins is a separate browser-origin check and does not emit CORS response headers. Applications own CORS, TLS, listener limits, and public URL normalization. The current HTTP implementation uses independent POST requests and JSON responses; it does not provide sessions, SSE streams, or resumability.