mcp-auth-proxy

mcp-auth-proxy

Bridges stdio-based LLM harnesses to OAuth-protected remote MCP servers via Streamable HTTP, handling PKCE browser login and token refresh automatically.

Category
Visit Server

README

mcp-auth-proxy

Stdio-to-HTTP MCP proxy with OAuth 2.1 authentication (PKCE + browser login).

Bridges the gap when your LLM harness only supports stdio MCP servers but the remote MCP server requires OAuth (e.g., Microsoft Entra ID).

LLM Harness (stdio only)
  ↕ stdin/stdout (JSON-RPC)
mcp-auth-proxy
  ↕ Streamable HTTP + Bearer token
Remote MCP Server (OAuth-protected)

Features

  • RFC 9728 discovery — auto-discovers authorization server and scopes from the MCP server's protected resource metadata
  • OAuth 2.1 + PKCE — browser-based login, no client secrets needed (public client)
  • Random callback port — each instance uses a random port, safe to run multiple instances simultaneously
  • Auto token refresh — handled transparently by the SDK transport
  • In-memory only — tokens are never written to disk
  • Full proxy — tools, resources, and prompts are all proxied

Installation

⚠️ This package is not published on npm. Install from source using npm link.

git clone https://github.com/manio143/mcp-stdio-proxy.git
cd mcp-stdio-proxy
npm install
npm run build
npm link

Usage

# Basic — discovers client ID from server metadata
mcp-auth-proxy https://mcp.company.com/api

# With explicit client ID
mcp-auth-proxy https://mcp.company.com/api --clientId=my-app-client-id

In MCP client config (e.g., Claude Desktop, VS Code)

{
  "mcpServers": {
    "my-server": {
      "command": "mcp-auth-proxy",
      "args": ["https://mcp.company.com/api", "--clientId=my-app-id"]
    }
  }
}

How authentication works

  1. Proxy probes the remote MCP endpoint → gets 401
  2. Parses WWW-Authenticate header for resource metadata URL (RFC 9728)
  3. Fetches protected resource metadata → finds authorization server + scopes
  4. Fetches authorization server metadata (RFC 8414 / OIDC Discovery)
  5. Opens browser for OAuth 2.1 authorization code flow with PKCE
  6. Receives callback on http://localhost:{random-port}/callback
  7. Exchanges code for tokens
  8. All subsequent requests include Authorization: Bearer <token>
  9. Token refresh happens automatically when tokens expire

Client ID resolution

  1. If --clientId is provided, uses that
  2. If the server's protected resource metadata advertises a client ID, uses that
  3. If the server supports dynamic client registration (RFC 7591), registers automatically
  4. Otherwise, exits with an error

Requirements

  • Node.js ≥ 20
  • A browser for the OAuth login flow
  • The remote MCP server must support Streamable HTTP transport

Security

  • Tokens held in memory only — process exit clears them
  • PKCE prevents authorization code interception
  • Callback server binds to 127.0.0.1 only
  • Random port prevents port conflicts and prediction

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured