MCP catalog: core-hub suggestion from MCP_HUB_URL (deployment data)
When the deployment sets MCP_HUB_URL (the Core installer now writes https://mcphub.$DOMAIN, the NEXTCLOUD_URL pattern), the MCP list appends a core-hub suggestion: the federated tool hub over SSE with the user's own mhub_ bearer token (DESIGN_MCP_HUB_AUTH.md step 3). Unset/invalid -> no suggestion; never a TIER fork. The UI renders it generically (Use prefills URL/transport/auth + token hint). Go test covers the env gate; regression fixture carries the entry.
This commit is contained in:
@@ -166,4 +166,27 @@ func TestMcpSuggestions(t *testing.T) {
|
||||
if hs["available"] != false || hs["url"] != "https://mcp.hubspot.com" {
|
||||
t.Fatalf("hubspot must be flagged OAuth-only: %v", hs)
|
||||
}
|
||||
if _, present := byKind["core-hub"]; present {
|
||||
t.Fatal("no MCP_HUB_URL -> no core-hub suggestion")
|
||||
}
|
||||
|
||||
// The core hub is deployment DATA (the NEXTCLOUD_URL pattern): present
|
||||
// only when MCP_HUB_URL is set, SSE + bearer, origin + /sse.
|
||||
t.Setenv("MCP_HUB_URL", "https://mcphub.example/")
|
||||
list = c.request("GET", "/api/mcp/connections", nil, 200)
|
||||
for _, s := range list["suggestions"].([]any) {
|
||||
m := s.(map[string]any)
|
||||
if m["kind"] == "core-hub" {
|
||||
if m["url"] != "https://mcphub.example/sse" || m["transport"] != "sse" || m["authKind"] != "bearer" || m["available"] != true {
|
||||
t.Fatalf("core-hub suggestion wrong: %v", m)
|
||||
}
|
||||
}
|
||||
}
|
||||
t.Setenv("MCP_HUB_URL", "not a url")
|
||||
list = c.request("GET", "/api/mcp/connections", nil, 200)
|
||||
for _, s := range list["suggestions"].([]any) {
|
||||
if s.(map[string]any)["kind"] == "core-hub" {
|
||||
t.Fatal("garbage MCP_HUB_URL must suggest nothing")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user