Skip to content

Docker MCP Gateway does not refresh updated env config for existing client sessions #463

@heckradr

Description

@heckradr

Docker MCP Gateway does not pick up updated server config until the client session is restarted

Summary

When using a Docker MCP server with runtime configuration managed via docker mcp config write, the native Docker MCP CLI picks up new values immediately, but a long-lived MCP client session may continue using stale values until the client session is restarted.

This appears to be a Docker MCP Gateway issue rather than a Codex-specific issue. Codex is just one example client where the behavior is reproducible.

Environment

  • Docker MCP CLI v0.40.3
  • Windows 11
  • Local Docker MCP server: mcp-test (written in c#, prints the env vars to the output)
  • Reproduced with Codex CLI as MCP client

Expected behavior

After updating server config with:

docker mcp config write '{"mcp-test":{"test1":"new-value","test2":"other-value"}}'

subsequent MCP tool calls from an already connected client session should use the new config values without requiring a full client restart.

Actual behavior

  • Native Docker MCP CLI reflects the new values immediately:
docker mcp tools call get_status
  • An already connected MCP client session may continue using stale values.
  • Removing and re-adding the server in the client session may not be sufficient.
  • Disabling and re-enabling the server may not be sufficient.
  • Restarting the client process makes the new values appear.

Why this looks like a Docker MCP Gateway issue

The server process/container is started fresh per tool call, so this does not look like container-level caching.

The more likely explanation is that the Docker MCP Gateway or a related session layer caches resolved server configuration and does not refresh it when docker mcp config write changes the stored config.

Reproduction steps

  1. Register a Docker MCP server whose runtime values come from Docker MCP config.
  2. Confirm current values:
docker mcp tools call get_status
  1. Update config:
docker mcp config write '{"mcp-test":{"test1":"gamma","test2":"delta"}}'
  1. Confirm native Docker MCP CLI sees the new values immediately:
docker mcp tools call get_status
  1. From an already connected MCP client session, call the same MCP tool again.
  2. Observe that the client may still receive stale values.
  3. Restart the client session.
  4. Call the MCP tool again.
  5. Observe that the new values now appear.

Example with Codex as client

This was reproduced with Codex CLI connected to Docker MCP.

Observed behavior:

  • docker mcp tools call get_status showed updated values immediately.
  • Codex MCP calls sometimes continued to show old values until Codex CLI was restarted.

This suggests the issue is not specific to Codex logic itself, but to how the Docker MCP Gateway exposes updated config to already connected clients.

Why this matters

A common MCP deployment model is to publish a reusable server image to a registry and update runtime behavior through docker mcp config write.

If already connected clients do not see config changes until restart, runtime configuration becomes much less useful operationally.

Suggested fix

The Docker MCP Gateway should reload or invalidate resolved server configuration when:

  • docker mcp config write updates server config
  • a client re-adds or re-enables a server
  • or a new tool call is issued for a server whose config changed

At minimum, there should be an explicit reload/reconnect mechanism that refreshes live server config for already connected clients without requiring a full client restart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions