Title
Hosted Gmail MCP (user-gmail): Tools UI shows connected after logout/toggle, but Agent MCP tool calls return Unauthorized; OAuth reconnect never prompts
Product / version (from your About block)
Cursor: 3.3.30 (user setup), Stable, VS Code 1.105.1
Commit: 3dc559280adc5f931ade8e25c7b85393842acf30
OS: Windows 11 arm64 (Windows_NT arm64 10.0.26200)
Summary
Google hosted Gmail MCP is configured per Google’s Remote MCP docs (https://gmailmcp.googleapis.com/mcp/v1) with OAuth (CLIENT_ID / CLIENT_SECRET via env, scopes gmail.readonly + gmail.compose). GCP project has Gmail API and Gmail MCP API enabled; OAuth consent includes restricted Gmail scopes.
Observed:
Tools & MCPs shows gmail as healthy (green, tools enumerated, Logout visible).
After Logout or disabling/enabling the server, Cursor reconnects in milliseconds with no Google consent browser flow.
Composer / Agent-invoked MCP tools (e.g. user-gmail-search_threads) consistently fail with Unauthorized.
Expected:
After logout (or when no valid token exists), user should be guided through interactive OAuth until Gmail MCP calls succeed; connected status should correlate with successful authenticated tool calls from Agent.
Reproduction steps
Configure user-level MCP server gmail pointing at Google hosted Gmail MCP with OAuth env vars (same shape as Configure the Gmail MCP server | Google for Developers ).
Open Cursor → Settings → Tools & MCPs → enable gmail — observe green / tools list.
From Agent/chat, invoke search_threads (or ask assistant to call Gmail MCP tools).
Observe Unauthorized.
In Tools & MCPs, click Logout on gmail or toggle gmail Off → On.
Observe immediate connected state without Google OAuth UI.
Repeat Agent tool call → still Unauthorized.
Evidence (local logs — no secrets)
Paths:
%AppData%\Roaming\Cursor\logs\window*\workbench.mcp.oauth.log
%AppData%\Roaming\Cursor\logs\window*\exthost\anysphere.cursor-mcp\MCP user-gmail*.log
Excerpt — workbench.mcp.oauth.log: repeats user-gmail connected → error, and after user_logout clears OAuth, initializing → connected resumes quickly:
[MCPService] State transition: user-gmail connected → error
[MCPService] OAuth clear candidate for server: user-gmail (cause=user_logout)
[MCPService] Cleared OAuth state for server: user-gmail (cause=user_logout)
[MCPService] State transition: user-gmail initializing → connected
Excerpt — MCP user-gmail*.log: after LogoutServer, Successfully cleared OAuth tokens, then ReloadClient completes connected: true with conn=connected,auth=unknown — reconnect to streamableHttp without an intervening user OAuth completion logged:
[V2] Handling LogoutServer action
Successfully cleared OAuth tokens
[V2] Handling ReloadClient action
Successfully connected to streamableHttp server
ReloadClient completed, connected: true, statusType: connected
Impact
Blocks Agent/automation use of Google-hosted Gmail MCP despite healthy-looking MCP UI — high friction for any workflow relying on user-gmail-* tools.
