Skip to content

Feature: agent-callable MCP connection refresh and tool rediscovery in existing Desktop chats #56970

Open

Description

@JohannesTripolt

What variant of Codex are you using?

Codex Desktop on Windows (installed package 26.1021.3705.0).

What feature would you like to see?

Expose an agent-callable operation to reconnect configured MCP servers and rediscover their tools in an existing Desktop chat.

This is a feature request for an explicit control, rather than a claim that a particular connection failure is a bug.

Use case

While working with a networked service, I enable an additional tool on its MCP server. The agent should be able to refresh the existing connection, discover the newly exposed tool and continue in the same chat. Requiring me to operate the desktop settings UI breaks unattended or remote workflows, particularly when I am away from the computer.

Proposed behavior

Provide a narrow built-in/app tool, for example refresh_mcp_connections, that uses the existing Desktop host's MCP refresh machinery. The public app-server API already documents config/mcpServer/reload; the missing capability is an agent-accessible route to the host actually serving the chat.

  • Preserve the chat and existing credentials. Do not require a new chat, application restart or repeat login when authentication remains valid.
  • Respect existing tool exposure, allowlists and approval policies. Discovering a write tool must not authorize its use.
  • Prefer a named-server refresh if supported. Otherwise, clearly disclose host-wide scope and safely handle other chats and in-flight calls; do not imply the current reload API already supports server selection.
  • Return an observable completion or failure result. An acknowledgement that a refresh was queued should be distinguishable from the updated catalogue actually being available to the model.
  • Do not require a generic app-server RPC tool, debug port or browser/computer automation.

Acceptance test

  1. Start an existing Desktop chat connected to an MCP server.
  2. Add or expose a harmless read-only tool on that server.
  3. Have the agent request a refresh through the new control.
  4. Without restarting Desktop or creating another chat, verify that the same agent can discover and successfully call the new tool.
  5. Report the outcome clearly if refresh fails or cannot safely proceed.

Additional information

Related requests and reports:

Public API: https://learn.chatgpt.com/docs/app-server#api-overview

No credentials, service addresses, private configuration or conversation logs are attached.

Activity

  1. added
    enhancement
    app
    mcp
    app-server
    on Oct 25, 2026
  2. github-actions commented on Oct 25, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. JohannesTripolt commented on Oct 25, 2026

    @JohannesTripolt
    Author

    Reviewed the suggested duplicate, #55864. It is related, but the requested outcome here is narrower and explicitly agent-facing.

    #55864 reports an existing remote plugin connection retaining an old tool inventory in a cloud conversation and asks for supported refresh/re-discovery.

    This issue requests a built-in, agent-callable refresh operation on the actual local Desktop host, usable in an existing chat without a human operating settings. It remains useful even if automatic inventory invalidation works correctly: an authorized agent should be able to request deliberate rediscovery after a server/configuration change and receive a clear completion or failure result.

    The existing config/mcpServer/reload API is a possible implementation building block, not a claim that it is currently reachable through an agent tool or that #55864 shares our underlying cause. The requested control should preserve existing approval policies and clearly describe its scope and effects on other active work.

    I am leaving this open as a feature request for that explicit control. If maintainers prefer tracking it under #55864 or #20605, please retain the agent-callable operation and same-chat acceptance criteria when consolidating.

  4. Alexelsea commented on Oct 29, 2026

    @Alexelsea

    An additional real Desktop recovery use case, observed 2026-10-29: a configured MCP server failed initialize in one existing chat with HTTP429 / JSON-RPC -32000 (Rate limit exceeded). Later connections in the same restarted application reached ready, and a normal independent client check returned HTTP200 about eight minutes later. The affected chat still lacked that server's tools in the inspected session. This is evidence of a transient startup failure followed by service availability; it is not proof that the server limiter is defective or that the affected chat later recovered.

    This makes the requested supported refresh control useful without any credential, grant, configuration or limit change. A queued refresh acknowledgement should remain distinct from a successful handshake, updated catalogue, and harmless tool call in the same chat. Any automatic transient-startup recovery should respect Retry-After, use bounded backoff, distinguish rate limiting from authentication refusal, and never replay consequential tool calls or silently reload other active chats.

    No private RPC, debug port, credential access, policy bypass or protected UI workaround was used. No service addresses, account details or private conversation identifiers are attached.

  5. Alexelsea commented on Oct 29, 2026

    @Alexelsea

    Follow-up with server-side evidence for the previously reported transient-startup case:

    A complete historical 20-second proxy-log window during Desktop restart contains 141 requests to the configured MCP endpoint, including 138 Codex-class and 3 Claude-class user agents. It includes 56 HTTP429s across POST/GET/DELETE, interleaved with 84 HTTP200/202s and one GET404. The historical deployment-scoped query reproduces those counts. No raw addresses, service URL, headers, account information, credentials or private conversation identifiers are attached. Shared source address does not prove a shared credential, and timing alone does not identify the affected chat's exact request.

    The affected chat emitted starting then HTTP429 failed during initialize and has no subsequent startup/ready event in the inspected logs. A later normal independent check returned HTTP200, while one supported resource-list inspection in the existing chat still failed while acquiring the client with the original startup-error chain. That inspection is not asserted to have sent another HTTP request.

    This reinforces the distinction between rate-respecting startup recovery and an observable refresh of the existing chat's tool catalogue. A bounded, single-in-flight recovery should honor Retry-After, avoid credential/limit changes, distinguish authentication refusal from transient throttling, and never replay consequential tool calls. Current public source retains a shared startup result for custom servers; that source has not been mapped to the exact immutable bundled binary, so this is not a claim about a specific shipped implementation commit.

    No private RPC, protected UI, unrelated plugin installation, policy bypass or new connection retry was used.

  6. derrickburns commented on Nov 3, 2026

    @derrickburns

    A source-level addition to this existing request: please support a single loaded thread / named MCP server cutover with explicit preservation and observable completion, without requiring thread resume or host-wide reload. A stateful local stdio server may own task leases and unresolved action receipts, so merely reconnecting its pipes is insufficient.

    I reviewed release tag rust-v0.166.0, commit 6ff1e1ca3b30fc8b914720681fcf5fe62e95f856. This is public release-source analysis, not an attestation that the installed binary or a particular running host was built from those bytes, and not a newly reproduced upstream defect.

    Concrete implementation seams:

    • app-server/src/mcp_refresh.rs: the reload planner iterates the loaded thread set. The request processor invokes it without a target selector.
    • codex-mcp/src/runtime.rs: McpRuntime already publishes an immutable runtime snapshot; previous bindings can retain their exact connection set. replace_fresh and reconnect_on_next_refresh do not establish the proposed named-server preservation transaction.
    • codex-mcp/src/connection_manager.rs and connection_pool.rs: normal shutdown can release native connection leases and ultimately shut down the client. These native connection leases are distinct from the MCP application's own durable task/browser leases.
    • CODEOWNERS assigns the MCP/core crates to @openai/codex-core-agent-team. The contribution policy requests issue-based analysis rather than external PRs. This comment is that owner handoff, not an attempted local override.

    Smallest proposed contract, with no claim that an API of this name/shape exists today:

    1. Authenticate the normal host owner and bind one operation ID, existing thread ID, server name, expected connection generation/complete registration digest, and complete successor registration. Retain permissions, environment, auth and unrelated configuration. Stale preconditions fail before effects. Do not create a thread or call thread/resume.
    2. Fence only new admissions to that connector. Refuse with an explicit no-effect busy result if existing requests, startup, elicitation, shared-process ownership or retained bindings cannot safely settle. Complete any already-admitted original exactly once; never replay its tool action. Old target bindings must not dispatch after cutover; unrelated bindings remain usable.
    3. For a server that requires state preservation, require a genuine server-owner prepare/retire/adopt handshake before shutting down the old executor or starting a competing accepting successor. If that handshake is unavailable, return an explicit unsupported-preservation result. Generic MCP initialization or ordinary SIGTERM is not such a handshake. A native control cannot invent application custody that the server cannot export.
    4. Atomically publish the accepted target connection/catalogue under the expected generation. Report actual initialization, advertised contract and loaded implementation evidence separately from queued/planned status. An incompatible contract requires explicit discovery admission rather than silently expanding capabilities. No new provider/action authority follows from discovery.
    5. Preserve native view/composer, existing turn/history and goal identity/status/objective/createdAt/limits/monotonic accounting. The operation must not mutate or resume a goal. Retain one inspectable original after lost replies or partial cleanup; no automatic new IDs, forced rollback or broader reload.

    Disposable acceptance proposal for the owning native test harness (not executed on any production conversation):

    • Two synthetic threads A/B, plus a second server in A; use credential-free counter/identity stdio fixtures. Set A's goal blocked and retain an entered TUI draft. Record goal/turn events and old/new process identities. A successful idle cutover changes only A's selected server, exposes its new implementation through a real harmless call, preserves the draft and blocked goal, and emits no unauthorized turn start. B and A's other server remain usable and unchanged.
    • Hold one real fixture call in flight. A cutover must either refuse before changes or await that exact original under its documented fence. Releasing the fixture completes it once; action count remains one. Exercise a retained old binding after cutover and require refusal rather than stale dispatch.
    • Race stale generation, concurrent cutovers and a concurrent manual goal pause. A stale request must not overwrite the newer state. Exercise a shared server process and require honest refusal unless safe scoped detachment is actually supported.
    • Use a fixture whose ordinary shutdown deliberately clears application custody. Without a supported preservation handshake, cutover must refuse before that shutdown. With a handshake, preserve its task lease, stop, action receipt and budget while proving there is only one accepting executor.
    • Drop the caller after dispatch and inspect/retry the same original ID. Preserve actual result/uncertainty without a second action or connection owner. Test candidate initialization failure and schema incompatibility without misreporting loaded adoption.
    • Separately test a disposable persisted blocked goal across configured API resume and later remote TUI attach, capturing the initial replies and goal/turn ordering around each boundary. This can discriminate cold-resume preservation from the proposed warm connector control; it should not be tested by reopening a real blocked research conversation.

    The source currently visible at main commit f58acd6ede312266a7a0eaa63fd8dadacb4de239 retains the broad reload loop; its runtime changes do not establish this targeted preservation operation. If there is an equivalent supported owner contract, please identify its public entrypoint, scope, completion/inspection semantics and applicable release. Otherwise please disposition this as a native connection-manager prerequisite for safe initial adoption as well as refresh.

    No production thread identifiers, credentials, service endpoints, local paths, lease secrets, private case content or raw logs are included. No production connector/goal/provider operation or external code PR was performed for this analysis.

  7. derrickburns commented on Nov 3, 2026

    @derrickburns

    Additional bounded diagnostic evidence, separate from the proposed warm-connector feature:

    I ran the installed native 0.166.0 binary in an isolated configuration with no production credentials or conversations, a credential-free MCP identity fixture, and a loopback model endpoint that rejects execution. The physical native binary SHA256 was 39acf979729dd290f9a24ee38b2914e036c91b65952872e28ae2a6b88a7db7c1; this does not attest it to the release-source commit cited above.

    The fresh synthetic persisted goal was blocked. I then:

    1. Unsubscribed its last client and observed thread/closed, notLoaded, and an empty complete thread/loaded/list under the fixture's one-second unload policy.
    2. Performed configured API thread/resume with excludeTurns: true and an MCP definition, keeping that subscriber open.
    3. Attached a real remote TUI with codex resume --no-alt-screen --remote unix://<owned-fixture-socket> <synthetic-thread> without submitting user input.

    The goal stayed blocked after both boundaries, preserving objective, creation time, token budget 1000, and zero usage counters. The actual TUI displayed the resume-goal choice, with no turn-start event and no request to the rejecting model endpoint. MCP identity calls before and after unload reached different fixture process IDs, establishing that the old fixture connection was not simply retained. All owned processes were settled afterward.

    This minimal case did not reproduce goal activation. It does not establish preservation for an existing populated conversation, nonzero goal accounting, another client's configuration, a Case/cmux launcher, a production stateful MCP server or its custody transfer. It also does not add a supported warm named-server replacement operation. Two earlier fixture caller failures (wrong socket framing; omitted empty params on loaded-list) were retained and corrected; they are not asserted as Codex defects.

    This narrows the separate cold-resume question and is not a reason to reopen a real blocked conversation as a test. The proposed connector-scoped contract and stateful adoption acceptance above remain unimplemented/unverified by this diagnostic.

    Positive-control follow-up: after native input became ready, a separate disposable fixture deliberately selected the default Resume-goal choice with one Enter. The observer captured an active-goal notification and one turn start. Only the rejecting loopback model endpoint was reached; no production provider or conversation was used. The goal identity, objective, creation time and budget remained unchanged. The synthetic goal was then explicitly blocked and its synthetic turn interrupted through their supported controls before normal cleanup; the owned TUI and foreground app-server exited. Earlier input-readiness and cleanup failures are retained as fixture failures.

    The controlled contrast is: no submitted input preserved blocked state; deliberate selection activated it. This establishes that the detector can observe the transition. It does not establish that unexpected input caused any historical production activation, nor that production restore/history/custody is preserved.

  8. derrickburns commented on Nov 3, 2026

    @derrickburns

    A concrete next implementation milestone for @openai/codex-core-agent-team, separate from application configuration delivery and requester diagnostic cleanup:

    Please disposition a supported prepare/inspect contract for one already loaded thread and one named MCP connection, as the first part of preserving initial enrollment from a fixed local stdio child into a replacement or stable frontend. The application can install a future per-thread server definition without changing its current loaded connection. That independent configuration delivery does not provide the initial native cutover.

    The release-source seams remain McpRequestProcessor::mcp_server_refresh_response, which accepts null parameters and delegates to the broad reload planner, and McpRuntime::replace / replace_fresh, which publish runtime snapshots. These references identify implementation seams, not an attestation of a running binary's source or an existing scoped API.

    Proposed first contract, with method naming left to the owner:

    1. Bind an authenticated operation ID, exact loaded thread/server, expected complete registration digest and connection generation, plus the complete candidate definition. Return inspectable current identity/generation and a preservation disposition. Stale, busy, unsupported or shared-owner conditions must refuse before changing any connection, starting a second executor, or scheduling native work.
    2. For application state that needs a custody handshake, require the real server owner's prepare/retire/adopt capability. If it is missing, return an explicit unsupported-preservation disposition before shutdown or initialization. Generic MCP initialize, pipe reconnection and successful configuration installation do not transfer task leases, stops or unresolved actions.
    3. Keep prepare/inspect separate from an eventual execute operation. Execute still needs a target-only admission fence, expected-generation publication, old-binding dispatch fencing, same-original lost-reply inspection and truthful partial-cleanup outcomes. Preserve the TUI draft/view, goal identity/status/limits/accounting, history and unrelated connections. Do not use thread resume or a broad reload to implement the promise.

    The first owner acceptance can be small and decisive: two credential-free synthetic threads, a second server in the target thread, a blocked populated goal and entered draft, and a stateful stdio fixture whose ordinary shutdown discards custody. Exercise stale generation and missing custody capability through the actual native handler. Require explicit no-effect refusal, zero old shutdowns/new starts, unchanged draft/goal/other connections, and one inspectable operation after a lost reply. This prepares an honest contract boundary; it does not certify the later successful cutover.

    If an equivalent supported contract already exists, please identify its exact public entrypoint, minimum release, scope and preservation/completion semantics. Otherwise please assign/disposition this first native connection-manager milestone. This remains a capability request, not attribution of a historical goal-activation defect. No production identifiers, endpoints, credentials, custody state or raw logs are included.

  9. birbprophet commented on Nov 9, 2026

    @birbprophet

    The same limit shows up in the CLI, and it blocks the usual "paste a setup skill, sign in, keep going" flow for any remote MCP server.

    Repro with Codex CLI 0.167.0 on macOS (arm64), in a fresh CODEX_HOME with a minimal stdio MCP server that exposes one tool, ping_secret:

    1. codex exec: the agent runs codex mcp add ping -- bun ping-mcp.ts in its shell (prints Added global MCP server 'ping'.). In the same turn, ping_secret isn't among its tools.
    2. Interactive TUI: turn 1 runs the same codex mcp add. Turn 2 asks for ping_secret, and the agent answers that it has no such tool.
    3. Interactive TUI: the server is added from outside while the session runs, and then the person types /mcp. /mcp lists ping: unknown (1 tool). On the next turn the model's tool list still doesn't include it (the rollout's code-mode tool lookup returns []).
    4. codex exec resume --last on the conversation from step 1 calls ping_secret and gets the answer.

    So a server added mid-session only reaches the model in a new process. In 0.167 the TUI runs on the app-server daemon, which already has config/mcpServer/reload and the RefreshMcpServers op. An agent-callable refresh, or running that refresh after codex mcp add / codex mcp login and after /mcp, would let a person finish setup in the same conversation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appapp-serverenhancementmcp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions