Port proxy lets external HTTP clients reach any port inside a running sandbox. Each sandbox gets a stable URL pattern based on its ID and port number, so you can start a web server, API, or MCP server inside the VM and access it from outside without SSH tunnels or port-forwarding configuration.Documentation Index
Fetch the complete documentation index at: https://docs.declaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
Quick start
Start an HTTP server inside a sandbox, then access it from anywhere using the proxy URL.- Python
- TypeScript
- Go
X-API-Key header.
How it works
- Your client sends an HTTP request to
https://api.declaw.ai/sandboxes/{sandbox_id}/ports/{port}/{path}. - Declaw authenticates the request using the
X-API-Keyheader. - If
allow_public_trafficis enabled (the default), the request is proxied to the target port inside the sandbox. - The response from the in-sandbox server is returned to the client.
.../ports/8080/api/v1/users reaches the sandbox as GET /api/v1/users.
MCP servers
Declaw provides a convenience method for the common pattern of running an MCP server on port 50005 inside a sandbox.- Python
- TypeScript
- Go
get_host(50005) + "/mcp". Use the mcp-server template to get a sandbox pre-configured with FastMCP and the standard MCP dependencies.
Security
Authentication
All port proxy requests require a validX-API-Key header, the same key used for every other sandbox operation. Unauthenticated requests receive HTTP 401.
Disabling port proxy
Port proxy access is controlled by theallow_public_traffic field in the sandbox’s network configuration. It defaults to true. Set it to false to block all inbound port proxy requests.
- Python
- TypeScript
- Go
Blocked ports
Port 49983 is reserved for internal use and cannot be proxied. Requests targeting this port returnHTTP 403.
Cookie stripping
Set-Cookie headers are stripped from all proxied responses to prevent cookie injection attacks against the API domain.
Limits
| Limit | Value |
|---|---|
| Request body size | 100 MiB |
| Supported HTTP methods | GET, POST, PUT, PATCH, DELETE, HEAD |
| Blocked ports | 49983 (reserved) |
CORS
CORS preflight (OPTIONS) requests are handled automatically by the proxy and do not require an X-API-Key header. This allows browser-based applications to call sandbox services directly without a backend relay.
All other HTTP methods (GET, POST, etc.) still require the
X-API-Key header, even when called from a browser. Use a backend proxy or serverless function if you cannot expose your API key to the client.