Learn how to run your mcp-use server using different transport methods and configurations.
Basic Usage
Transport Methods
stdio Transport
Standard input/output transport for MCP clients:streamable-http Transport
HTTP-based transport for web clients:Host and Port Configuration
You can configure host and port either at initialization or when callingrun().
Values passed to run() override those set in __init__(), and DNS rebinding
protection is automatically reconfigured to match:
Default Values
Automatic Port Retry
When the requested port is already in use (e.g., another server is running on port 8000), the server automatically tries the next available port instead of crashing:Cloud and Proxy Deployments
When deploying behind reverse proxies (Cloudflare, nginx, Fly.io, etc.), the server automatically configures DNS rebinding protection based on the host:-
host="0.0.0.0"(default): DNS rebinding protection is disabled, allowing any Host header. This is safe when your proxy handles host validation. -
host="127.0.0.1": DNS rebinding protection is enabled, only allowing requests withHost: 127.0.0.1:*orHost: localhost:*.