MCP through Gemini CLI - JWT keeps dying with both Auth & API key

:bullseye: What is your goal?

I want to be able to use Make MCP through Gemini CLI.

:thinking: What is the problem & what have you tried?

When I use Auth, the JWT keeps dying after a while, and the CLI does not refresh it.

I followed this: Usage with Gemini CLI | MCP Server | Make Developer Hub

I followed all the steps, managed to connect to MCP just fine, can list the tools, used it to get some commands across scenarios. It works:)
However, after about 5 mins the MCP connection died and not even a new ā€œauthā€ request helped.

It only works the very first time in a CLI session.

Then I tried generating an API key in Make, and using that one in the config files.
The same story, it only works in the first CLI session, once the JWT token dies, it’s the end.

What should I do to keep the JWT active? And should not the MCP server handle this?:)))

Alternatively, what setting should I check, or any ideas on what to try?

I am on Mac.

:clipboard: Error messages or input/output bundles

│ MCP tool ā€˜scenarios_list’ reported tool error for function call: {ā€œnameā€:ā€œscenarios_listā€,ā€œargsā€:{ā€œteamIdā€:[myTeamID]}} with response: [{ā€œfunctionResponseā€:{ā€œnameā€:ā€œscenarios_listā€,ā€œresponseā€:{ā€œerrorā€:{ā€œmessageā€:ā€œStreamable │
│ HTTP error: Error POSTing to endpoint: {"code":"SC401","name":"Access denied","message":"Invalid JWT (reason 0x0007).","details":}ā€,ā€œisErrorā€:true}}}}]

A pretty common pattern with JWTs is for the client to need to refresh their JWT before it expires using some kind of refresh endpoint. I haven’t connected to the make mcp server myself so I’m not sure about the exact flow you’re using, but it looks like this doc talks about a refresh endpoint–are you able to call that and then replace your about-to-expire-jwt with the refreshed JWT from that endpoint? Authorization code flow with refresh token (confidential clients) | Make API | Make Developer Hub