MCP server errors: the server shows as failed, error -32001 and the other messages

Coding with AIMCP Server·· 2 views· 4 min read

There are two kinds of error on the MCP server. An authentication error cuts off access to the whole server, and the agent shows it as failed. The others come back as the result of a tool: the agent reads the message and explains it to you.

The server shows as failed (error -32001)

When authentication fails, the server answers 401 with a JSON-RPC error with code -32001, and the agent shows the server as disconnected or failed. In Claude Code, claude mcp list shows "Failed to connect" or, with OAuth, "Needs authentication" (Claude Code docs).

Cause What to do
The key is missing, wrong or revoked. Check the key and the Authorization: Bearer header.
The variable did not exist when the agent opened. setx on Windows only applies to new windows. Close the terminal and the agent and open them again.
In the Claude Code .mcp.json, the header uses ${ANTHROPIC_AUTH_TOKEN} or ${ANTHROPIC_API_KEY}. Claude Code reads these variables as empty for MCP servers. Use ${MOZOUT_API_KEY}, even if it holds the same key.
The OAuth access was revoked or is no longer valid. Authorize again: in Claude Code, in /mcp; in ChatGPT, in the plugin settings.
In Cline, "type": "streamableHttp" is missing. Without it, Cline uses the old transport (SSE) and cannot get in. Add the line to the server.

Messages that come back as a result

The other errors are flagged with isError and come with a clear message, which the agent reads:

Situation What to do
The key does not have ai:read or ai:write. Create a key with both permissions.
The credits are not enough for the reservation. Buy credits in All in One AI or choose a cheaper model.
The model does not exist or is not of the right type. Ask the agent to look up the id with list_models.
The All in One AI account is not active. Open All in One AI and check the account status.
The Coding Plan points ran out and the request cannot be paid with credits. Wait for the reset or turn on "Use credits when the plan runs out".
You went over the requests per minute limit. Wait a little: the agent can repeat the request.
The AI service did not respond as expected. Try again in a little while or choose another model.

The tool gives up too early (Codex)

The generation tools wait up to about 50 seconds. By default, Codex gives each tool 60 seconds (Codex docs). Give it more room in ~/.codex/config.toml:

[mcp_servers.mozout-ai]
url = "https://api.mozout.com/mcp"
bearer_token_env_var = "MOZOUT_API_KEY"
tool_timeout_sec = 120

A video that is not ready in time is not an error: the tool returns the generation id. Ask the agent to "check if the video is ready".

Before you ask for help

Test with a sandbox_ key. If it works in the Sandbox but not with the prod_ key, the problem is the production key or the balance. The full list of codes is in the MCP docs.

If the error does not go away, open a support ticket with the name of the tool (Claude Code, Codex, ChatGPT...) and the message the agent showed.

Want the MCP server working first time? See the Coding with AI page.

See Coding with AI

SEE ALSO

The MCP server address and the two ways in: an API key or your account

What the MCP server costs, and testing it in the Sandbox

Errors when setting up a tool with All in One AI: 401, model not found, no credits, /v1 and rejected config files

Using Claude Code with All in One AI: the variables, the model and common errors

Coding with AI in All in One AI

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $6.60/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.