Documentation / @interstellar-tools/mcp / startHttpServer
Function: startHttpServer()
ts
function startHttpServer(
__namedParameters: HttpServerOptionsInterface
): Promise<Server<typeof IncomingMessage, typeof ServerResponse>>;Defined in: http.ts:76
Serve the MCP server over Streamable HTTP, for clients that only accept remote servers. Runs stateless: every request gets a fresh server, which is cheap because every tool is a pure calculation.
Requests whose Host header isn't allowed are rejected with 403 before they reach the server. Bound to loopback (the default), only localhost, 127.0.0.1 and [::1] are allowed, which protects against DNS rebinding.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | HttpServerOptionsInterface |
Returns
Promise<Server<typeofIncomingMessage, typeof ServerResponse>>
Example
ts
import { startHttpServer } from '@interstellar-tools/mcp';
await startHttpServer({ port: 3000 }); // http://127.0.0.1:3000/mcp