Troubleshoot MCP Servers

View as Markdown

Use the reported status or lifecycle error to choose the matching remediation.

Credential Resolution Is Unknown

If mcp status <server> reports identical placeholder and control rejections, first confirm the stored credential is valid. Rotate it with mcp restart when in doubt.

For identical HTTP 401 or 403 responses, a confirmed-valid credential means the OpenShell gateway on this host is not rewriting openshell:resolve:env:KEY on egress. Every agent request receives the same authentication failure even when provider, attachment, readiness, and adapter checks report healthy.

This is a host-side OpenShell defect rather than a NemoClaw registration problem. Verify the OpenShell installation on the host, tracked upstream as OpenShell issue 2161.

An identical HTTP 400 remains inconclusive because the endpoint may reject the probe’s initialize request. Compare status for the same server on a known-good host.

A credential resolution: unknown verdict with an endpoint or policy detail means the probe could not reach a judgment. Fix the reported endpoint or policy condition, then rerun status.

A detail containing CONNECT 503 means OpenShell failed closed before TLS setup because gateway TLS termination state was unavailable. Inspect the OpenShell gateway’s ephemeral CA generation and CA-file initialization, repair the reported condition, and rerun mcp status <server>.

Provider Is Missing During Restart

If restart reports a missing provider and the original credential is not registered in OpenShell, export the same variable name used during add and retry.

Add Transaction Is Incomplete

If status reports an incomplete add transaction, rerun the original mcp add command with the same URL and environment-variable name. Re-export the value if the provider still needs to be created.

To abandon the transaction, run mcp remove <server> --force. NemoClaw cleans only resources whose ownership it can prove and keeps the registry entry when residual cleanup remains.

Agent MCP Capability Is Missing

If add or restart reports that mcporter, the Hermes transaction helper, or Deep Agents managed MCP capability v2 is unavailable, rebuild the sandbox onto a current image before retrying. An existing Deep Agents v1 entry remains removable, destroyable, and eligible for rebuild teardown when NemoClaw can identify the exact registry-owned legacy entry.

The rebuilt image must pass the v2 capability check before its MCP runtime is restored.

Remote MCP Tools Are Missing for One Agent Turn

If a remote Streamable HTTP MCP server times out or resets while its tools are being loaded, NemoClaw retries that startup once with a fresh connection before the agent turn continues. A successful retry loads the expected tools in the same turn, so no new session is needed.

If the retry also ends in a classified transient transport failure, the sandbox log records a temporary MCP transport failure and states that credentials and configuration were not rejected. Read that line before rotating a credential:

$nemoclaw <sandbox> logs --tail 100

NemoClaw does not retry an authentication, authorization, TLS-validation, network-policy, or invalid-configuration failure inside a turn, because repeating the same request cannot succeed. A refused or unreachable endpoint is also not retried inside a turn; check the endpoint and its egress policy instead.

A catalog that contains a server diagnostic is not cached for the session. NemoClaw rebuilds the catalog on the next agent turn and contacts the affected server again, so a brief upstream outage clears on its own and a repaired credential or policy takes effect without a new session. A catalog without server diagnostics is cached and reused as usual.

A Remote MCP Request Fails Without Saying Where

A transport error such as fetch failed does not say which step failed. For OpenClaw remote Streamable HTTP requests, NemoClaw adds a failure-only diagnostic at the fetch boundary. When that request fails inside a sandbox, OpenClaw attempts to write one managed_transport_failure line group to the sandbox log:

$nemoclaw <sandbox> logs --tail 100
[nemoclaw] managed_transport_failure
[nemoclaw] consumer=mcp
[nemoclaw] mcp_server=gitlab
[nemoclaw] operation=tools/list
[nemoclaw] transport_generation=1
[nemoclaw] request_sequence=3
[nemoclaw] route=proxy_configured
[nemoclaw] proxy=127.0.0.1:3128
[nemoclaw] target=mcp.example.com:443
[nemoclaw] connection_timeout_ms=30000
[nemoclaw] request_timeout_ms=60000
[nemoclaw] catalog_list_timeout_ms=1500
[nemoclaw] effective_timeout_ms=1500
[nemoclaw] transport_phase=response_headers
[nemoclaw] http_status=503
[nemoclaw] elapsed_ms=412
[nemoclaw] server=envoy
[nemoclaw] x_envoy_response_flags=UF,URX
[nemoclaw] session_present=true
[nemoclaw] diagnostic_id=<generated-id>

Read transport_phase first. It states which transport step failed:

Transport phaseWhat failed
policyThe network policy refused the destination
connectThe proxy CONNECT tunnel failed for a reason other than a denial
tlsTLS setup or certificate validation failed
app_connectThe upstream connection was refused, unreachable, or unresolved
requestThe request failed before any response arrived
response_headersA response arrived and its status or headers report the failure

route=proxy_configured states that OpenClaw received a supported proxy environment variable. route=unknown states that the diagnostic did not observe one. These values report configuration evidence and do not prove whether the failed request used a proxy. When present, proxy contains the configured proxy endpoint without credentials. mcp_server contains the configured MCP server name when it passes validation and redaction. operation contains a validated JSON-RPC method, such as initialize, tools/list, or tools/call. For other request shapes, it contains rpc/unknown, transport/listen, or transport/close when that transport action is known. The diagnostic never records JSON-RPC parameters, tool names, tool arguments, or successful response bodies. transport_generation identifies one constructed transport for the configured server. request_sequence counts requests through that transport. The connection, request, catalog-list, and effective timeout fields report the resolved millisecond budgets for the request operation. server, via, x_request_id, and the x_envoy_* fields are the proxy’s own account of the failure and appear only when the proxy sends them. A proxy-generated response does not by itself prove whether the proxy or its upstream produced the failure; keep both the status and the cause chain when reporting one.

By default, the line group is written only for a failure, so normal traffic adds no logging. A 2xx response does not emit this failure diagnostic or read its body. This fetch boundary cannot report a failure that occurs while the caller later reads a 2xx response body. For a non-2xx response, OpenClaw does not wait for asynchronous body sampling before it receives the response. Non-2xx response diagnostics are best-effort. If detached collection fails, OpenClaw still returns the original response and the line group can be absent. The line group can also be absent if OpenClaw exits before collection completes. The sampler waits at most 250 ms and retains at most 2,048 response bytes. The redacted error_body value contains at most 2,048 UTF-8 bytes before JSON encoding. It redacts session identifiers, bearer tokens, structured credentials such as access_token, refresh_token, and client_secret, and known token prefixes.

Collect Shadow Timeout Evidence

Set NEMOCLAW_MCP_SHADOW_DIAGNOSTICS=1 before you create or rebuild an OpenClaw sandbox to collect successful request timing without applying a timeout change. NemoClaw accepts only the literal value 1 and forwards it only to OpenClaw sandboxes. The setting is disabled by default and affects only remote Streamable HTTP MCP requests inside an OpenShell sandbox.

Enabling shadow diagnostics attempts to record one timing event for every successful remote Streamable HTTP MCP request and increases log volume. Each event includes the target host and port, configured server name, operation, and timeout metadata, but excludes URL paths, tool arguments, and successful response bodies. Rebuilding also interrupts the agent while NemoClaw replaces the sandbox and restores its managed state.

For an existing sandbox, export the setting and rebuild:

$export NEMOCLAW_MCP_SHADOW_DIAGNOSTICS=1
$nemoclaw <sandbox> rebuild

For a new sandbox, export the setting before nemoclaw onboard creates it.

When enabled, each successful request attempts to emit a managed_transport_shadow line group with the same validated operation, transport, timeout, and elapsed-time fields. The diagnostic does not read the successful response body or change the returned response. Identifier generation, serialization, or standard-error output failure can omit the line group without blocking the request or changing its response.

For tools/list, NemoClaw retains up to 64 successful elapsed-time samples per target host and port in the OpenClaw process. Different MCP URL paths on the same target host and port share this sample set because the diagnostic does not retain URL paths. After five samples, the event reports shadow_p95_ms and shadow_recommended_timeout_ms. The proposed value is 1.5 times the observed p95 and is rounded up to 100 ms. It cannot be less than the active catalog-list budget or 1,500 ms, and it cannot exceed 10,000 ms. If the active budget already exceeds 10,000 ms, NemoClaw does not emit a recommendation. An abort observed near the effective tools/list budget proposes twice that budget under the same constraints. An explicit HTTP 503 does not produce a timeout recommendation because a longer timeout does not repair a returned upstream failure.

The shadow recommendation is evidence only. It does not change a timeout, retry a request, or persist samples across an OpenClaw process restart. After you collect the evidence, remove the setting and rebuild to restore failure-only logging:

$unset NEMOCLAW_MCP_SHADOW_DIAGNOSTICS
$nemoclaw <sandbox> rebuild

Verify that later successful MCP requests emit no managed_transport_shadow line groups.

To find the matching sandbox audit record, read the sandbox log for the same endpoint around the failure time. The logs command reads both OpenClaw gateway output and OpenShell audit events, so it needs no separate audit flag.

$nemoclaw <sandbox> logs --tail 200

Match on target and the timestamp. If NemoClaw cannot enable OpenShell audit logs, it prints a warning and the policy denial events can be missing from the output. diagnostic_id is a local identifier created for one line group when identifier generation succeeds. NemoClaw attempts to create it before the request starts, but does not add it to the request. It is not a distributed trace identifier and does not appear in OpenShell audit events. Correlate with OpenShell by endpoint and time until OpenShell records a shared identifier.

Adjust the Tool Discovery Timeout

OpenClaw uses a 1,500 ms timeout for tools/list when no server-specific request timeout exists. This discovery request retrieves tool names and schemas; it does not execute an MCP tool.

Set NEMOCLAW_MCP_TOOLS_LIST_TIMEOUT_MS before you create or rebuild an OpenClaw sandbox to override only this discovery timeout. The value must be an integer from 1500 through 10000. When the value is unset or blank, NemoClaw adds no override. OpenClaw then uses a server-specific request timeout when configured and otherwise uses its 1,500 ms fallback. The override applies to catalog tools/list requests for every MCP server in the sandbox and takes precedence over a server-specific request timeout. NemoClaw rejects an invalid value before the sandbox create step, including the replacement create step during rebuild.

Rebuilding interrupts the agent while NemoClaw replaces the sandbox and restores its managed state. A longer timeout does not correct an HTTP 503 response, an authentication failure, a policy denial, or a connection failure.

For an existing sandbox, start with 3,000 ms:

$export NEMOCLAW_MCP_TOOLS_LIST_TIMEOUT_MS=3000
$nemoclaw <sandbox> rebuild

OpenClaw writes the selected override once when its MCP runtime loads:

[nemoclaw] mcp_tools_list_timeout_override_ms=3000

Verify the selected value in recent startup output:

$nemoclaw <sandbox> logs --tail 100

Choose a repeat count before testing, such as 10 runs. After each rebuild, run the identical tool-discovery workflow that many times. Current OpenClaw timeout errors do not identify the JSON-RPC operation, so reproduce through catalog loading rather than a tool call. Advance from 3000 to 5000, and then to 10000, only when catalog loading fails and the recent logs contain:

McpError: MCP error -32001: Request timed out

Stop at the lowest value that completes every planned catalog-loading run without that error. Do not increase this setting for MCP server ... connection timed out after 30000ms; that message reports the separate connection timeout. Do not increase the value after an explicit HTTP 503 response or a non-timeout transport failure.

Unset the override and rebuild to restore OpenClaw’s normal server-specific or 1,500 ms fallback selection:

$unset NEMOCLAW_MCP_TOOLS_LIST_TIMEOUT_MS
$nemoclaw <sandbox> rebuild

Inspect the recent startup output again and verify that the new OpenClaw start did not add an mcp_tools_list_timeout_override_ms line.

Policy or Provider Ownership Drifted

If generated policy or provider metadata drifted, restart fails closed instead of overwriting same-name state. Resolve the reported OpenShell ownership or content mismatch, then retry. remove --force can continue cleaning other independently owned resources, but it does not claim or delete the drifted resource.

Registry entries created by an earlier preview with a host-alias URL or a credential name that is now reserved remain visible so they can be removed safely. Status reports the unsupported boundary, and restart and rebuild fail closed.

Remove the legacy entry before rebuilding or destroying the sandbox, then add a public HTTPS DNS endpoint with a dedicated service credential name.

MCP Policy Capability Is Unavailable

Install the required OpenShell build and rerun onboarding. NemoClaw checks inspectable installed OpenShell artifacts for protocol: mcp capability and does not enable managed MCP from a version number alone.

For image-backed or compressed supervisors without an inspectable host artifact, the onboarding check is provisional. Before a credential or provider side effect, the MCP command loads the exact generated policy with policy set --wait and exact-matches effective state.

A runtime that rejects protocol: mcp therefore fails closed.

Private or Plain-HTTP MCP URL Is Rejected

If nemoclaw <sandbox> mcp add rejects an http:// URL, use HTTPS before you retry. This requirement applies to OpenClaw, Hermes, and Deep Agents Code so OpenShell forwards the bearer credential over TLS.

If the endpoint resolves to RFC1918, carrier-grade network address translation (CGNAT), or IPv6 unique local addresses, add its exact host with --trusted-private-host. The declared host must equal the normalized hostname from --url. NemoClaw rejects a private endpoint without that explicit declaration before provider, policy, registry, or adapter mutation.

An agent-native registration path, such as OpenClaw mcporter run inside the sandbox, may accept a plain-HTTP or local URL, but it bypasses NemoClaw credential replacement and generated egress policy. A URL that the agent-native path accepts is therefore not registrable through managed mcp add.

For a host-local server, keep the MCP process on loopback when practical. Place an operator-managed HTTPS reverse proxy on a stable private address that the OpenShell gateway can route to. The certificate must match the original endpoint hostname and chain to a trust root available to the managed runtime. For a private CA, set NEMOCLAW_CORPORATE_CA_BUNDLE before onboarding, or rebuild the existing sandbox after setting it. The managed image installs that CA for both the OpenShell upstream proxy and sandbox TLS clients. Restrict the proxy listener to the OpenShell gateway or required deployment subnet with host firewall rules.

Direct 127.0.0.1, ::1, and hostnames that resolve to loopback remain rejected. Sandbox loopback is not the host service, and --trusted-private-host does not create a route to it. Use a DNS hostname for an IPv6 unique local address. NemoClaw has not qualified direct IPv6-literal MCP URLs and rejects them. See Add an MCP Server for the full endpoint requirements.

DNS Pins Drift

If mcp status <server> reports private address pins: drift, review the endpoint address change before updating access. Status, restart, rebuild, and restore do not add the new addresses.

Remove and re-add the server with the same exact trusted host to perform a new preflight and record new pins:

$export LOCAL_MCP_TOKEN='replace-with-secret-manager-value'
$nemoclaw <sandbox> mcp remove <server>
$nemoclaw <sandbox> mcp add <server> \
> --url https://mcp-host.corp.example/mcp \
> --env LOCAL_MCP_TOKEN \
> --trusted-private-host mcp-host.corp.example
$unset LOCAL_MCP_TOKEN

A CONNECT 403 after an address change can mean that OpenShell rejected a current DNS answer outside allowed_ips. Do not add a provider’s complete address range or broaden the policy to bypass the denial.

Cloudflare Quick Tunnels rotate public edge addresses and are not durable for exact address pinning. A named tunnel can keep one hostname while its resolved addresses still change. Use stable private DNS and a routed private HTTPS endpoint for a host-local MCP server.

If status reports matching pins but the request still receives CONNECT 403, inspect the OpenShell policy and audit logs. Do not treat matching DNS pins as evidence that the path, method, adapter identity, or provider attachment also matches.

Lifecycle Lock Times Out

Confirm that no mcp add, mcp restart, mcp remove, rebuild, or destroy command for the sandbox is still running, then retry the original command. NemoClaw recovers a lock only when its local process is provably dead or its PID has a different process-start identity.

It does not expose a force-unlock flag. Resolve a live or ambiguous owner on the host that owns it, and do not delete the lock file manually.