-
Notifications
You must be signed in to change notification settings - Fork 145
Closed
Labels
bugSomething isn't workingSomething isn't workingcliChanges that impact CLI functionalityChanges that impact CLI functionalityenhancementNew feature or requestNew feature or request
Description
ToolHive doesn't immediately update clients when creating proxies and containers, but it is too quick for some clients leading to issues like #2271. There was a bit of investigation here. Basically, initialise needs to be ready 0.1s after the cursor client is updated.
The current sequence:
Step 1: Container Deployment
- Calls runtime.Setup() to deploy the container
- For Kubernetes: Waits up to 2 minutes for the StatefulSet to become ready
- For Docker: Containers are created and started synchronously, but there's no explicit readiness check beyond Docker's API confirmation
Step 2: Transport/Proxy Start
- Creates and starts the HTTP proxy server
- Only proceeds if this succeeds
Step 3: Client Update
- ONLY AFTER both container deployment AND transport start succeed
- Calls clientManager.AddServerToClients() to update client configurations
To make this work we could get the proxy/toolhive to only update clients after it has called a successful initialise.
Alternatively, we could do the equivalent of a k8s health check and not set up the proxy until after it completes health checks. This does have the disadvantage or requiring MCP server to know about health checks. The other approach should work with any MCP server.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcliChanges that impact CLI functionalityChanges that impact CLI functionalityenhancementNew feature or requestNew feature or request