OAuth Gateway
A transparent proxy server that simplifies authentication by chaining its own OAuth layer with an upstream MCP server's credentials. It manages dual token sets behind a single interface, enabling secure and streamlined access to protected MCP resourc
What is OAuth Gateway?
OAuth Gateway is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to transparent proxy server that simplifies authentication by chaining its own oauth layer with an upstream mcp server's credentials. it manages dual token sets behind a single interface, enabling secure...
A transparent proxy server that simplifies authentication by chaining its own OAuth layer with an upstream MCP server's credentials. It manages dual token sets behind a single interface, enabling secure and streamlined access to protected MCP resourc
This server falls under the Security category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A transparent proxy server that simplifies authentication by
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-oauth-gatewayConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use OAuth Gateway
MCP OAuth Gateway is a transparent proxy server that simplifies authentication when connecting MCP clients to OAuth-protected upstream MCP servers such as GitHub Copilot. It manages dual token sets — its own gateway credentials and the upstream OAuth tokens — entirely behind a single interface, so clients never need to handle multi-step OAuth flows directly. The gateway implements OAuth 2.0 Dynamic Client Registration (RFC 7591) and supports token refresh, SSE stream proxying, and session teardown, making it an essential bridge for enterprise and team deployments that need seamless, secure access to credential-gated MCP resources.
Prerequisites
- Python 3.10 or higher installed
- uv package manager installed (recommended) or pip
- GitHub OAuth App credentials (client ID and client secret) or credentials for another upstream OAuth provider
- The upstream MCP server URL (e.g. https://api.githubcopilot.com/mcp/)
- An MCP-compatible client such as Claude Desktop or VS Code with MCP support
Clone the repository
Clone the mcp-oauth-gateway repository from GitHub to your local machine.
git clone https://github.com/abj453demo/mcp-oauth-gateway.git
cd mcp-oauth-gatewayCreate a virtual environment and install dependencies
Use uv to create an isolated Python environment and install the package in editable mode.
uv venv && source .venv/bin/activate
uv pip install -e .Configure environment variables
Set the required environment variables for gateway credentials and upstream OAuth endpoints. You can pass these as CLI flags or as environment variables.
export MCP_GATEWAY_UPSTREAM_CLIENT_ID=your_github_oauth_app_client_id
export MCP_GATEWAY_UPSTREAM_CLIENT_SECRET=your_github_oauth_app_client_secret
export MCP_GATEWAY_UPSTREAM_AUTHORIZE_ENDPOINT=https://github.com/login/oauth/authorize
export MCP_GATEWAY_UPSTREAM_TOKEN_ENDPOINT=https://github.com/login/oauth/access_token
export MCP_GATEWAY_USERNAME=gateway_user
export MCP_GATEWAY_PASSWORD=gateway_passStart the gateway server
Launch the gateway on port 8002, pointing it at the upstream MCP server. The gateway will be accessible at http://localhost:8002/mcp.
mcp-oauth-gateway --port=8002 \
--upstream-rs=https://api.githubcopilot.com/mcp/ \
--upstream-client-id=$MCP_GATEWAY_UPSTREAM_CLIENT_ID \
--upstream-client-secret=$MCP_GATEWAY_UPSTREAM_CLIENT_SECRET \
--upstream-authorize-endpoint=$MCP_GATEWAY_UPSTREAM_AUTHORIZE_ENDPOINT \
--upstream-token-endpoint=$MCP_GATEWAY_UPSTREAM_TOKEN_ENDPOINTRegister the gateway in your MCP client
Add the running gateway as an MCP server in your client configuration, using the gateway credentials for authentication.
OAuth Gateway Examples
Client configuration
Example claude_desktop_config.json entry pointing Claude Desktop at the running OAuth gateway. The gateway handles all upstream OAuth token exchanges transparently.
{
"mcpServers": {
"oauth-gateway": {
"command": "curl",
"args": ["-s", "http://localhost:8002/mcp"],
"env": {
"MCP_GATEWAY_USERNAME": "gateway_user",
"MCP_GATEWAY_PASSWORD": "gateway_pass"
}
}
}
}Prompts to try
Once connected through the gateway, interact with the upstream MCP server's tools as normal — the OAuth flow is fully transparent.
- "List all tools available through the connected MCP server"
- "Authenticate and fetch my GitHub Copilot suggestions via the gateway"
- "Show the current gateway token status and upstream session details"Troubleshooting OAuth Gateway
Gateway returns 401 Unauthorized when MCP client connects
Ensure MCP_GATEWAY_USERNAME and MCP_GATEWAY_PASSWORD match the credentials your client is sending. Default values are 'gateway_user' and 'gateway_pass'. Check that the client is sending a Basic Auth or Bearer header.
Upstream OAuth flow fails or returns invalid_client error
Verify that --upstream-client-id and --upstream-client-secret match your registered GitHub OAuth App exactly. Confirm the authorize and token endpoints are correct for your provider (GitHub uses https://github.com/login/oauth/authorize and https://github.com/login/oauth/access_token).
SSE stream disconnects after a short time
The gateway proxies SSE streams from the upstream server. If the upstream server has short keep-alive timeouts, set appropriate proxy timeout values and ensure no intermediate HTTP proxies are buffering the response.
Frequently Asked Questions about OAuth Gateway
What is OAuth Gateway?
OAuth Gateway is a Model Context Protocol (MCP) server that transparent proxy server that simplifies authentication by chaining its own oauth layer with an upstream mcp server's credentials. it manages dual token sets behind a single interface, enabling secure and streamlined access to protected mcp resourc It connects AI assistants to external tools and data sources through a standardized interface.
How do I install OAuth Gateway?
Follow the installation instructions on the OAuth Gateway GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with OAuth Gateway?
OAuth Gateway works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is OAuth Gateway free to use?
Yes, OAuth Gateway is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
OAuth Gateway Alternatives — Similar Security Servers
Looking for alternatives to OAuth Gateway? Here are other popular security servers you can use with Claude, Cursor, and VS Code.
Casdoor
★ 13.6kAn open-source Agent-first Identity and Access Management (IAM) /LLM MCP & agent gateway and auth server with web UI supporting OpenClaw, MCP, OAuth, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, Face ID, Google Workspace, Azure AD
ghidraMCP
★ 9.0kAn Model Context Protocol server that enables LLMs to autonomously reverse engineer applications by exposing Ghidra's decompilation and analysis tools. It allows AI agents to list code structures, rename methods, and analyze binaries directly through
HexStrike AI
★ 8.9kHexStrike AI MCP Agents is an advanced MCP server that lets AI agents (Claude, GPT, Copilot, etc.) autonomously run 150+ cybersecurity tools for automated pentesting, vulnerability discovery, bug bounty automation, and security research. Seamlessly b
IDA Pro MCP
★ 8.7kEnables AI-assisted reverse engineering in IDA Pro by providing tools to analyze binaries, decompile functions, manage comments, search patterns, and interact with the IDA database through natural language.
Anthropic Cybersecurity Skills
★ 6.6k754 structured cybersecurity skills for AI agents · Mapped to 5 frameworks: MITRE ATT&CK, NIST CSF 2.0, MITRE ATLAS, D3FEND & NIST AI RMF · agentskills.io standard · Works with Claude Code, GitHub Copilot, Codex CLI, Cursor, Gemini CLI & 20+ platform
Hooker
★ 5.1k🔥🔥 hooker is a Frida-based reverse engineering toolkit for Android. It offers a user-friendly CLI, universal scripts, auto hook generation, memory roaming to detect activities/services, one-click SOCKS5 proxy setup, Frida JustTrustMe, and BoringSSL u
Browse More Security MCP Servers
Explore all security servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up OAuth Gateway in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use OAuth Gateway?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.