Skip to content

Conversation

goshlanguage
Copy link

@goshlanguage goshlanguage commented Aug 8, 2025

I needed to add colima in order to use thv in my current setup. Opening as draft as I'm traveling as I write this PR and haven't given due diligence of going through the Dev Guide. Hoping to share for guidance.

Before:

bin/thv client setup                       
A new version of ToolHive is available: v0.2.5
Currently running: v8ef1a70-dirty
Error: failed to create client manager: no supported container runtime available: container runtime not found

After:

bin/thv client setup
A new version of ToolHive is available: v0.2.5
Currently running: v8ef1a70-dirty
Successfully registered client: vscode
Successfully registered client: cursor
10:02AM INF Creating new client config file at /Users/rhartje/Library/Application Support/Code/User/mcp.json
10:02AM INF Creating new client config file at /Users/rhartje/.cursor/mcp.json

@@ -186,6 +186,8 @@ const (
TypeDocker Type = "docker"
// TypeKubernetes represents the Kubernetes runtime
TypeKubernetes Type = "kubernetes"
// TypeColima represents the Colima runtime
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be necessary - it looks like you are using the Docker runtime to connect to Colima. This enum is used for different implementations of our runtime interface.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In review, I'm checking in the Docker runtime if there is a path override in the Docker runtime check, but I'm also checking explicitly if its Colima:
https://github.com/stacklok/toolhive/pull/1332/files#diff-d58624f599f4b93a4c84d22c3d24888c6a2c57855eb451ccc72815d5cda9667bR88-R94

I'd like not to remove this, because if I do, then the user has to know and explicitly override the Docker socket to the Colima socket, which requires discovery of this in the docs or otherwise.

What are your thoughts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the Colima check from there and instead add it to findDockerSocket, similar to what we currently have for Rancher Desktop:

// Try Rancher Desktop socket path on macOS
if home := os.Getenv("HOME"); home != "" {
rancherDesktopPath := filepath.Join(home, RancherDesktopMacSocketPath)
_, err := os.Stat(rancherDesktopPath)
if err == nil {
logger.Debugf("Found Rancher Desktop socket at %s", rancherDesktopPath)
return rancherDesktopPath, nil
}
logger.Debugf("Failed to check Rancher Desktop socket at %s: %v", rancherDesktopPath, err)
}

With that you'll be able to remove all the other changes to client_unix.go.

@dmjb
Copy link
Member

dmjb commented Aug 13, 2025

@goshlanguage This makes sense to me. Feel free to update the branch and take it out of draft status.

@goshlanguage goshlanguage marked this pull request as ready for review August 13, 2025 17:16
@JesseObrien
Copy link

JesseObrien commented Aug 19, 2025

I added a PR that does almost exactly the same thing. I wanted to 👍 the support for this PR. I updated all of the docs to include Colima in mine.

@eleftherias eleftherias self-assigned this Aug 21, 2025
Copy link
Member

@eleftherias eleftherias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @goshlanguage! I've added a suggestion inline about how this could be simplified.

@@ -186,6 +186,8 @@ const (
TypeDocker Type = "docker"
// TypeKubernetes represents the Kubernetes runtime
TypeKubernetes Type = "kubernetes"
// TypeColima represents the Colima runtime
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the Colima check from there and instead add it to findDockerSocket, similar to what we currently have for Rancher Desktop:

// Try Rancher Desktop socket path on macOS
if home := os.Getenv("HOME"); home != "" {
rancherDesktopPath := filepath.Join(home, RancherDesktopMacSocketPath)
_, err := os.Stat(rancherDesktopPath)
if err == nil {
logger.Debugf("Found Rancher Desktop socket at %s", rancherDesktopPath)
return rancherDesktopPath, nil
}
logger.Debugf("Failed to check Rancher Desktop socket at %s: %v", rancherDesktopPath, err)
}

With that you'll be able to remove all the other changes to client_unix.go.

@goshlanguage
Copy link
Author

goshlanguage commented Aug 26, 2025

@eleftherias seems that your suggestion then will only work for Colima on mac, and not colima on linux. Are you sure that's what we want? Means I still can't use this on my linux environments.

edit: I haven't confirmed, so I will test this. I do like less code

@goshlanguage
Copy link
Author

yeah unfortunately it looks like that's not a compatible approach:

➜  toolhive git:(support-colima) ./bin/thv client setup
A new version of ToolHive is available: v0.2.13
Currently running: vf0c65e0
Error: failed to create client manager: no supported container runtime available: container runtime not found

Copy link
Member

@eleftherias eleftherias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for trying it out on Linux! We do want it to work on both.
With the current proposal does it work on Linux, or is there still more to be done?

@@ -38,6 +38,7 @@ require (
go.opentelemetry.io/otel/sdk v1.37.0
go.opentelemetry.io/otel/sdk/metric v1.37.0
go.uber.org/mock v0.5.2
golang.ngrok.com/ngrok/v2 v2.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change still needed?

@@ -157,5 +166,18 @@ func findDockerSocket() (string, error) {
logger.Debugf("Failed to check Rancher Desktop socket at %s: %v", rancherDesktopPath, err)
}

// Try Rancher Desktop socket path on macOS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
// Try Rancher Desktop socket path on macOS
// Try Colima socket path on macOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants