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

# Fix Codex MCP problems when connecting to Metorial
URL: https://metorial.com/docs/platform/troubleshooting/codex

Fix a Metorial MCP server in Codex that lists no tools, times out at startup, or fails to sign in, with codex mcp login, /mcp verbose, and config.toml.

---

If Codex lists Metorial with no tools, run `codex mcp login metorial`. Codex can connect to an MCP server without credentials, and Metorial serves tools only after you sign in. Type `/mcp verbose` in Codex to see the server's status. The CLI, the IDE extension, and the ChatGPT desktop app share one `config.toml`, so each fix below applies to all three.

**What you'll learn**

* How to fix sign-in, startup, and timeout problems
* Which `config.toml` settings hide tools or disable the server
* Where Codex writes its logs

**Before you start**

* Metorial added to Codex ([Connect Codex](https://metorial.com/docs/platform/clients/codex))
* Access to `~/.codex/config.toml`
* For the Metorial checks, the CLI: `npm install -g @metorial/cli`, then `metorial login`

## Sign-in

### Metorial is listed but has no tools

Codex connected without a sign-in.

```bash
codex mcp login metorial
```

Inside a session, `/mcp login metorial` does the same. On Metorial's consent screen, select the integrations Codex may use.

### The browser does not open

Print the URL, open it on any machine, and sign in:

```bash
codex mcp login metorial --no-browser
```

Paste the full redirect URL back into the terminal, even if the browser could not load the callback page.

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

Codex returns from the sign-in to a local address such as `http://127.0.0.1:<port>/callback/<callback_id>`, and the portal does not allow it. Metorial treats `127.0.0.1` as `localhost`. 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 `codex mcp login metorial` again.

### The callback port is blocked or taken

Codex picks a local port for the callback. Set a fixed one in `~/.codex/config.toml`. The portal's **Localhost apps** pattern accepts any port.

```toml
mcp_oauth_callback_port = 5555
```

### Codex asks you to sign in again

A Metorial sign-in lasts 30 days from the last refresh, and it ends when the token is revoked. Run `codex mcp login metorial`.

## Server and tools

### Metorial is missing when Codex starts

Codex gives a server 10 seconds to start, and it waits only 1,000 milliseconds for optional servers before it builds the first tool list. Raise the startup limit and make Codex wait for it:

```toml
mcp_optional_startup_grace_ms = 0

[mcp_servers.metorial]
url = "<your-magic-mcp-url>"
startup_timeout_sec = 30
```

### A project `.codex/config.toml` is ignored

Codex reads a project-scoped `.codex/config.toml` only in trusted projects. Trust the project in Codex, or add the server to `~/.codex/config.toml`.

### The server is disabled or blocked

`enabled = false` under `[mcp_servers.metorial]` disables the server. Remove the line.

An admin's managed requirements can also hold an approved list of MCP servers. A server that does not match cannot be enabled, and an empty list disables every MCP server. The admin adds an entry whose `identity` matches your Magic MCP URL:

```toml
[mcp_servers.metorial]
identity = { url = "<your-magic-mcp-url>" }
```

### Some tools are missing

Look for `enabled_tools` and `disabled_tools` under `[mcp_servers.metorial]` in `config.toml`. `enabled_tools` is an allow list, and `disabled_tools` is applied after it. If neither is set, compare with what Metorial serves:

```bash
metorial list
metorial tools <integration-id>
```

If `metorial tools` prints the tool and Codex does not, the tool was left out when you connected Codex. Run `codex mcp login metorial` again and allow it on the consent screen. If `metorial tools` does not print it either, an admin's tool filter removes it.

### Tool calls fail after a minute

Codex stops a tool call after 60 seconds by default. Raise the limit for the server:

```toml
[mcp_servers.metorial]
url = "<your-magic-mcp-url>"
tool_timeout_sec = 180
```

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.

### Tool output is cut off

Codex truncates tool output to the model's default budget. Set a budget for one tool:

```toml
[mcp_servers.metorial.tools.<tool>]
output_token_limit = 20000
```

## See the MCP logs

* `/mcp verbose` in a session prints server diagnostics and the tool list.
* `codex mcp list` in a shell prints every configured server.
* Log files are in `~/.codex/log`. Set `log_dir` in `config.toml` to also get the plaintext `codex-tui.log`.

## Start over

```bash
codex mcp logout metorial
codex mcp login metorial
```

Start a new Codex session and type `/mcp`. Metorial appears with its tools.

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

```bash
metorial list
metorial install codex <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 Codex sees fewer tools than you expect
* [Tool calls fail](https://metorial.com/docs/platform/troubleshooting/tool-calls-fail): what each tool call error means