Skip to content

[BUG] Registry lookup returns wrong server when multiple servers share the same slug #165

@sergio-sisternes-epam

Description

@sergio-sisternes-epam

Describe the bug

apm mcp show and find_server_by_reference() return the wrong server when the reference contains a / and the slug after the last / is shared by multiple registry entries. For example, microsoftdocs/mcp resolves to com.supabase/mcp (Supabase) instead of the Microsoft Docs MCP server.

Root cause: search_servers() strips the reference to just the slug via _extract_repository_name() ("microsoftdocs/mcp""mcp"), then _is_server_match() compares only the extracted slugs. The first search result whose slug matches wins — regardless of the namespace/owner prefix.

To Reproduce

  1. Run apm mcp show microsoftdocs/mcp
  2. Observe the output shows com.supabase/mcp (Supabase) instead of microsoftdocs/mcp

Expected behavior

apm mcp show microsoftdocs/mcp should return the Microsoft Docs MCP server, not Supabase. When a fully-qualified name is provided (e.g., owner/name), the match should compare the full name, not just the slug.

Environment (please complete the following information):

  • OS: macOS
  • Python Version: 3.12
  • APM Version: 0.7.4
  • VSCode Version: N/A

Logs

$ apm mcp show microsoftdocs/mcp

MCP Server Details
Fetching: microsoftdocs/mcp
               📦 MCP Server: com.supabase/mcp
┃ Name            │ com.supabase/mcp
┃ Description     │ MCP server for interacting with the Supabase platform
┃ Repository      │ https://github.com/supabase-community/supabase-mcp

Additional context

Affected code in src/apm_cli/registry/client.py:

  • search_servers() — strips query to slug before calling registry API (_extract_repository_name)
  • _is_server_match() — compares only extracted slugs, ignoring the namespace prefix
  • find_server_by_reference() — iterates search results and picks the first slug match

This also affects apm install when resolving MCP dependencies by name — a wrong server could be installed silently.

Suggested fix: When the reference contains a /, compare the full name against search results first, falling back to slug-only matching only if no full match is found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedDirection approved, safe to start workbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions