> Documentation index: https://metorial.com/llms.txt. Every page is available as Markdown by adding .md to its URL.

# Fix Claude Code MCP errors when connecting to Metorial
URL: https://metorial.com/docs/platform/troubleshooting/claude-code

What each Claude Code MCP status and error means for a Metorial server, from Needs authentication to Failed to connect, with the command that fixes it.

---

Run `claude mcp list` and read the status next to `metorial`. Each status and error below has its fix. Several of them end with the same two commands, which sign you in again:

```bash
claude mcp logout metorial
claude mcp login metorial
```

**What you'll learn**

* What each Claude Code status and message means for a Metorial server
* How to fix sign-in, tool, and timeout problems
* Where Claude Code writes its MCP logs

**Before you start**

* Metorial added to Claude Code ([Connect Claude Code](https://metorial.com/docs/platform/clients/claude-code))
* A terminal in the project where you added the server
* For the Metorial checks, the CLI: `npm install -g @metorial/cli`, then `metorial login`

## Connection status

### `! Needs authentication`

Claude Code has no valid sign-in for Metorial, which is normal right after `claude mcp add`. Run `claude mcp login metorial`, or run `/mcp` in a session, select **metorial**, and authenticate. On Metorial's consent screen, select the integrations Claude Code may use.

### `✘ Failed to connect`

Claude Code reached the URL and the connection was refused. From v2.1.219, the status carries the HTTP status and the error text Metorial returned:

```bash
claude mcp get metorial
```

Read the `Issue:` line. `Invalid magic MCP token` and `Magic MCP token has expired` mean the sign-in is no longer valid, so log out and in with the two commands at the top. If you set a `headers.Authorization` value for the server, remove it, because Claude Code then skips the OAuth sign-in.

### `✘ Connection error`

Claude Code could not open a connection and prints no detail. Check that the URL answers from your machine:

```bash
curl -I <your-magic-mcp-url>
```

A `401` means Metorial is up and the URL is right. No response means a network, proxy, or DNS problem.

### `MCP endpoint not found at <origin>. Check the URL in your MCP config.`

Metorial returned `404`, so the URL's path is wrong. Copy the URL again from the **Magic MCP URL** card on your portal's home page and add the server again:

```bash
claude mcp remove metorial
claude mcp add --transport http metorial <your-magic-mcp-url>
```

### `✘ Blocked by enterprise managed policy`

Your organization's managed settings refuse the server, and `/mcp` shows `MCP server metorial is blocked by enterprise managed policy`. The admin who manages Claude Code adds your Metorial host to the allowlist in managed settings:

```json
{
  "allowedMcpServers": [{ "serverUrl": "https://<your-metorial-host>/*" }]
}
```

## Sign-in

### `MCP server "<name>" needs you to sign in again (run /mcp to re-authenticate)`

Metorial rejected the stored sign-in and Claude Code could not refresh it. A Metorial sign-in lasts 30 days from the last refresh, and it ends when the token is revoked. Run `/mcp`, select **metorial**, and select **Re-authenticate**, or run `claude mcp login metorial`.

### `redirect_uri is not allowed for this portal`

Claude Code returns from the sign-in to `http://localhost:<port>/callback` on a random port, and the portal does not allow it. A portal admin opens **Settings**, **Client Settings**, and enables **Localhost apps** (`http://localhost:*/*`) under **Allowed OAuth Redirects**. From the CLI:

```bash
metorial-admin portals list
metorial-admin portals get <portal-id>
metorial-admin portals update <portal-id> \
  --allowed-redirect-url-filters '[{"url":"http://localhost:*/*"}]'
```

The command replaces the portal's whole list. Run `portals get` first and add the patterns your other clients still need. Then run `claude mcp login metorial` again.

## Tools and tool calls

### Metorial is connected but lists no tools

Run `/mcp`, select **metorial**, and select **Reconnect**. If the count stays at zero, check what your account can use:

```bash
metorial whoami
metorial list
```

An empty list means you have connected no integration yet. Connect one with `metorial setup`, then choose **Re-authenticate** in `/mcp` and select it on the consent screen.

### `Error: No such tool available: <tool name>`

Claude called a tool that is not in the session's tool list. It happens once after you resume a session while Metorial is still connecting, and Claude recovers. If it repeats, select **Reconnect** in `/mcp`. A tool that an admin's tool filter rejects is no longer listed, so ask Claude to call `metorial_connection_status`, which marks such tools as `blocked`.

### `Tool "mcp__<server>__<tool>" is not sent to Claude: its name has <N> characters and the API accepts at most 128`

Claude Code drops a tool whose full name is longer than 128 characters. The other tools keep working. Add the server under a short name such as `metorial`.

### `MCP server "<name>" connection closed before the tool call was answered. The tool may have run: check whether it did before running it again.`

The connection dropped before Metorial answered. Check in the app whether the action happened before you repeat a write. An admin can look the call up:

```bash
metorial-admin sessions tool-calls list --search <tool-key> --limit 10
```

### A tool call times out

Claude Code aborts a remote tool call that sends nothing for five minutes. Set `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` in milliseconds to change that. If the error text is `The request exceeded the configured tenant timeout of <N>ms.`, the limit is Metorial's: an admin raises **Message processing timeout** in the project's **Tool Calling** settings.

## See the MCP logs

`claude mcp get metorial` prints the status, the URL, and the `Issue:` line. For the full exchange, start Claude Code with `claude --debug=mcp`, which writes to `~/.claude/debug/<session-id>.txt`.

## Start over

Removing the server deletes the stored tokens and client registration.

```bash
claude mcp logout metorial
claude mcp remove metorial
claude mcp add --transport http metorial <your-magic-mcp-url>
claude mcp login metorial
claude mcp list
```

The line for `metorial` reads `✔ Connected`.

To connect one integration without the browser sign-in, install it with the Metorial CLI, which creates a long-lived MCP token for it:

```bash
metorial list
metorial install claude-code <integration-id>
```

## Next steps

* [Sign-in and OAuth errors](https://metorial.com/docs/platform/troubleshooting/sign-in-and-oauth-errors): Metorial's side of the sign-in
* [Tools are missing](https://metorial.com/docs/platform/troubleshooting/missing-tools): why Claude Code sees fewer tools than you expect
* [Error reference](https://metorial.com/docs/platform/troubleshooting/error-reference): every Metorial error message with its fix