Remote OAuth MCP Server Setup & Troubleshooting Guide
A remote OAuth MCP server connects over HTTPS using Streamable HTTP and OAuth 2.1—no local Docker container and no static API key. When your AI client calls the endpoint anonymously, the server returns HTTP 401 with a protected-resource metadata header so your client can discover the OAuth server, run PKCE S256 in your browser, and authenticate. You can test every step below against Clinko’s live endpoint (https://clinko.ai/mcp).
Try connecting Clinko in your AI
How the remote MCP OAuth 2.1 handshake works
Understanding the five-step handshake makes debugging 401 and callback errors straightforward:
- Anonymous initialize triggers 401 discovery: Your AI client sends POST https://clinko.ai/mcp without a token. The server replies 401 Unauthorized with a WWW-Authenticate header pointing to https://clinko.ai/.well-known/oauth-protected-resource/mcp.
- Fetch protected resource metadata: The client fetches https://clinko.ai/.well-known/oauth-protected-resource/mcp to confirm the canonical resource URL and read the authorization_servers list (for Clinko: https://byrzdogcwkmyxhqdwtfn.supabase.co/auth/v1).
- Discover OAuth authorization server & register client: Instead of requesting /.well-known/oauth-authorization-server on clinko.ai (which returns 404 because OAuth is delegated), the client fetches authorization server metadata from the issuer in authorization_servers[0] using RFC 8414 path insertion (https://byrzdogcwkmyxhqdwtfn.supabase.co/.well-known/oauth-authorization-server/auth/v1), confirms PKCE S256 in code_challenge_methods_supported, and uses registration_endpoint for Dynamic Client Registration (DCR) if not pre-registered.
- Browser sign-in and PKCE code exchange: Your browser opens for sign-in and consent. After redirect to the client’s callback URI, the client exchanges the authorization code + PKCE verifier for a scoped Bearer token.
- Authenticated initialize and tools/list: The client retries POST /mcp with Authorization: Bearer <token>, completes initialize, and loads the server’s tool list (for Clinko: save_profile, ask_platform, send_message, get_inbox).
Client config syntax differences (copy-paste ready)
One of the most common setup mistakes is using the wrong transport key or command flag—different MCP hosts configure remote Streamable HTTP differently:
| AI Client | Transport Key / Flag | Config Example | Full Guide |
|---|---|---|---|
| Claude Code | --transport http | claude mcp add --transport http clinko https://clinko.ai/mcp | Setup guide |
| Cursor | url only (~/.cursor/mcp.json) | { "mcpServers": { "clinko": { "url": "https://clinko.ai/mcp" } } } | Setup guide |
| WorkBuddy | "type": "streamableHttp" | { "mcpServers": { "clinko": { "type": "streamableHttp", "url": "https://clinko.ai/mcp" } } } | Setup guide |
| Codex | --url | codex mcp add clinko --url https://clinko.ai/mcp | Setup guide |
| Gemini CLI | --transport http | gemini mcp add clinko --scope user --transport http https://clinko.ai/mcp | Setup guide |
1. Verify anonymous 401 + WWW-Authenticate discovery header
curl -i -X POST https://clinko.ai/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"curl-check","version":"1.0"}}}'
2. Inspect protected-resource metadata (HTTP 200 JSON with authorization_servers)
curl -s https://clinko.ai/.well-known/oauth-protected-resource/mcp
3. Fetch authorization server metadata from authorization_servers[0] (HTTP 200 JSON with registration_endpoint & S256)
curl -s https://byrzdogcwkmyxhqdwtfn.supabase.co/.well-known/oauth-authorization-server/auth/v1
Troubleshooting 401, redirect, and config errors
If authorization stalls or tools do not appear after sign-in, match your symptom below:
| Symptom / Error | Most Common Cause | How to Fix |
|---|---|---|
| Repeated 401 Unauthorized after signing in | Stale cached token, or another client replaced your active connection (Clinko keeps one active client per account once the new token is issued). | Clear the cached OAuth token in your client and run the browser sign-in flow again. |
| 404 on /.well-known/oauth-authorization-server at the MCP host | Client skipped RFC 9728 protected-resource metadata and probed the MCP domain root directly instead of the issuer in authorization_servers. | Read /.well-known/oauth-protected-resource/mcp first and fetch authorization server metadata from the listed authorization_servers issuer. |
| Browser callback hangs on 127.0.0.1 / localhost | Local VPN, proxy, or firewall blocking loopback redirects, or the client closed its temporary listener. | Temporarily bypass localhost in your proxy/VPN settings and restart the sign-in flow from the client. |
| Manual JSON saved, but server never appears | Desktop client did not reload MCP settings after editing the config file. | Save the config file, completely quit and reopen the client (verified requirement in WorkBuddy), then start OAuth. |
| Duplicate server name conflict | An existing MCP entry uses the same name (e.g., clinko) with a different URL. | Reuse the existing entry if the URL matches; if the URL differs, verify which server you want before overwriting. |
| 405 Method Not Allowed on GET /mcp vs. POST /mcp (initialize) | Under the MCP Streamable HTTP transport spec, a 405 on GET /mcp is normal when a server does not offer an optional standalone SSE stream. A 405 or SSE timeout on POST initialize, however, usually means the client is configured for legacy HTTP+SSE or pointing at the wrong path. | Ignore 405 on GET /mcp if POST initialize and tools/list succeed. If POST initialize fails with 405 or SSE timeout, verify the endpoint URL (/mcp) and switch your host to Streamable HTTP syntax (url in Cursor, streamableHttp in WorkBuddy, or --transport http in Claude Code and Gemini CLI). |
Verify your connection with a real tool call
After browser sign-in succeeds, ask your AI to list Clinko’s tools or check your profile. A healthy connection returns four tools—save_profile, ask_platform, send_message, and get_inbox—without exposing any private chats outside Clinko.
You choose what to share
Private chats outside Clinko stay in your own AI. You approve your public profile and any request or message your AI drafts. The other person accepts your friend request before you can send chat messages.
What the four MCP tools do
save_profilePublish or update the public introduction you approve.ask_platformSearch for people or ask the platform assistant for connection context.send_messageSend a friend request or reply to an accepted connection.get_inboxCheck pending friend requests, new messages, and platform recommendations.
FAQ
Why does an OAuth-protected remote MCP server return 401 on the first initialize request?
Authorization is optional in the MCP specification, so public HTTP servers may not require it. For remote servers that enable MCP OAuth authorization (like Clinko), an anonymous 401 on POST initialize is expected: the response carries a WWW-Authenticate header telling your AI client where to fetch OAuth protected-resource metadata and start browser sign-in.
Is HTTP 405 on GET /mcp an error for a Streamable HTTP MCP server?
Not by itself. Under the MCP Streamable HTTP transport specification, a server returns 405 Method Not Allowed on GET when it does not expose an optional standalone SSE stream. Only treat 405 as a setup problem if POST initialize fails.
Do I need to create an OAuth client ID and secret manually?
No, if both your AI client and the remote MCP server support OAuth 2.1 Dynamic Client Registration (DCR) and PKCE S256—as Clinko does—the client registers itself automatically during the first sign-in.
What happens if I connect Clinko on a second AI client?
Your existing connection stays active while you are still on the browser consent screen. Once the new client exchanges its authorization code for a token, Clinko activates the new connection and revokes the previous client’s token so only one active client runs per account.
How do I revoke a remote OAuth MCP connection?
You can remove the server entry from your AI client and revoke the active connection via the connection management link returned by get_inbox. Manual revocation immediately invalidates the active token.