Hello,
I am encountering problems with connecting Grist MCP server to Gemini Enterprise and Mistral AI. In both cases I use Custom MCP server. I use paid hosted version of Grist.
The MCP server connected to Mistral actually worked for a few actually but it suddenly stopped.
Gemini case
Gemini Enterprise requires to fill Authentication method by myself. The screen below shows how I did it.
j
The connection was created according to this google documentation:
https://docs.cloud.google.com/gemini/enterprise/docs/connectors/custom-mcp-server/set-up-custom-mcp-server
After clicking Verify Auth a Grist authentication window appeared, where I proceed to allow access.
Grist shows that third party app is authorized, however as you can seen in the google console screenshot there is a problem with authorization.
In order to auth third-party app I created an app in the Grist developer system. The scope and the client ID was checked multiple times.
Mistral AI case
As mentioned before it worked for few days without any issue. When first issues with connecting do Grist database showed up I decided to delete and recreate Grist credentials in Mistral. After deleting it, I am not able to create new credentials: after creating new MCP server, entering credential name (mistral requires it for each credential, it is just an internal name), clicking Connect the credential is not saved.
Summary
As the both platform have some problem with the auth I assumed there is problem on the Grist side. I opened there support cases, but so far nothing helpful from them.
Should I open grist support case too?
Hi @Mateusz_Jakubowski.
Thanks for the reports.
On closer inspection, it looks like the problem with Gemini is that when PKCE is enabled, the client is assumed to be public client, and Google does not include the client secret in OAuth requests to Grist. Grist currently only supports registering confidential OAuth clients, and PKCE is always required. We haven’t tested with Gemini yet, but if you don’t see a way to configure Grist as a confidential client with PKCE, or use CIMD or DCR instead of an OAuth client pre-registered on Grist, then the issue is likely just a case of Grist not supporting the combinations of OAuth methods and parameters that Gemini currently supports.
I’ll raise this issue and the Mistral one with the team.
George
Hello @georgegevoian
Thanks for the explanation. I’ll ask Google Support about it, but I can’t see this option in the Google Console for now.
Regarding the Mistral case, I can confirm that today I was able to authorise the MCP server and successfully fetch data from Grist.
Today I am facing problems with Mistral again. It was a very short successful connection.
Hello @Mateusz_Jakubowski ,
I’ve dug into server logs for the Google (Gemini) issue, around your “Verify Auth” attempt. On the Grist side the authorization completed normally — sign-in, consent, and the final redirect back to Google all succeeded — but Google then never called our token endpoint to redeem the authorization code. So the failure seems to happen inside Google’s handling of the OAuth callback, before it contacts Grist again. (In particular, it does not look like @georgegevoian’s theory about PKCE + public client held up – that would’ve resulted in an error somewhere or a failed call to the token endpoint, but I didn’t find any such call.)
Unfortunately the error in your screenshot is too generic to tell us why.
You can capture what Google’s side sees, though, and that would help a lot:
- Open your browser’s devtools (F12) → Network tab, and check “Preserve log”.
- Click “Verify Auth” and go through the flow until the error appears.
- Find the request to vertexaisearch.cloud.google.com/oauth-redirect and paste its full URL here (the code in it is single-use and expires
in 60 seconds, so it’s safe to share — but feel free to replace its value with … anyway).
- Also worth a look: any request after that one which returns an error status — its name and response body, if visible.
And if you note the exact time of the attempt (with timezone), we can line it up against our logs.
And as for Mistral, it looks like Mistral’s connector registers itself with Grist without declaring the offline_access scope (which is what enables refresh tokens). The resulting connection can’t renew its access in the background — it works while actively used in the browser but expires within an hour otherwise. Does Mistral’s MCP connector configuration offer any way to specify OAuth scopes? If you can add offline_access there, that may resolve it from your side.
Hello @dmitry-grist
Thanks for the update.
The log in the google console page does not contain any request to vertexaisearch.cloud.google.com/oauth-redirect.
Moreover the error:
We encountered some problems during authentication. Please try again.
occurs before I complete the auth process in the pop out window.
I gathered the oauth-redirect link directly from the pop out window:
https://vertexaisearch.cloud.google.com/oauth-redirect?code=CODE_STRING&state=STATE_STRING&iss=https%3A%2F%2Flogin.getgrist.com%2F
Time and timezone:
4:42 PM CEST UTC+2 DST
Update: my leading theory is that the issue is that Gemini is uses a popup window to complete the OAuth flow, which fails to complete because we set certain security restrictions on pages in a popup window.
It’s still consistent with your observation that the error is shown before the process completes, because the main window can detect early on that it’s unable to communicate with the popup window.
We’ll have an update to relax those restrictions, which should fix such popup-based flows.
Update from my side: I just tried to complete the OAuth workflow again (gemini) and now I obtained different error.
Something went wrong while attempting to login: Failed to obtain refresh token.
The error appeared after I complete the process in the popout window.
So it looks like @georgegevoian 's finding is ALSO correct, and that it’s an issue on Google side, though we can try to work around it. Google docs say (in Set up your custom MCP server data store | Gemini Enterprise | Google Cloud Documentation):
| Field |
Description |
| Enable PKCE Support |
Optional. Select this checkbox to enable Proof Key for Code Exchange (PKCE, RFC 7636) for additional OAuth security. We recommend this setting if your MCP server’s OAuth provider supports PKCE. |
| Client Secret |
The confidential key associated with the OAuth app that you registered in your identity provider to represent Gemini Enterprise. |
In my reading, this says that a Client Secret is required, and PKCE support is optional for additional security. Grist provides a Client Secret and PKCE. But Google apparently sends only a PKCE code and omits the client secret, as if the presence of PKCE automatically makes it forget the secret and treat the client as a “public client” (what George said).
The error details are:
|
|
|
| error |
invalid_client |
|
| error_description |
client authentication failed |
|
| error_detail |
the provided authentication mechanism does not match the registered client authentication method |
|
| hasCodeVerifier |
true |
|
| hasAuthorizationHeader |
false |
|
The smoking gun is that there is no Authorization header, which means Google didn’t send a client secret.
Until Google fixes it, what Grist can do is to support public clients. It’s a little weird because Google actually needs the client secret (right, @Mateusz_Jakubowski?), so it expects a confidential client, and then doesn’t treat it as such. But I think we can make it work with a new option on Grist side.
Hi @Mateusz_Jakubowski ,
I’ve been trying to debug the Gemini Enterprise connection, and have some updates, but frustratingly, haven’t been able to to get it to work fully.
Firstly, be sure your connector checks both “Enable PKCE Support” and “Use HTTP Basic Authentication”:
For scopes, be sure to include offline_access. To include all scopes, you can paste in this string: doc:read doc:write doc.schema:write doc:download doc:webhooks user.profile:read offline_access.
With these settings, Google does tell me “Successfully logged in”:
In my case, this is where I’m getting stuck. Google says “Go to the Actions tab to enable the actions you want available in Gemini Enterprise.”, but in that tab, I get the error " Failed to reload custom actions." I think at this point Grist has done everything it possibly can – completed the flow and delivered to Google an access token and refresh token. Possibly what I am seeing is a transient problem on Google side.
I’d appreciate if you can try it again and let me know if you get to the same point or get blocked at the same place or somewhere else.