You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add reconnect_on_use for on-demand upstream reconnection (#363)
* feat: add reconnect_on_use option for on-demand upstream reconnection
When enabled per-server, tool calls targeting a disconnected upstream
will trigger a bounded immediate reconnect attempt (15s timeout)
before failing. If reconnection succeeds, the tool call is retried
automatically. This improves UX for intermittent servers like remote
devtools, SSH tunnels, and OAuth-backed services.
Key implementation details:
- New `reconnect_on_use` field in ServerConfig (opt-in, default false)
- New `TryReconnectSync()` method on managed.Client for synchronous
reconnection (vs ForceReconnect which is async)
- Manager.CallTool() releases m.mu.RLock during reconnect to avoid
blocking other operations
- Reconnect is skipped for user-logged-out, quarantined, or
already-connecting servers
- Uses existing reconnectInProgress flag to prevent storms
- Concurrent callers wait for in-progress reconnect via polling
Fixes#354
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: regenerate OpenAPI spec for reconnect_on_use field
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: wire reconnect_on_use through REST API, storage, and server list
The reconnect_on_use config field was only added to the config struct
and manager logic but was missing from the full persistence chain:
- REST API AddServerRequest and PatchServer handler
- BBolt storage (UpstreamRecord, Save/Get/List)
- Runtime server map for StateView
- Management service ListServers converter
- Contract types for API response
- CLI client AddServerRequest
- UpdateServer method in server.go
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: regenerate OpenAPI spec for reconnect_on_use field
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Code <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/configuration.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,6 +153,7 @@ MCPProxy looks for configuration in these locations (in order):
153
153
|`isolation`| object | No | Per-server Docker isolation settings (see [Docker Isolation](#docker-isolation)) |
154
154
|`enabled`| boolean | No | Enable/disable server (default: `true`) |
155
155
|`quarantined`| boolean | No | Security quarantine status (default: `false` for manually added servers, `true` for LLM-added servers) |
156
+
|`reconnect_on_use`| boolean | No | When `true`, tool calls to a disconnected server trigger an immediate reconnect attempt (15s timeout) before failing (default: `false`) |
156
157
|`created`| string | No | ISO 8601 timestamp (auto-generated) |
157
158
|`updated`| string | No | ISO 8601 timestamp (auto-updated) |
ReconnectOnUsebool`json:"reconnect_on_use,omitempty" mapstructure:"reconnect-on-use"`// Attempt reconnection when a tool call targets a disconnected server
197
198
}
198
199
199
200
// OAuthConfig represents OAuth configuration for a server
0 commit comments