Skip to main content
Glama
mcp-auth-proxy

mcp-auth-proxy

@thuyphuocthinh/mcp-auth-proxy πŸ”

Zero-config Stdio to Streamable HTTP MCP runtime proxy with automatic OAuth 2.0 PKCE discovery & non-intrusive silent token refresh.

CI NPM Version License: MIT Node.js Zero Dependencies

mcp-auth-proxy acts as a zero-config bridge between your AI Client (Google Antigravity, Cursor, Windsurf, Claude Code, VS Code Copilot) and any remote Model Context Protocol (MCP) server protected by OAuth 2.0 (e.g., 200Lab AI Tutor, Notion, Linear, GitHub).


🌟 Highlights

  • πŸš€ Zero Runtime Dependencies: Pure Node.js (node:http, node:crypto, node:net), lightweight, launches immediately via npx.

  • πŸ” Automated OAuth Discovery: Intercepts 401 Unauthorized, parses WWW-Authenticate: Bearer resource_metadata="..." and resolves .well-known endpoints automatically.

  • πŸ”‘ Dynamic Client Registration (RFC 7591) & PKCE (RFC 7636): Automatically registers client IDs on the fly with S256 challenge, eliminating the need for hardcoded client secrets.

  • 🧘 Non-Intrusive Stdio Mode: Never interrupts your workflow by popping up a browser unexpectedly when running as a background proxy for AI IDEs.

  • πŸ”„ Bound Silent Background Refresh: Persists the registered clientId alongside your tokens and silently refreshes via grant_type=refresh_token, preventing invalid_grant client-mismatch errors.

  • πŸšͺ Explicit login Command: Authenticate upfront whenever you want using mcp-auth-proxy login <url>.

  • πŸ›‘οΈ Static Header Bypass: Support for --header flag to pass static API keys or personal access tokens directly.

  • 🚦 Dynamic Port Selection: Automatically scans for free local ports starting from 8080 (8081, 8082...), eliminating EADDRINUSE port collision errors.


Related MCP server: mcp-remote

πŸ“¦ Usage

1. Antigravity / Cursor Configuration

Add this entry to your mcp_config.json or claude_desktop_config.json:

{
  "mcpServers": {
    "200lab-ai-tutor": {
      "command": "npx",
      "args": [
        "-y",
        "@thuyphuocthinh/mcp-auth-proxy",
        "https://mcp.200lab.io/mcp/learner"
      ]
    }
  }
}

Authenticate in advance so background sessions run smoothly:

npx @thuyphuocthinh/mcp-auth-proxy login https://mcp.200lab.io/mcp/learner

This opens your browser, receives the authorization code, securely stores the credentials in ~/.mcp-oauth-proxy/tokens.json, and exits cleanly. All subsequent background proxy launches will run silently forever with automatic token refresh!


πŸ› οΈ CLI Reference

# Run as Stdio proxy
npx @thuyphuocthinh/mcp-auth-proxy <remote-url> [options]

# Explicit login command
npx @thuyphuocthinh/mcp-auth-proxy login <remote-url> [options]

Option

Description

login <remote-url>

Perform interactive OAuth authentication, save credentials, and exit

--client-id <id>

Pre-configured Client ID (for servers without RFC 7591 dynamic registration)

--header "Key: Value"

Custom request header (e.g. bypass OAuth with static API key)

--auto-browser

Allow proxy to automatically launch browser when authentication is required

--no-browser

Disable automatic browser launch; prints login URL to stderr (for headless/VPS environments)

--login-only

Alias for the login command

-h, --help

Display help instructions

-v, --version

Display version number


πŸ§ͺ Testing

npm run build
npm test

54 unit tests covering all core modules with 100% pass rate.


πŸ“„ License

MIT Β© Thuy Phuoc Thinh

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Bridges stdio-based LLM harnesses to OAuth-protected remote MCP servers via Streamable HTTP, handling PKCE browser login and token refresh automatically.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Bridge that lets stdio-only MCP clients connect to remote MCP servers with OAuth and other auth support, enabling local clients to use remote, authorized MCP servers.
      54
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables MCP clients to connect to remote servers that have OAuth issuer mismatches (e.g., OutSystems) by relaying stdio and handling OAuth flows with optional issuer override.
      12 npm
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables local MCP clients to access tools from a remote FastMCP server over stdio, handling OAuth authentication and Streamable HTTP communication.
      -