Skip to content

HTTP Transport

João Miguel Tabosa Vaz Marques Silva edited this page Nov 17, 2025 · 2 revisions

This page describes the HTTP transport modes supported by the TP-Link Omada MCP server and how they map to MCP protocol versions.

The server can run:

  • Over stdio (default)
  • Over HTTP, with either:
    • Streamable HTTP (MCP_HTTP_TRANSPORT=stream, default)
    • HTTP+SSE (legacy) (MCP_HTTP_TRANSPORT=sse)

The implementation uses @modelcontextprotocol/sdk/server/mcp.js and adheres to the official MCP specifications.


Enabling HTTP

Set:

export MCP_SERVER_USE_HTTP=true
npm run dev    # or: npm start

By default, the server will:

  • Listen on 127.0.0.1:3000
  • Use Streamable HTTP (MCP_HTTP_TRANSPORT=stream)
  • Expose:
    • MCP endpoint at /mcp
    • Healthcheck at /healthz

You can customize these via environment variables detailed in Configuration.


Streamable HTTP (Default)

MCP protocol version: 2025-03-26
Transport spec: MCP HTTP with SSE (Stream)

Key features

From the project README:

  • Single endpoint for all operations (GET, POST, DELETE)
  • Server-Sent Events for streaming responses
  • Built-in session management with cryptographic session IDs
  • Optional stateless mode (when MCP_SERVER_STATEFUL=false)

Endpoints

By default (can be changed via MCP_HTTP_PATH):

  • GET /mcp – establish SSE stream and initialize a session
  • POST /mcp – send JSON-RPC messages (MCP requests)
  • DELETE /mcp – terminate the session

Example environment setup

export MCP_SERVER_USE_HTTP=true
export MCP_HTTP_TRANSPORT=stream
export MCP_HTTP_PORT=3000
export MCP_HTTP_PATH=/mcp
npm run dev

Your MCP client then:

  • Makes a GET /mcp request to open the SSE stream.
  • Sends JSON-RPC payloads to POST /mcp.
  • Optionally sends DELETE /mcp to close the session.

HTTP+SSE (Legacy)

MCP protocol version: 2024-11-05
Transport spec: MCP HTTP with SSE (legacy)

This mode is provided for backward compatibility with older MCP clients.

Differences from Streamable HTTP

  • Uses separate endpoints for streaming and messages:
    • GET /sse – SSE connection
    • POST /messages – JSON-RPC messages
  • Does not use the combined /mcp endpoint.

Enabling legacy transport

export MCP_SERVER_USE_HTTP=true
export MCP_HTTP_TRANSPORT=sse
npm run dev

By default:

  • Event stream: GET /sse
  • Message endpoint: POST /messages

MCP_HTTP_PATH can be used to customize these paths (see implementation in src/server/sse.ts).


Security Considerations

Both transports implement protections against DNS rebinding and unauthorized cross-origin access.

Origin validation

The server validates the Origin header on incoming HTTP requests.

Configure allowed origins with:

  • MCP_HTTP_ALLOWED_ORIGINS – defaults to 127.0.0.1, localhost.

You can set:

MCP_HTTP_ALLOWED_ORIGINS=127.0.0.1, localhost, myhost.local

For development, you can use * to allow all origins (not recommended for production):

MCP_HTTP_ALLOWED_ORIGINS=*

Network binding

By default, the server listens on 127.0.0.1:

MCP_HTTP_BIND_ADDR=127.0.0.1

To expose the server on your network, you can set:

MCP_HTTP_BIND_ADDR=0.0.0.0

This should be combined with proper firewalling and possibly an additional authentication layer, as the Omada MCP server itself assumes local/trusted deployment.


Healthcheck

If MCP_HTTP_ENABLE_HEALTHCHECK=true (default), the server exposes a healthcheck endpoint:

  • GET /healthz by default, configurable via MCP_HTTP_HEALTHCHECK_PATH.

Example:

curl http://127.0.0.1:3000/healthz

Use this for monitoring and readiness checks in container orchestrators.


Using ngrok

You can expose the HTTP MCP server to the Internet using ngrok.

Built-in ngrok support

Set:

export MCP_HTTP_NGROK_ENABLED=true
export MCP_HTTP_NGROK_AUTH_TOKEN=your-ngrok-auth-token
npm run dev

The server will automatically open a tunnel and log the public URL.

Manual ngrok setup

Alternatively, run:

ngrok http 3000

This forwards a public HTTPS URL to http://localhost:3000.

Note: Some intermediaries may strip custom headers like Mcp-Session-Id. If that happens, set MCP_SERVER_STATEFUL=false to disable server-managed sessions and allow stateless operation.


Stdio Transport (Reference)

If MCP_SERVER_USE_HTTP is not set or false, the server runs over stdio:

npm start

An MCP client (such as Claude Desktop) can then be configured with:

  • Command: npm start (or an equivalent containerized wrapper)
  • Environment: your .env file with Omada and server settings

For dev mode (auto-reload):

npm run dev

For details on tools exposed over any transport, see Tools.