Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cli/mcp_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ The command will:
- Add the MCP tool configuration to the workflow's frontmatter
- Automatically compile the workflow to generate the .lock.yml file

Registry URL defaults to: https://api.mcp.github.com/v0`,
Registry URL defaults to: https://api.mcp.github.com/v0.1`,
Args: cobra.RangeArgs(0, 2),
RunE: func(cmd *cobra.Command, args []string) error {
verbose, _ := cmd.Flags().GetBool("verbose")
Expand Down
28 changes: 21 additions & 7 deletions pkg/cli/mcp_add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,16 +489,30 @@ func TestListAvailableServers(t *testing.T) {
testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/servers" {
response := ServerListResponse{
Servers: []Server{
Servers: []ServerResponse{
{
Name: "io.github.makenotion/notion-mcp-server",
Description: "Connect to Notion API",
Status: "active",
Server: ServerDetail{
Name: "io.github.makenotion/notion-mcp-server",
Description: "Connect to Notion API",
Version: "1.0.0",
},
Meta: map[string]any{
"io.modelcontextprotocol.registry/official": map[string]any{
"status": "active",
},
},
},
{
Name: "io.github.example/github-mcp-server",
Description: "Connect to GitHub API",
Status: "active",
Server: ServerDetail{
Name: "io.github.example/github-mcp-server",
Description: "Connect to GitHub API",
Version: "1.0.0",
},
Meta: map[string]any{
"io.modelcontextprotocol.registry/official": map[string]any{
"status": "active",
},
},
},
},
}
Expand Down
38 changes: 28 additions & 10 deletions pkg/cli/mcp_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,14 @@ func (c *MCPRegistryClient) SearchServers(query string) ([]MCPRegistryServerForP
// Convert servers to flattened format and filter by status
mcpRegistryLog.Printf("Processing %d servers from registry", len(response.Servers))
servers := make([]MCPRegistryServerForProcessing, 0, len(response.Servers))
for _, server := range response.Servers {
// Only include active servers
if server.Status != StatusActive {
continue
for _, serverResp := range response.Servers {
server := serverResp.Server

// Only include active servers (check in _meta)
if meta, ok := serverResp.Meta["io.modelcontextprotocol.registry/official"].(map[string]any); ok {
if status, ok := meta["status"].(string); ok && status != StatusActive {
continue
}
}

processedServer := MCPRegistryServerForProcessing{
Expand All @@ -139,7 +143,7 @@ func (c *MCPRegistryClient) SearchServers(query string) ([]MCPRegistryServerForP
}

// Set repository URL if available
if server.Repository.URL != "" {
if server.Repository != nil && server.Repository.URL != "" {
processedServer.Repository = server.Repository.URL
}

Expand All @@ -148,7 +152,9 @@ func (c *MCPRegistryClient) SearchServers(query string) ([]MCPRegistryServerForP
pkg := server.Packages[0]

// Use transport type from package
processedServer.Transport = pkg.Transport.Type
if pkg.Transport != nil {
processedServer.Transport = pkg.Transport.Type
}
if processedServer.Transport == "" {
processedServer.Transport = "stdio" // default fallback
}
Expand Down Expand Up @@ -312,16 +318,26 @@ func (c *MCPRegistryClient) GetServer(serverName string) (*MCPRegistryServerForP
spinner.StopWithMessage(fmt.Sprintf("✓ Fetched MCP server '%s'", serverName))

// Find exact match by name, filtering locally
for _, server := range response.Servers {
if server.Name == serverName && server.Status == StatusActive {
for _, serverResp := range response.Servers {
server := serverResp.Server

// Check status from _meta
isActive := true
if meta, ok := serverResp.Meta["io.modelcontextprotocol.registry/official"].(map[string]any); ok {
if status, ok := meta["status"].(string); ok {
isActive = (status == StatusActive)
}
}

if server.Name == serverName && isActive {
// Convert to flattened format similar to SearchServers
processedServer := MCPRegistryServerForProcessing{
Name: server.Name,
Description: server.Description,
}

// Set repository URL if available
if server.Repository.URL != "" {
if server.Repository != nil && server.Repository.URL != "" {
processedServer.Repository = server.Repository.URL
}

Expand All @@ -330,7 +346,9 @@ func (c *MCPRegistryClient) GetServer(serverName string) (*MCPRegistryServerForP
pkg := server.Packages[0]

// Use transport type from package
processedServer.Transport = pkg.Transport.Type
if pkg.Transport != nil {
processedServer.Transport = pkg.Transport.Type
}
if processedServer.Transport == "" {
processedServer.Transport = "stdio" // default fallback
}
Expand Down
17 changes: 12 additions & 5 deletions pkg/cli/mcp_registry_improvements_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,17 @@ func TestMCPRegistryClient_FlexibleValidation(t *testing.T) {
servers := make([]string, tc.serverCount)
for i := 0; i < tc.serverCount; i++ {
servers[i] = `{
"name": "test/server-` + string(rune('1'+i)) + `",
"description": "Test server",
"status": "active",
"packages": [{"identifier": "test", "transport": {"type": "stdio"}}]
"server": {
"name": "test/server-` + string(rune('1'+i)) + `",
"description": "Test server",
"version": "1.0.0",
"packages": [{"identifier": "test", "transport": {"type": "stdio"}}]
},
"_meta": {
"io.modelcontextprotocol.registry/official": {
"status": "active"
}
}
}`
}

Expand All @@ -131,7 +138,7 @@ func TestMCPRegistryClient_FlexibleValidation(t *testing.T) {
if tc.useProduction {
// For production tests, create client with production URL pattern
// but we'll need to manually test the validation logic
client = NewMCPRegistryClient("https://api.mcp.github.com/v0")
client = NewMCPRegistryClient("https://api.mcp.github.com/v0.1")
} else {
// For custom registry tests, use test server URL
client = NewMCPRegistryClient(server.URL)
Expand Down
Loading