MCP Server — chengleiyuan/mcp-oauth2-proxy

A local stdio MCP server that proxies to a remote, OAuth2-protected HTTP MCP server.

Remote serverstreamable-httpGo

What is the MCP Server?

A local stdio MCP server that proxies to a remote, OAuth2-protected HTTP MCP server.

What the server does

This README is a quick start. Full documentation lives in the wiki.

  • Interactive authorization_code + PKCE — flow with a built-in local
  • Refresh-token cache — on disk (AES‑256‑GCM, 0600), so the browser
  • client_credentials — grant for headless / service-to-service use
  • RFC 9728 + RFC 8414 discovery — of token and authorization endpoints
  • Proactive token refresh — with skew, in-flight de-duplication, and a
  • Streamable-HTTP — upstream support: single-shot JSON, SSE

Credentials and setup notes

  • Node.js 20+ - An OAuth2-protected MCP server speaking the Streamable HTTP MCP transport. - An OAuth2 client registered with your IdP. For the interactive flow, register http://127.0.0.1:53682/callback as a redirect URI (or whatever you set OAUTH2_CALLBACK_PORT to).

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

How to install the MCP Server

{
  "mcpServers": {
    "remote-oauth2-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-oauth2-proxy"
      ],
      "env": {
        "UPSTREAM_URL": "https://mcp.example.com/mcp",
        "OAUTH2_GRANT": "authorization_code",
        "OAUTH2_CLIENT_ID": "<your-client-id>"
      }
    }
  }
}

From the project documentation. Replace placeholders and example paths before connecting.

Configuration

  • Node.js 20+ - An OAuth2-protected MCP server speaking the Streamable HTTP MCP transport. - An OAuth2 client registered with your IdP. For the interactive flow, register http://127.0.0.1:53682/callback as a redirect URI (or whatever you set OAUTH2_CALLBACK_PORT to).
VariableDescriptionRequired
UPSTREAM_URLDeclared in the maintainer’s client configuration.Check documentation
OAUTH2_GRANTDeclared in the maintainer’s client configuration.Check documentation
OAUTH2_CLIENT_IDDeclared in the maintainer’s client configuration.Check documentation

Example prompts to try

  • “Use MCP to Refresh.”
  • “Use MCP to Streamable.”
  • “Use MCP to Stderr.”

Frequently asked questions

A local stdio MCP server that proxies to a remote, OAuth2-protected HTTP MCP server. Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.