Integrating Google OAuth for MCP SSE Connections in Cursor

Hi everyone,

I’m facing an authentication challenge with our MCP integration in Cursor and would appreciate your insights.

We have an MCP server built with FastAPI that exposes our “chat” tool via SSE. For our web UI (powered by NextAuth), we rely on Google authentication to ensure the proper username and email context. However, when it comes to the MCP connection from Cursor, the usual Google OAuth flow isn’t triggering, leaving us without an authenticated user context on the server.

In essence, while our MCP server expects Google OAuth credentials (either via an external flow or token injection), Cursor’s MCP client currently appears not to support custom auth headers, token injection, or automatic redirection to a Google login page. We’re exploring options like:

  1. Pre-authentication: Running a one-time OAuth flow externally to obtain a token (or refresh token) that the server can use for subsequent MCP requests.
  2. Proxy/Wrapper: Setting up a proxy that injects the necessary auth headers into the SSE connection from Cursor.
  3. Awaiting Native Support: Looking for future enhancements in Cursor that might allow for an integrated OAuth flow or custom header/token support.

Has anyone successfully tackled this issue or have recommendations on integrating Google authentication with MCP in Cursor? Any pointers on workarounds or upcoming features would be greatly appreciated.

3 Likes

This is a pretty complex setup you’re working with. Currently, Cursor’s MCP implementation is fairly basic and doesn’t support OAuth flows or custom auth headers out of the box

Your best bet is probably going with the pre-authentication approach - having users authenticate once through your web UI to generate a long-lived token, then using that token in your MCP server implementation. You could store this in a config file that your MCP server reads

The proxy approach could work too, but adds more complexity to maintain. I wouldn’t wait for native support as this is a pretty niche use case that likely won’t be prioritized soon

Check out our MCP docs for the current implementation details: Cursor – Model Context Protocol

Thanks!

In regards to Native support, we did see that the MCP standard are busy thinking/wokring on an OAuth solution - see Authentication · modelcontextprotocol/specification · Discussion #64 · GitHub.

You believe perhaps Cursor will follow suit?