MCP OAuth Proxy

MCP OAuth Proxy

Acts as a secure OAuth 2.0/2.1 proxy gateway for MCP servers, enabling integration with Claude and ChatGPT platforms.

Category
访问服务器

README

MCP OAuth Proxy

An OAuth 2.0 / 2.1 Proxy for HTTP Model Context Protocol (MCP) servers. This proxy acts as a secure, authenticated gateway enabling integration between downstream MCP servers and client platforms like Claude Web (Custom Connectors), Claude Desktop, and OpenAI ChatGPT (Custom Actions).


Features

  • Standard OAuth 2.0 / 2.1 Flow:
    • /oauth/authorize Authorization endpoint with PKCE validation support and a consent screen.
    • /oauth/token token endpoint supporting authorization_code, client_credentials, and refresh_token flows.
    • In-memory session and token storage.
  • SSE Connection Transport:
    • Compliant /mcp/sse and /mcp/message stream transport endpoints for standard clients.
    • Dynamically constructs absolute URLs for message endpoints behind proxies.
  • OpenAPI Action Bridge:
    • Dynamically compiles tools from the downstream MCP server into a standard OpenAPI 3.0 specification via /openapi.json.
    • Maps tool-call executions to RESTful endpoints at /api/tools/call/:toolName.
  • Robust Downstream Parsing:
    • Integrates with downstream endpoints using static tokens (e.g. LtpaToken).
    • Automatically handles downstream self-signed/corporate certificate authority validation issues (REJECT_UNAUTHORIZED).
    • Seamlessly extracts JSON-RPC payloads from downstream SSE-framed strings.

Setup & Local Development

1. Installation

Clone the repository and install dependencies:

npm install

2. Environment Configuration

Create a .env file in the root directory (based on the provided template):

PORT=3000
DOWNSTREAM_MCP_URL=https://<your-downstream-mcp-server-domain>/mcp
LTPA_TOKEN=<your-downstream-authentication-token>
OAUTH_CLIENT_ID=mcp-client-id
OAUTH_CLIENT_SECRET=mcp-client-secret
REJECT_UNAUTHORIZED=false

3. Start the Server

npm run dev

4. Running Integration Tests

Start the server, and in a separate terminal run the HTTP and SSE test suites:

# Test OAuth flow, REST mapping, and OpenAPI generation
node test-proxy.js

# Test long-lived SSE streaming and message forwarding
node test-sse.js

Deployment to Render

  1. Create a new Web Service on Render connected to your GitHub repository.
  2. Select the Node environment, set Build Command to npm install, and Start Command to npm start.
  3. Use the Add from .env button in the Environment Variables section and paste your local .env values.
  4. Once deployed, note your service's live URL (e.g. https://your-service.onrender.com).

Client Integration Guides

1. Claude Web (Custom Connectors)

In your claude.ai dashboard under Connectors -> Add Custom Connector:

  • Name: MCP OAuth Proxy
  • Remote MCP server URL: https://mcp-oauth-proxy-m3py.onrender.com/mcp/sse
  • OAuth Client ID: mcp-client-id
  • OAuth Client Secret: mcp-client-secret Click Add, complete the OAuth consent screen prompt, and Claude will automatically link the downstream tools.

2. Claude Desktop (Local Bridge)

  1. Request a client credentials token:
    curl -X POST https://mcp-oauth-proxy-m3py.onrender.com/oauth/token \
      -H "Content-Type: application/json" \
      -d '{"grant_type":"client_credentials","client_id":"mcp-client-id","client_secret":"mcp-client-secret"}'
    
  2. Open your claude_desktop_config.json:
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  3. Add the server block using the @modelcontextprotocol/client-cli stdio-to-SSE bridge:
    {
      "mcpServers": {
        "mcp-oauth-proxy": {
          "command": "npx",
          "args": [
            "-y",
            "@modelcontextprotocol/client-cli",
            "https://mcp-oauth-proxy-m3py.onrender.com/mcp/sse?token=YOUR_ACCESS_TOKEN"
          ]
        }
      }
    }
    
  4. Restart Claude Desktop.

3. OpenAI ChatGPT (Custom Actions)

In your Custom GPT configure editor under Actions:

  1. Click Import from URL and paste: https://mcp-oauth-proxy-m3py.onrender.com/openapi.json.
  2. Under Authentication, select OAuth:
    • Client ID: mcp-client-id
    • Client Secret: mcp-client-secret
    • Authorization URL: https://mcp-oauth-proxy-m3py.onrender.com/oauth/authorize
    • Token URL: https://mcp-oauth-proxy-m3py.onrender.com/oauth/token
  3. Save the GPT and trigger a tool call to start the OAuth sign-in flow.

Live Demo Custom Tools (Mock Tracking)

For testing and demonstration, the gateway integrates two custom tools (track_orders and track_deliveries) locally. These tools return dynamic, realistic mock data for your demo from July 7 to July 20, 2026.

You can trigger different delivery and order scenarios in Claude or ChatGPT by using key phrases or codes in your query:

1. 🟢 On Time (Default)

Returns an "On Time" status with delivery set to July 12, 2026.

  • Trigger: Any standard order number (e.g., ORD-12345 or general text).

2. 🟡 Delayed

Returns a "Delayed" status with the delivery pushed from July 12th to July 16th due to weather.

  • Trigger: Contains the word delay or code 222 (e.g., ORD-delay, 222).

3. 🔴 Misplaced / Lost

Returns a "Misplaced" status with an "Unknown" delivery date and system alert flags.

  • Trigger: Contains the word lost, misplaced, or code 333 (e.g., ORD-lost, 333).

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选