# MCP token expired

> The token_expired error (401) means your MCP credential passed its expiry. Learn how to re-approve the OAuth connection or generate a new token.

## Error code

```json
{
  "code": "token_expired",
  "message": "MCP Session Expired. Re-approve the connection in your AI client, or generate a new token in Developer Tools → MCP Tokens if you connected with a token. How to reconnect: https://doc.mor.payments.ai/connect",
  "docUrl": "https://doc.mor.payments.ai/errors/token-expired"
}
```

## HTTP status

401

## Cause

The MCP credential passed its expiry. Either the `pai_mcp_*` token passed the end of the duration chosen when it was generated (at most 7 days), or the 90-day OAuth connection reached its expiry. An OAuth connection warns before this happens: inside its last 14 days, `whoami` returns a `credentialExpiryWarning` with the re-approve link, and every tool result carries the same warning under `_meta["ai.payments/credentialExpiryWarning"]` plus a closing text block. The link opens the [connect page](https://doc.mor.payments.ai/connect), at the top of the page.

## How to fix

- **Connected with OAuth:** re-approve the connection in your AI client, then call `whoami` to confirm. The [connect page](https://doc.mor.payments.ai/connect) walks through it for each client.
- **Connected with the device grant (no terminal):** the client never ran OAuth, so there is nothing to re-approve in it. Run the device grant again ([Connect without a terminal](https://doc.mor.payments.ai/connect#connect-without-a-terminal)) and replace the `Authorization` header with the new token, then call `whoami` to confirm.
- **Connected with a token:** generate a new token in **Developer Tools → MCP Tokens**, on the same tab (Sandbox or Live) as the MCP URL your client uses, and replace the old one in your client config. See [Manual: User MCP Key](/mcp#manual-user-mcp-key).

## Related

- [Invalid MCP token](/errors/invalid-token)
