How to Diagnose an Expired MCP Login and Restore Agent Tools in 5 Steps

AI Agents

If an AI agent suddenly stops finding or using tools from an MCP server, an expired login is one possible cause—but it is not the only one. This five-step guide helps agent developers and administrators distinguish an expired OAuth access token from a server, permission, discovery, or client-configuration problem, then restore access without exposing credentials. The checks apply broadly; exact menu names vary by agent host.

Prerequisites

ItemWhat you need
AccessThe agent or MCP client configuration, the affected server connection, and—if available—server or identity-provider logs.
ToolsThe host's connection settings or MCP Inspector; access to reconnect or sign in again. Do not paste a token into a public website or chat.
TimeAbout 15–30 minutes if the identity provider is available; provider outages or an administrator change can take longer. This is a planning estimate, not a measured test.
DifficultyIntermediate. You should be able to tell the difference between an HTTP-based MCP server and a local STDIO server.

How to diagnose and restore an expired MCP login

Step 1: Confirm which connection and failure are affected

Record the agent host, MCP server name and endpoint, transport (remote HTTP or local STDIO), the time the issue began, and whether the tools are missing from the agent's list or merely failing when called. Check whether other users or another client can reach the same server. If only one user is affected, that points toward account authorization or that user's token; if every client fails, investigate the server, network, or shared identity-provider configuration first.

Keep the exact error text and request timestamp, but redact authorization headers, cookies, client secrets, and refresh tokens before sharing logs. Do not immediately delete and recreate the whole connection; that can obscure the original cause and may disrupt a valid OAuth client registration.

Step 2: Separate tool discovery from tool execution

Ask the client to refresh or list the server's tools, then—if the host offers a safe read-only test—call a harmless tool. MCP clients use a tool-listing operation such as tools/list to discover tools and a separate tools/call operation to run one. Record which operation fails and its status or protocol error. In the OpenAI Responses API, for example, successful imports appear in an mcp_list_tools item; the API documentation distinguishes listing tools from later tool calls.

If discovery succeeds but a protected call returns an authorization error, the token may lack a required scope or may have expired. If the server cannot be reached or tool listing fails before authorization, check the endpoint, transport, server health, and host configuration before blaming the login. Some servers expose public tools and protect only selected tools, so a working public tool does not prove that every account scope is valid.

Step 3: Check the authentication mode and the actual error

For a remote HTTP MCP server using OAuth, inspect the host's connection status and the server or identity-provider logs for a response such as HTTP 401, invalid_token, or an explicit expired-token message. A 401 can also mean the token is missing, has the wrong audience, or is otherwise invalid; it does not by itself prove expiration. A 403 or insufficient_scope more often means the identity is recognized but lacks permission for that action.

If you are authorized to inspect the token, check its expiry (exp when it is a JWT), issuer, audience/resource, and scopes locally using your approved tooling. A token may be opaque rather than a JWT; in that case, rely on the identity provider's introspection or audit logs. Never send the token to an online decoder, and do not treat decoding a JWT as proof of its signature or validity.

Also distinguish invalid_client from an expired user access token. invalid_client points to OAuth client registration or client authentication—such as a missing or rejected client credential—not simply a user needing to sign in again. OpenAI's troubleshooting guidance specifically advises restoring the existing registered client credentials rather than creating a new client when a connection returns that error.

Step 4: Refresh or reauthorize through the trusted host

Use the agent host's reconnect, sign-in, or reauthorize control for the affected MCP server. Complete the identity provider's normal sign-in and consent flow, confirm the requested account and scopes, and let the host obtain or refresh credentials. Do not manually copy a refresh token into an agent prompt or commit credentials to a configuration file or repository. If the host manages tokens for you, you may not be able to inspect or refresh them directly; use its supported reconnect flow.

For local STDIO servers, the HTTP OAuth flow may not apply. The MCP authorization specification says STDIO implementations should obtain credentials from the environment instead. In that setup, check the documented environment-variable or secret-manager source, update an expired credential there, and restart the local process so it receives the new value. Never assume that a browser sign-in will fix a stale environment secret.

Developer checking an MCP integration and authentication settings on a laptop beside diagnostic logs
Illustrative photo of a developer reviewing an authentication setup; the screens are intentionally generic and are not a real product interface.

Step 5: Refresh discovery and verify the right tools return

After successful reauthorization, reconnect or restart the MCP session if the host requires it, then run tool discovery again. Confirm the expected tool names appear and test one low-risk operation. If you use an API that imports tool definitions into a conversation, ensure the current request contains a fresh list after reconnecting; some clients retain a previously imported tool list within a workflow. Check any host-side tool filters or allowlists too: a tool omitted from an allowlist can remain hidden even after authentication succeeds.

Use a short worked check: suppose an agent no longer lists a calendar tool. The endpoint responds, logs show 401 invalid_token, and the identity provider confirms the access token expired. Reauthorize through the host, reconnect the session, and list tools again. If the calendar tool returns but its write action then produces insufficient_scope, request only the missing approved scope or correct the tool's permission policy; repeating sign-in alone may not grant it.

Troubleshooting

  • The login page completes, but the agent still has no tools. Confirm the correct MCP endpoint and transport, refresh tool discovery, and inspect whether the host filters tools by name or OAuth scope. If the server is healthy but listing still fails, review the server's authorization challenge and client logs; on OpenAI ChatGPT plugin surfaces, its current guidance says a 401 response should include a WWW-Authenticate challenge so the client can start OAuth again.
  • Reauthorization loops or returns invalid_client. Check the authorization server's client registration, supported authentication method, redirect configuration, and client credential status. Keep the existing client registration intact unless the provider's documentation says it must be replaced; invalid client configuration is different from a user access token expiring.
  • Tools appear, but calls fail with a permission error. Check the tool's required scopes and the consented account. Reauthorize only with the required approved scopes, then retest. Do not broaden access as a generic fix for an expired token.

FAQ

Does an expired MCP token always make tools disappear?

No. Depending on the host and server, tools may remain listed while calls fail, or the client may hide tools it cannot authorize. Check discovery and tool execution separately.

Should I delete the MCP connection and add it again?

Usually start with the host's reconnect or reauthorize flow. Deleting a connection can complicate OAuth client registration and does not fix server-side scope or endpoint problems.

How can I tell whether the login expired or the server is down?

Compare the tool-list or call response with server health and logs. An authorization error such as 401 invalid_token supports an authentication issue; connection failures or server errors call for endpoint, network, or server checks.

Documentation checked: MCP Authorization specification, OpenAI authentication guidance for MCP servers, OpenAI MCP troubleshooting guidance, and OpenAI MCP tools documentation.

Leave a Comment