An MCP server’s OAuth access token is usually good for about an hour, sometimes less. Nothing in the protocol requires a client to notice before it expires — so what happens next depends entirely on whether anything in the chain between the model and the upstream server bothers to refresh it. Some setups catch it silently and keep going. Others hand the model a bare 401 and leave it to figure out, on its own, that the fix is “ask a human to log back in.” Here’s why the token expires at all, the two different ways a refresh can actually happen, and what it looks like when neither one does.
Why access tokens expire on purpose
A short-lived access token is a deliberate OAuth 2.1 design choice, not an oversight. The scope you grant at connection time already decides what a token can do; a short expiry limits how long a single leaked or logged token stays useful if it ever ends up somewhere it shouldn’t. The trade-off is a longer-lived refresh_token, issued alongside it, whose only job is to mint a new access token without sending you back through the consent screen. As long as that refresh token is still valid, the expiry of the access token is supposed to be invisible to you. Whether it actually is depends on who’s holding it.
What a bare connection does when the token runs out
MCP itself has nothing to say about refresh — it’s OAuth plumbing sitting underneath the protocol, and how much of it a given client implements is an implementation detail that varies and isn’t something you can check from the outside. What’s predictable is the failure mode when nothing refreshes: a tool call that worked fine fifty minutes into a session returns an authorization error on minute fifty-one, with nothing about the task having changed. If the client doesn’t retry with a fresh token, that error lands in the model’s context exactly like any other tool failure — sometimes as a plain “unauthorized,” sometimes as whatever raw text the upstream server returned. The model has no reliable way to tell “your token expired, reconnect” apart from any other 401, so it either retries the identical call (which fails the same way again) or tells you the tool stopped working, without saying why.
Two ways a refresh actually happens
When something in the chain does handle it, it’s one of two strategies, and they catch different failures:
- Proactive. Before using a stored token, check its recorded expiry. If it’s already past, or close enough to count as close, refresh it first and use the new one. This catches the common case — a session that’s simply run long — without ever sending a call that’s doomed to fail.
- Reactive. Send the call with whatever token is on hand. If the upstream server comes back with a 401 (or, for servers that reject unauthenticated calls with a 403 instead — it happens), refresh once and retry the same call once. This catches the case the proactive check can’t: a token the vendor revoked or invalidated early, before its recorded expiry ever arrived.
Neither one works without the other in the picture somewhere. A proactive-only check misses an early revocation; a reactive-only retry means every normal expiry costs a guaranteed failed call before the real one succeeds. Done properly, both paths save the refreshed access_token (and the new refresh_token, if the vendor rotated it) back to wherever the old one was stored, so the next call starts from the fresh pair instead of refreshing all over again.
When the refresh token itself stops working
Refresh doesn’t always succeed. The refresh token can be revoked at the vendor — the same action covered in how to revoke an MCP OAuth grant — rejected because the vendor requires fresh consent for a scope change, or simply expired on its own schedule, since plenty of authorization servers put a TTL on refresh tokens too, not just access tokens. Whatever the reason, retrying the refresh in a loop doesn’t fix it; the only real recovery is sending the person back through the original consent screen. The useful behavior here is narrow but matters: fail once, mark the connection as needing reauthorization, and say so in plain language instead of surfacing the vendor’s raw OAuth error text to the model.
What to check, whichever side you’re on
If you’re connecting a server, a few things are worth noticing early:
- Does the server even issue a
refresh_token, or just a short access token with no way to renew it? Some do the latter, which means every expiry is a full trip back through consent, not a quiet refresh. - When the token does expire, what actually shows up — a plain “reconnect this server” message, or a cryptic protocol error with no obvious next step?
- Does it keep failing the same way on every call afterward, or does it recover on its own after one retry? Repeated identical failures are the tell that nothing’s refreshing at all.
If you’re building the server instead, issue a refresh token with a reasonable lifetime, don’t force re-consent unless the scope actually changed, and return a clear, distinguishable error when authorization is the problem — not the same generic failure text you’d return for a bad argument. That distinction is what lets a client or gateway tell “refresh and retry” apart from “this call was wrong,” and without it, every expiry looks like a bug in the tool instead of a routine, expected event.
The bottom line
A token expiring mid-session isn’t a failure of the protocol — it’s the protocol working as designed. What determines whether you notice is whether anything in the chain checks the expiry ahead of time, retries once after a rejection, and tells you plainly when neither one can save the connection. See gate’s MCP security hub for the rest of this series, including what it means when OAuth rejects your client outright instead of just expiring on you.