Transports
stdio vs. streamable-http, and when to use each.
stdio (the default)
npx klaridian generate --spec ./api.yaml --out ./my-serverThe generated server talks to its client over standard input/output. This is what most MCP clients (Claude Desktop, Claude Code, and others) expect when they spawn a server as a local process. Use this unless you have a reason not to.
streamable-http
npx klaridian generate --spec ./api.yaml --out ./my-server \
--transport streamable-http --port 3000The server listens on a network port instead. Use this when the server needs to run somewhere other than the client's own machine—for example, behind OAuth (see OAuth 2.1). This requires streamable-http—it doesn't work with stdio.
Built-in test client
A streamable-http server serves a small, dependency-free HTML test client at its root (TypeScript target). With the server running, open http://localhost:3000/ (or whatever --port you chose) in a browser: it connects to the server's /mcp endpoint, lists the tools the server exposes, and lets you call any one with a JSON arguments field. Because it just asks the running server what it can do, it works the same regardless of how the server was generated—per-tool or code-mode. MCP itself stays on /mcp—the client is only served on GET /. The client's source is vendored in the generated project (src/test-client.ts), so you can read, edit, or remove it.
Deploying behind a public host
The --port you pass at generation time is only the default. The generated streamable-http server reads three environment variables at runtime, so one build runs unchanged across environments:
| Variable | What it does | Default |
|---|---|---|
PORT | The port to listen on. Takes precedence over KLARIDIAN_PORT and the generated default. Most platforms (Cloud Run, Render, Railway, Heroku) inject this automatically. | the --port value |
KLARIDIAN_BIND_HOST | The network interface to bind. Set to 0.0.0.0 inside a container or PaaS so the server accepts traffic from outside its own loopback. | 127.0.0.1 |
KLARIDIAN_ALLOWED_HOSTS | Comma-separated hostnames allowed in the Host header. By default only localhost is accepted (per the MCP spec's DNS-rebinding protection). When the server is reached through a public hostname—myapp.fly.dev, name.workers.dev, a custom domain—add it here, or every request is rejected with 403 Invalid Host. | localhost only |
For example, deploying to a host that serves myapp.fly.dev on the platform's injected port:
PORT=8080 \
KLARIDIAN_BIND_HOST=0.0.0.0 \
KLARIDIAN_ALLOWED_HOSTS=myapp.fly.dev \
npm startLeaving KLARIDIAN_ALLOWED_HOSTS unset keeps the secure localhost-only default, so local runs need no configuration. Only the hostnames you list are accepted—an unlisted Host still gets a 403.
Which one should I pick?
Start with stdio. Switch to streamable-http only when you need remote access or OAuth.
Use klaridian from an AI agent
Install the klaridian Agent Skill so coding agents such as Claude Code, Codex, or Cursor run the CLI correctly.
Upstream authentication
How the generated server authenticates to the upstream API per OpenAPI securityScheme, the environment-variable convention, and the --forward-headers and --auth-hook flags.