DevTools · · 2 min read

Reversing the Tunnel: Building an OAuth 2.1 MCP Gateway Over Port 443

Why raw HTTP tunnels fail remote AI clients for local stdio MCP servers—and how Slipport pairs outbound TLS WebSockets with RFC 9728, RFC 8414, S256 PKCE, and DCR.

MCPOAuth 2.1TypeScriptSlipport

Local Model Context Protocol (MCP) servers—whether driving Blender, querying local PostgreSQL, or reading project filesystems—almost always speak stdio. Connecting them to remote web and mobile AI assistants (Claude, Gemini, ChatGPT, Cursor, n8n) introduces two real constraints:

  1. Developers sit behind CGNAT, dynamic IPs, or restrictive firewalls where opening inbound ports isn’t viable.
  2. Remote AI connectors don’t just hit an unauthenticated webhook—they require Streamable HTTP plus full OAuth 2.1 metadata discovery and PKCE.

01 / Reverse the Connection Over Port 443

Instead of opening router ports, npx slipport up dials outbound over standard port 443 using an encrypted TLS WebSocket:

npx slipport up

Once connected, the remote gateway translates incoming Streamable HTTP MCP calls down through the persistent WebSocket and bridges them cleanly to your local stdio child processes.

02 / Native OAuth 2.1 Discovery & PKCE

A raw HTTP tunnel fails the moment a remote AI client requests protected resource metadata. Slipport handles the authentication handshake directly at the gateway layer:

  • RFC 9728 Protected Resource Metadata discovery
  • RFC 8414 Authorization Server Metadata discovery
  • Dynamic Client Registration (DCR) & S256 PKCE verification
  • Scoped Bearer tokens and a --local-only flag when strict boundary isolation is needed

03 / Instant Runtime Control

Remote access should never mean losing control of what runs on your machine. Pairing the CLI agent with a live web console allows adding, pausing, or triggering an immediate kill switch on any exposed local MCP server in real time.

Written by
Salman Fikri — Systems & Product Architect
Founder of PT Epsilon Teknologi Indonesia (Epsitech) · Jakarta, Indonesia
About →

Have Idea for project?

Got some idea and want to realize it?

Contact.