Lifestyle

MCP connection diagnosis and recovery

Inspect process, transport, authentication and tool discovery, preserve errors and verify a minimal operation.

About 15 min read · Practice 20 min

Original workflow illustration, not a product screenshot.
Image: Mokaair (© Mokaair)
Back to directory:Codex learning hub: tutorial directory

Advanced · Desktop / CLI / VS Code / JetBrains

On this page
  1. Goal and preparation
  2. Step 1: Inspect configuration before changing timeouts
  3. Step 2: Reproduce a disabled tool catalog
  4. Step 3: Separate STDIO startup and HTTP connection
  5. Step 4: Authentication, tool filters and timeouts
  6. Finish with a reproducible incident record

Goal and preparation

Lessons and resources mentioned here:

Step 1: Inspect configuration before changing timeouts

Windows, macOS or Linux terminal: read-only inspection · sh
codex --version
codex mcp get codexLearningDocs
codex mcp list

Check the name, enabled state, transport and URL. Record whether this is a local or remote host, CLI or desktop, and the last restart. If get cannot find the name, inspect the actual config.toml, spelling, user/project scope and custom CODEX_HOME. Desktop, CLI and IDE share settings only on the same Codex host; native Windows and WSL home directories are not interchangeable.

For a parse error, fix quotes, duplicate tables or incorrect value types near the reported line before investigating networking. Preserve a before-copy as described in and edit only the practice section, keeping the full settings private. If parsing succeeds but the entry is missing, check trusted-project loading, working directory and whether the editor saved the actual file rather than a backup.

Observed stateEvidenceNext step
Savedget shows the correct entryCheck startup and connection
InitializedClient reports connected serverInspect tools
AuthenticatedRequired service login completedCheck data access
Visible toolsNew task sees the target toolRun a small read-only example
ExecutedTool returns verifiable dataCompare source and preserved scope

Mark authentication not required for a public server that needs none; it is not a skipped login.

Step 2: Reproduce a disabled tool catalog

Obtain a normal read with the previous lesson's question and save the configuration. Change an existing enabled value to false; add enabled = false once only when the key is absent, never duplicating the key or table. Use Restart in desktop MCP settings, restart the IDE extension, or open a fresh CLI session. Merely asking again in the old conversation can reuse earlier content. This exercise deliberately disables your entry; it does not indicate a remote service outage.

Replace your practice section; do not append a duplicate table · toml
[mcp_servers.codexLearningDocs]
url = "https://developers.openai.com/mcp"
enabled = false
Fresh desktop, CLI or IDE task/session: inspect tools · text
/mcp

Use /mcp in the Codex composer on desktop, CLI or IDE; it is not a shell command. After restarting, confirm disabling in a fresh task/session with /mcp, MCP servers settings and actual tool activity. Record that the client did not expose the tool. If you compare surfaces, record each host and configuration location.

The new session should not expose tools from the disabled server, even though get still lists its configuration. Set enabled to true or remove the added false value, restart, then query and verify the official source again. Preserve all three states—normal, disabled and restored—because a final success screenshot alone does not demonstrate that the failure exercise took effect.

Step 3: Separate STDIO startup and HTTP connection

For another STDIO server, inspect command, args and cwd first. Use Get-Command on Windows or command -v on macOS/Linux. This proves the current terminal resolves the program, not that a desktop-launched process inherits the same PATH. Relative paths depend on the working directory; fix missing paths first and check Node versions for servers that require Node.js. A misspelled filename is not repaired by a longer startup timeout.

Windows PowerShell: for Node-based STDIO servers only · powershell
Get-Command node
node --version
macOS/Linux terminal: for Node-based STDIO servers only · sh
command -v node
node --version

STDIO uses standard input/output for protocol messages, so extra greeting or debug output can interfere. If you maintain the server, follow its official implementation and direct ordinary logs to stderr. Otherwise, report startup evidence to the provider rather than editing third-party package internals. A manually started process waiting silently for input is not necessarily hung, and a live process does not prove MCP initialization.

For HTTP, check scheme, host and full path, including the official /mcp endpoint here. A browser opening the homepage proves only partial reachability, not a successful MCP request, proxy setup or authentication. For TLS errors, inspect system time, organizational proxy and certificate trust with the environment maintainer; disabling certificate checks is not the default repair. Record time and a redacted error before retrying a temporary failure.

Step 4: Authentication, tool filters and timeouts

For an OAuth service, choose Authenticate or inspect codex mcp login --help before logging in with your server name. Account, scopes and callback requirements depend on the provider. If a preregistered client ID is required, register the complete callback displayed by Codex rather than guessing a port or swapping localhost and 127.0.0.1. This login exercise does not apply to the public Docs MCP.

When authentication succeeds but a tool is missing, inspect enabled_tools, disabled_tools and plugin policy. An allow list cannot create a capability the server does not offer, and the deny list applies after the allow list. Get real tool names from the current catalog rather than guessing search or read. Plugin-provided servers have plugin-scoped settings; user configuration does not replace their launch commands. See .

Startup and tool timeouts apply to different stages: startup_timeout_sec covers initialization and tool_timeout_sec covers an invocation. Verify program, URL and authentication, then try a smaller read to distinguish oversized work. Adjust one server's timeout only when normal work demonstrably needs more time and retest. Optional startup grace and required also affect startup behavior; making every server required is unnecessary. Preserve failures and stop dependent work when an essential service is unavailable.

Finish with a reproducible incident record

mcp-recovery.md · markdown
# MCP recovery record
Surface / OS / client version:
Host and effective config location (redacted):
Server name / transport:
Failure layer:
Original error (without secrets):
Single change:
New-session tool visibility:
Read-only request and verified source:
Normal / disabled / restored results:
Unrelated settings preserved:
Remaining limitation and next action:

If the exercise breaks configuration, restore its section and recheck instead of replacing the whole file while another task may be editing it. Remove your added codexLearningDocs as in the previous lesson. For OAuth services, logout clears saved authentication and remove deletes configuration; inspect the provider account for remaining grants. Neither reverses data already written to an external system, which needs that provider's recovery process.

Completion means identifying the failing layer, reproducing disable/restore and obtaining fresh read-only tool evidence. A process, file or correct answer alone is insufficient. If connection remains unavailable, mark tool verification incomplete. Product steps follow official documentation, with local configuration and direct MCP checks recorded separately; those do not establish macOS, Linux, IDE, OAuth or physical-phone testing. Continue to .

Original workflow illustration, not a product screenshot.
Original workflow illustration, not a product screenshot. · Image: Mokaair (© Mokaair)
Read the full description

Three numbered stages: identify the starting point, perform the exercise, and verify the result. Original illustration, not a product screenshot.

Back to directory

  • Lifestyle

    Codex learning hub: tutorial directory

    A planned 60-lesson, ten-unit Codex curriculum, from setup and your first task to MD instructions and advanced integrations. Find your next lesson by experience, platform, goal or command; unpublished entries show their status.

  • Lifestyle

    Workshop: build a small website

    Plan and build the Small Steps task website from brief.md, with adding, completing, deleting, filtering and local persistence. Separate HTML, CSS, data functions, UI events and tests, verify with Node and browser checks, and document restart and recovery steps.

  • Lifestyle

    Usage and efficiency: reducing rework

    Record task conditions, model options, time and outcomes to reduce unnecessary retries and excess context.

Latest travel guides

Sources

Lifestyle