Description
When token.json is absent, a tool call does not return a fast, actionable auth error. It blocks while waiting for an interactive browser authorization flow to be completed, and only errors out after roughly two minutes with "Google authentication required. A browser window should have opened automatically."
Impact: in a stdio MCP session inside a CLI agent, no browser window opens for the caller and nobody is watching for one, so the wait can never succeed. Two independent calls (listCalendars, getEvents) each burned ~120s and were pushed to background tasks before failing, which is a 4-minute stall on what is a one-line precondition failure.
Environment: server 3.4.6, node v22.22.3, win32 10.0.26200, transport stdio, credentialSource environment.
troubleshoot reports the state correctly and instantly:
auth.tokenFile: "missing", auth.hasRefreshToken: false, auth.status: "missing"
Expected: when auth.status is "missing" (no token file, no refresh token), every tool should short-circuit before attempting the interactive flow and return immediately with the remediation command. Launching a browser and waiting on it is only reasonable when the caller can actually see and complete it.
Suggested fixes, any of which would be enough:
- Check
auth.status at the top of the tool handler and fail fast with "No credentials. Run: npx google-tools-mcp auth" when it is "missing".
- Do not attempt the interactive browser flow at all on the stdio transport. Suppress the browser launch and return the remediation text.
- If the wait is kept, cut the timeout to a few seconds and make the message state plainly that the flow must be run in a separate terminal, rather than implying a browser window has already opened.
Also: the error message asserts "A browser window should have opened automatically." On a headless/stdio invocation it did not, and the wording sends the reader looking for a tab that does not exist.
Diagnostic Info
- Server version: 3.4.6
- Node version: v22.22.3
- OS: win32 10.0.26200 (x64)
- Auth status: missing
- Scopes: documents, drive, spreadsheets, script.external_request, gmail.modify, gmail.compose, gmail.send, gmail.settings.basic, gmail.settings.sharing, calendar, forms.body, forms.body.readonly, forms.responses.readonly, presentations, tasks, service.management
Description
When
token.jsonis absent, a tool call does not return a fast, actionable auth error. It blocks while waiting for an interactive browser authorization flow to be completed, and only errors out after roughly two minutes with "Google authentication required. A browser window should have opened automatically."Impact: in a stdio MCP session inside a CLI agent, no browser window opens for the caller and nobody is watching for one, so the wait can never succeed. Two independent calls (
listCalendars,getEvents) each burned ~120s and were pushed to background tasks before failing, which is a 4-minute stall on what is a one-line precondition failure.Environment: server 3.4.6, node v22.22.3, win32 10.0.26200, transport stdio, credentialSource environment.
troubleshootreports the state correctly and instantly:auth.tokenFile: "missing", auth.hasRefreshToken: false, auth.status: "missing"
Expected: when
auth.statusis "missing" (no token file, no refresh token), every tool should short-circuit before attempting the interactive flow and return immediately with the remediation command. Launching a browser and waiting on it is only reasonable when the caller can actually see and complete it.Suggested fixes, any of which would be enough:
auth.statusat the top of the tool handler and fail fast with "No credentials. Run: npx google-tools-mcp auth" when it is "missing".Also: the error message asserts "A browser window should have opened automatically." On a headless/stdio invocation it did not, and the wording sends the reader looking for a tab that does not exist.
Diagnostic Info