Repository navigation
fix(mcp): name the searched registry and explain registry choice on a miss - #2803
Conversation
4caeade to
4d89e20
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new CHANGELOG entry does not follow the file’s existing “end with PR number” formatting pattern, so it should be adjusted for consistency/traceability.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR improves the UX of direct apm install --mcp NAME when the default GitHub MCP catalog misses an exact server name by printing a safe, copyable retry command that explicitly targets the Official MCP Registry (without any automatic cross-registry fallback).
Changes:
- Add an optional, direct-install-only hint path that prints
Try: apm install --mcp "NAME" --registry https://registry.modelcontextprotocol.ioon default-catalog misses for validated server names. - Thread a
soft_wraprendering option through the console/info logger boundary to keep the retry command as a single literal line. - Add unit coverage for direct vs manifest installs, override suppression, unsafe name suppression, and Click round-trip behavior; update docs + changelog.
File summaries
| File | Description |
|---|---|
| tests/unit/install/test_mcp_registry_config_layer.py | Adds regression tests for default-catalog misses, official-retry rendering, override suppression, and safety/determinism. |
| src/apm_cli/utils/console.py | Adds soft_wrap support to Rich-backed echo/info rendering. |
| src/apm_cli/registry/client.py | Introduces OFFICIAL_MCP_REGISTRY_URL and centralizes server-name validation via is_valid_mcp_server_name; improves hint text for flag source. |
| src/apm_cli/integration/mcp_integrator_install.py | Emits the explicit official-registry retry hint only for direct default-registry misses with validated names. |
| src/apm_cli/core/null_logger.py | Keeps logger facade signature-compatible while supporting soft_wrap info rendering. |
| src/apm_cli/core/command_logger.py | Exposes keyword-only soft_wrap option for info messages. |
| docs/src/content/docs/reference/cli/install.md | Documents the explicit retry behavior and clarifies no automatic registry switching. |
| CHANGELOG.md | Adds an Unreleased entry describing the new direct-install retry hint behavior. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
4d89e20 to
2e4b6cf
Compare
2e4b6cf to
23bf784
Compare
|
@microsoft-github-policy-service agree |
|
Hi Daniel Meppiel (@danielmeppiel) and Sergio Sisternes (@sergio-sisternes-epam) — the CLA is complete and the changelog formatting feedback has been addressed. When you have a chance, would you be able to review this? I am happy to make any requested changes. |
Mohammed Alkindi (MohammedAlkindi)
left a comment
There was a problem hiding this comment.
The retry hint keeps only the name. Running apm install --mcp ado-mcp --mcp-version 1.2.0 --target claude against the mocked default registry prints Try: apm install --mcp "ado-mcp" --registry https://registry.modelcontextprotocol.io, so copying it installs the latest version for the default targets. Carrying --mcp-version, --target and --global into the printed command would make it retry the same request.
|
Mohammed Alkindi (@MohammedAlkindi) addressed in 66ba54ca. The printed retry now retains Validation: 26 focused tests passed; testing the change with current |
|
Thank you for the work on this hint-only change. The tracking issue #2478 records the proposal, but a maintainer's confirmation of scope and review contact remains pending following the September 12 acceptance reset. Please continue the scope discussion on #2478 before treating this implementation as ready. This is advisory only, not merge or scope approval. Generated by autopilot-pr-triage-worker. This comment is AI-generated and may contain errors. |
|
Update (Daniel Meppiel (@danielmeppiel), 2026-11-12): to ship this sooner, maintainers will reshape this PR to the recorded scope now rather than waiting until 11-14. We will push to this branch where permitted, or otherwise open a successor PR that preserves your commits and authorship. Thank you for the contribution; your review of the reshaped version is welcome. Posted with AI assistance on behalf of Daniel Meppiel (@danielmeppiel). |
Co-authored-by: Copilot App <[email protected]>
Reshape the direct-install miss hint to the recorded microsoft#2478 scope: name the registry that was searched, suggest 'apm mcp search NAME' against that same registry, and show how to choose another registry with --registry <URL> or 'apm config set mcp-registry-url <URL>', where <URL> stays a literal placeholder. The example keeps --mcp-version, --target and --global. The hint now covers every direct-install source (default, flag, env, config), makes no second registry request, and is still suppressed for unsafe names or option values. Manifest-driven installs keep their existing guidance. Drops the hard-coded Official Registry URL, which would steer a mistyped name toward an uncurated catalog. Addresses apm-scope:v1 record on microsoft#2478 (issuecomment-6821449449). Co-authored-by: Vedanth Bora <[email protected]> Co-authored-by: Copilot App <[email protected]>
Add a short consumer page that neutrally lists the curated GitHub MCP Registry (default), the open-publishing Official MCP Registry, other public catalogs, and private or enterprise registries, and explains how to select one. Link it from the CLI hint, the MCP install guide, the install reference, and the apm-usage guide. Move the changelog entry to [Unreleased] with the reshaped wording. Addresses apm-scope:v1 record on microsoft#2478 (issuecomment-6821449449). Co-authored-by: Vedanth Bora <[email protected]> Co-authored-by: Copilot App <[email protected]>
…803-registry-hint
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 1 | Canonical-owner discipline respected; retry_args frozen-tuple threaded cleanly through 4 layers; hint gated to direct-install path; safety routes through is_valid_mcp_server_name. Ship. |
| Test Coverage Expert | 0 | 0 | 0 | All six DONE-WHEN criteria have integration-with-fixtures assertions; 27/27 pass, 4-mutation break gate holds. |
| CLI Logging Expert | 0 | 0 | 1 | soft_wrap plumbing is clean end-to-end; hint output follows traffic-light, ASCII-only, actionable rules; one minor simplification. |
| DevX UX Expert | 0 | 0 | 1 | Error-recovery UX is npm-familiar: search-first ordering respects typo-is-most-likely, commands correct per source, placeholder neutral; one docs polish nit. |
| Doc Writer | 0 | 2 | 1 | Docs accurate, neutral, ASCII-only; links and sidebar resolve. Scope the new page's miss example to direct installs and stop repeating the hint wording elsewhere. |
| Supply Chain Security Expert | 0 | 0 | 0 | Hint is neutral (no concrete alternative URL), credential-safe, injection-safe (two strict fullmatch regexes, fail-closed), and network-silent; ship. |
| Performance Expert | 0 | 0 | 0 | All new code is error-path only; no hot-path imports, regex recompilation, per-call overhead, or extra network requests. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 5 follow-ups
- [Doc Writer] Fix the new page's miss section: scope it to direct installs, add the docs-link line to the CLI block, and add the per-dependency registry: override to the precedence sentence. -- The page is the canonical entry point for registry-miss confusion; implying manifest installs get the hint will confuse the exact users it targets.
- [Doc Writer] State the hint wording once (choosing-an-mcp-registry.md) and cross-reference it from install.md, apm-usage commands.md, and CHANGELOG. -- Three copies of the same behavior description will drift on the next hint change.
- [Python Architect] Collapse the redundant if/else soft_wrap branch in CommandLogger.info() and NullCommandLogger.info() to a single _rich_info call. -- Both branches are identical except for the already-parameterized kwarg; convergent nit from two panelists.
- [DevX UX Expert] Add a one-line note in the docs example acknowledging that --registry and MCP_REGISTRY_URL misses show adapted hint variants. -- Users with a custom registry will otherwise see output that does not match the docs example.
- [Doc Writer] Align mcp.md and config.md terminology: replace 'public MCP registry' with the curated default wording and link the new page. -- Readers may read 'public' as the open Official MCP Registry.
Architecture
classDiagram
direction LR
class MCPIntegrator {
<<Namespace>>
+prevalidate_registry_dependencies(mcp_deps, retry_args) dict
}
class CommandLogger {
<<Base>>
+info(message, symbol, soft_wrap) void
+error(message) void
+progress(message) void
}
class NullCommandLogger {
<<NullObject>>
+info(message, symbol, soft_wrap) void
}
class SimpleRegistryClient {
<<Transport>>
+get_server(name, version) dict
+registry_url str
+registry_url_source str
}
class MCPServerOperations {
+validate_servers_exist(names) tuple
+registry_client SimpleRegistryClient
}
class PrevalidatedRegistryServers {
<<ValueObject>>
+source str
+registry_url str
}
class mcp_integrator_install_mod {
<<Module>>
+prevalidate_registry_dependencies()
-_validate_registry_servers()
-_registry_choice_hint_is_safe()
-_emit_registry_choice_hint()
}
class registry_client_mod {
<<Module>>
+is_valid_mcp_server_name() bool
+redact_mcp_registry_url() str
}
MCPIntegrator ..> mcp_integrator_install_mod : delegates
mcp_integrator_install_mod ..> MCPServerOperations : creates
mcp_integrator_install_mod ..> registry_client_mod : validates names
mcp_integrator_install_mod ..> CommandLogger : emits hint
MCPServerOperations *-- SimpleRegistryClient : owns
SimpleRegistryClient ..> registry_client_mod : uses
mcp_integrator_install_mod ..> PrevalidatedRegistryServers : returns
class MCPIntegrator:::touched
class CommandLogger:::touched
class NullCommandLogger:::touched
class mcp_integrator_install_mod:::touched
class registry_client_mod:::touched
classDef touched fill:#fff3b0,stroke:#d47600
flowchart TD
A["User: apm install --mcp NAME --mcp-version V --target T --global"] --> B
B["_handle_mcp_install -- commands/install.py<br/>builds retry_args tuple"] --> C
C["run_mcp_install -- install/mcp/command.py<br/>threads retry_args"] --> D
D["MCPIntegrator.prevalidate_registry_dependencies<br/>integration/mcp_integrator.py -- delegates"] --> E
E["prevalidate_registry_dependencies<br/>integration/mcp_integrator_install.py<br/>suggest_registry_choice=True"] --> F
F{"[NET] validate_servers_exist<br/>invalid_servers?"}
F -- "all found" --> G["Return _PrevalidatedRegistryServers; continue install"]
F -- "miss" --> H["logger.error: not found in registry URL: names"]
H --> I{"direct-install source and<br/>_registry_choice_hint_is_safe?"}
I -- "safe" --> J["_emit_registry_choice_hint<br/>apm mcp search NAME<br/>apm install --mcp NAME --registry URL placeholder + opts<br/>apm config set mcp-registry-url URL placeholder<br/>docs link"]
I -- "unsafe name or option" --> K["logger.progress: generic apm mcp search hint"]
J --> M["raise RuntimeError; exit non-zero"]
K --> M
Recommendation
Ship after folding the two doc-writer recommended items (scope the miss section to direct installs; state the hint wording once). The remaining nits (soft_wrap branch collapse, docs variant note, terminology alignment) are worth folding in the same pass. Security, test-coverage, and performance signals are all green; the posture -- registry-neutral, fail-closed, community-originated -- is where APM should be.
Full per-persona findings
Python Architect
- [nit] soft_wrap branch in CommandLogger.info() and NullCommandLogger.info() is redundant at
src/apm_cli/core/command_logger.py:129
A single _rich_info(message, symbol=symbol, soft_wrap=soft_wrap) call is equivalent.
Test Coverage Expert
No findings.
CLI Logging Expert
- [nit] Redundant if/else branch in CommandLogger.info() and NullCommandLogger.info() can be a single call at
src/apm_cli/core/command_logger.py:127
Both branches call _rich_info identically except soft_wrap; avoids a future maintenance trap.
DevX UX Expert
- [nit] Docs 'not found' example only shows the default-source variant; one line could acknowledge flag/env adaptation at
docs/src/content/docs/consumer/choosing-an-mcp-registry.md:46
Terminal output for --registry or MCP_REGISTRY_URL misses differs slightly from the docs example.
Doc Writer
- [recommended] The new page's miss section implies every miss gets the hint, omits the docs-link line, and the precedence sentence omits the per-dependency registry: override at
docs/src/content/docs/consumer/choosing-an-mcp-registry.md:31
Manifest-driven installs keep old guidance; CLI blocks should be literal. - [recommended] Full hint wording is restated in install.md, apm-usage commands.md and CHANGELOG instead of stated once and linked at
docs/src/content/docs/reference/cli/install.md:217
State once, reference elsewhere; three copies will drift; non-bloat rule. - [nit] mcp.md and config.md still call the default the 'public MCP registry', clashing with curated-vs-open terms; mcp.md does not link the new page at
docs/src/content/docs/reference/cli/mcp.md:8
Readers may read 'public' as the Official MCP Registry.
Supply Chain Security Expert
No findings.
Performance Expert
No findings.
This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.
Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.
Fold the review panel follow-ups on microsoft#2803. Scope the new page's miss section to direct installs, make its CLI block literal (docs link line), note the --registry and MCP_REGISTRY_URL variants, and add the per-dependency registry: override to the precedence sentence. Replace the restated hint wording in the install reference, the apm-usage guide and CHANGELOG with a short pointer to the page. Call the default the curated GitHub MCP Registry in the mcp and config references instead of "public", and link the new page from apm mcp. Comment why CommandLogger.info keeps a separate soft_wrap branch: it preserves the existing _rich_info call shape. Addresses panel follow-ups FU-1, FU-2, FU-4, FU-5 (doc-writer, devx-ux-expert) and the architect/logging soft_wrap nit. Co-authored-by: Vedanth Bora <[email protected]> Co-authored-by: Copilot App <[email protected]>
…803-registry-hint
…803-registry-hint
Delta panel (doc-writer): the docs-link line now ends the hint, so the MCP_REGISTRY_URL variant swaps the 'Or ...' line, not the last line. Co-authored-by: Vedanth Bora <[email protected]> Co-authored-by: Copilot App <[email protected]>
…803-registry-hint
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Doc Writer | 0 | 1 | 0 | Prior findings resolved; one new "last line" inaccuracy, folded in be7a851. |
| CLI Logging Expert | 0 | 0 | 0 | Decline-with-comment on the soft_wrap branch is sound; no output UX regression. |
| Test Coverage Expert | 0 | 0 | 0 | Delta is docs prose and two comments; no new coverage gap. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Recommendation
All five follow-ups from the full pass are resolved: four folded, one declined with test-backed rationale, and the residual fold inaccuracy caught and corrected. No open findings. Ready to land once CI on 6dfdae5 confirms.
Full per-persona findings
Doc Writer
- [recommended] Variant note said an MCP_REGISTRY_URL miss changes the "last line", but the docs-link line now comes last at
docs/src/content/docs/consumer/choosing-an-mcp-registry.md:48
Resolved in be7a851: the note now names theOr ...line.
CLI Logging Expert
No findings.
Test Coverage Expert
No findings.
This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.
Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.
…803-registry-hint
4e508d4
into
microsoft:main
* fix(tests): restore release-gate lanes for 0.36.0 Main's tag-gate lanes (build-release push + manual-build-release) were red on runs 43381609442, 43381682871 and 43394173235. PR CI never runs them. Product regressions (Windows/real installs), fixed: - Hook cleanup removed nothing on Windows: remove_stale_deployed_files looked up recorded hashes with POSIX keys while callers passed native backslash keys, so content proof failed closed (#3672, Refs #3649). - describe_path_obstruction returned None on Windows, which reports a directory-for-file as EACCES and a file-for-parent as ENOENT instead of EISDIR/ENOTDIR (#3709, Refs #3678). - Skill preflight refused claimed members of an unclaimed, populated skill directory that materialization leaves alone, failing a local bundle install (Refs #3625). Stale tests (behaviour changed intentionally), updated: - policy chain mocks now return real PolicyFetchResult (#2933, Refs #2753) - bare-cache/downloader/anonymous-https fixtures use real Git checkouts (#3603, Refs #3457) - mcp install help, registry error wording, deps why -g help (#3633 Refs #3588, #2803 Refs #2478, #3614 Refs #2884) - downloader stub carries carried_licenses (#3646, Refs #3556) - frozen-hash lifecycle uses a generic git host so -g URL validation uses git ls-remote instead of a live api.github.com 404 (#3672) New Windows-shaped regression tests are marked windows_compat. Co-authored-by: Copilot App <[email protected]> * chore: spec waiver for release-gate repair apm-spec-waiver: restores pre-existing behaviour on Windows and in skill preflight; no OpenAPM-observable change Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: danielmeppiel <[email protected]> Co-authored-by: Copilot App <[email protected]>
Description
When a direct
apm install --mcp NAMElookup finds no exact match, the error names the registry that was searched and prints a neutral hint. It suggestsapm mcp search NAMEagainst that same registry and shows how to choose another registry.<URL>stays a literal placeholder. The example keeps--mcp-version,--targetand--global:APM makes no second registry request and never switches registries. The hint covers every direct-install source: the default,
--registry,MCP_REGISTRY_URLandapm config. It is suppressed for unsafe names or option values, and manifest-driven installs keep their existing guidance. A new docs page, "Choosing an MCP registry", neutrally lists the curated GitHub MCP Registry (default), the open-publishing Official MCP Registry, other public catalogs and private or enterprise registries. The page is linked from the hint, the MCP install guide, the install reference and the apm-usage guide.Maintainer reshape (2026-11-12): Vedanth Bora (@VedanthB)'s option preservation, safe-token suppression, single-line rendering and server-name validator are kept. The hard-coded Official MCP Registry URL is replaced by the neutral wording recorded in the approved scope, and the docs page is added. The contributor's commits are preserved; reshape commits carry a
Co-authored-bytrailer for Vedanth Bora (@VedanthB).Issue and approved scope
Issue: Fixes #2478
Human scope-approval comment: #2478 (comment) (apm-scope:v1, Decision: approve, review contact Daniel Meppiel (@danielmeppiel))
This PR completes the approved scope. Automatic fallback, endorsing a specific alternative registry, changing the default registry, registry allow/deny policy and manifest-driven installs are out of scope.
Type of change
Testing
tests/unit/install/test_mcp_registry_config_layer.pycovers the following:<URL>replaced by a chosen registry, and--mcp-version, targets and scope survive.The mutation-break gate passed. Removing the safety guard, replacing the placeholder with a concrete URL, narrowing the sources, or enabling the hint on the manifest path each fails the suite.
Spec conformance (OpenAPM v0.1)
Original description by Vedanth Bora (@VedanthB) (superseded by the reshape above)
Description
When a direct
apm install --mcp NAMElookup misses the default GitHub catalog, print a copyable command to retry that exact name against the Official MCP Registry. The retry preserves--mcp-version,--targetand--globalfrom the original request. APM makes no automatic second registry request.For example:
Manifest installs and explicit registry overrides keep their existing guidance. Unsafe names or option values suppress the copyable hint.
Fixes #2478.
Implementation
Type of change
Testing
Validation for this follow-up:
mainatf65ac263: 23,989 unit/console tests passed, 42 skipped, 21 xfailed; the focused integrator/console slice passed 84 tests. Ruff check/format, duplicate-code and authentication-boundary checks also passed on that tree.How to test
uv run pytest tests/unit/install/test_mcp_registry_config_layer.py -q.Try:command.Spec conformance (OpenAPM v0.1)
AI assistance was used; the contributor remains responsible for the change.