mcp-oauth-remote-gateway

Performs manual OAuth 2.1 PKCE flows for remote MCP servers on headless gateways.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/vivekgoquest/hermes-agent-stable --skill mcp-oauth-remote-gateway-vivekgoquest
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mcp-oauth-remote-gateway
Source: https://github.com/vivekgoquest/hermes-agent-stable/tree/main/optional-skills/mcp/mcp-oauth-remote-gateway
Command: npx skills add https://github.com/vivekgoquest/hermes-agent-stable --skill mcp-oauth-remote-gateway-vivekgoquest

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Hermes' built-in MCP OAuth client registers a 127.0.0.1 loopback redirect URI, which fails when Hermes runs as a remote gateway (container, VPS, messaging bot) because the user's browser resolves localhost to their own laptop, so the authorization code never reaches Hermes. ## Core Features & Use Cases - Manual OAuth Dance: Walks through RFC 9728 metadata discovery, RFC 7591 Dynamic Client Registration, PKCE authorize URL generation, and token exchange by hand. - Token File Injection: Writes access and client tokens into Hermes' exact mcp-tokens/ schema so /reload-mcp finds cached credentials and skips the browser flow. - Diagnostic Script: Includes diagnose-oauth-mcp.py, which smoke-tests stored tokens, attempts refresh, and prints the correct recovery branch (TOKEN_OK, REFRESH_FIXED, SESSION_REVOKED, REFRESH_DEAD). - Use Case: A user runs Hermes as a Telegram bot on a VPS and wants to connect Linear's OAuth-gated MCP server; this skill completes the authorization without any interactive TTY on the gateway host. ## Quick Start Ask the agent to set up OAuth for a remote MCP server on the headless gateway and paste back the callback URL after authorizing in your browser.

Frequently Asked Questions about mcp-oauth-remote-gateway

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I connect an OAuth MCP server to a headless remote gateway?▼

Do the OAuth flow manually: discover the server's metadata via RFC 9728, register a dynamic client with a 127.0.0.1 redirect URI, build a PKCE authorize URL, have the user paste back the failed callback URL, then exchange the code and write tokens into $HERMES_HOME/mcp-tokens/.

Why does MCP OAuth fail when Hermes runs on a VPS or container?▼

The built-in OAuth client registers http://127.0.0.1:<port>/callback as the redirect URI and listens inside the Hermes process. On a remote gateway, the user's browser resolves 127.0.0.1 to their own laptop, so the authorization code never reaches Hermes.

Does this work for GitHub Copilot MCP or servers without Dynamic Client Registration?▼

No. GitHub does not expose RFC 7591 DCR, so you must use a Personal Access Token or a pre-registered OAuth App with a client_secret. Servers accepting static Bearer tokens should use headers.Authorization instead of OAuth.

Why does an OAuth MCP server stay 'not connected' after /reload-mcp?▼

Hermes keeps a module-level circuit breaker that can survive a reload and short-circuit calls before reaching the server. Run scripts/diagnose-oauth-mcp.py first; it smoke-tests the stored token and tells you whether to restart, refresh, or fully re-authenticate.

What does invalid_grant on a token refresh mean for an MCP server?▼

An invalid_grant response means the refresh token is dead server-side and cannot be recovered from the gateway. The only fixes are a full interactive re-authorization flow or switching to a static API key, which is more durable for unattended gateways.

When should I use a static API key instead of OAuth for MCP?▼

Prefer a static key whenever the provider offers one and the gateway is unattended. Providers like Stripe revoke OAuth sessions roughly weekly, and a restricted key has no session, refresh, or expiry cycle to maintain.