Skip to content

Remote Servers

{
"mcpServers": {
"remote-http": {
"url": "https://api.example.com/mcp",
"type": "http",
"headers": { "Authorization": "Bearer ${API_TOKEN}" }
}
}
}
{ "headers": { "Authorization": "Bearer ${API_TOKEN}" } }
{ "headers": { "X-API-Key": "${API_KEY}" } }
{ "url": "https://api.example.com/mcp?api_key=${API_KEY}" }
{ "headers": { "Authorization": "Basic ${BASE64_CREDENTIALS}" } }
worker.ts
import { createHub } from '@himorishige/hatago-hub';
export default {
async fetch(_req: Request, env: Env) {
const hub = createHub({
servers: {
'remote-api': {
url: env.REMOTE_MCP_URL,
type: 'http',
headers: { Authorization: `Bearer ${env.API_TOKEN}` }
}
}
});
// handle request with hub...
}
}

Symptoms

Connection refused or timeout

Fixes:

  1. Verify URL and reachability
  2. Check firewall/proxy
  3. Confirm remote service status

Symptoms

401 or 403

Fixes:

  1. Ensure env vars are set
  2. Check token expiry
  3. Verify required scopes

Set CORS headers on the server or use a proxy/edge runtime like Workers.

  • Keep secrets in env vars
  • Use tags to separate environments (development/staging/production)
  • Turn on --verbose while debugging