-
Notifications
You must be signed in to change notification settings - Fork 23
Description
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
- Run
apm mcp show microsoftdocs/mcp - Observe the output shows
com.supabase/mcp(Supabase) instead ofmicrosoftdocs/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 prefixfind_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.