Provide resource URI in both meta.uri and meta.mcp.uri (adapter version collision) - #30
Merged
Merged
Conversation
PR #29 moved the resource `uri`/`mimeType` for the four MCP resource abilities (gds/block-types-list, gds/site-map, gds/design-theme-json, gds/acf-fields) out of top-level `meta` and into `meta.mcp`, on the assumption that medihealth runs WordPress/mcp-adapter >= 0.5.0 (which reads `meta.mcp.uri`). The `resource_uri_not_found` error is still firing in production on medihealth (~83x/day, latest 2026-06-24 08:02) despite #29 being deployed (gds-mcp dev-master f1ae4aa, deployed 2026-06-23 16:57). Root cause: the error text in production is "...URI must be provided in ability meta data." — this is the PRE-0.5.0 adapter message. v0.5.0's message is "...URI must be provided at 'mcp.uri'." The pre-0.5.0 RegisterAbilityAsMcpResource::get_uri() reads ONLY top-level `meta.uri` and has no knowledge of `meta.mcp.uri`. So medihealth's actually-running adapter is < 0.5.0 even though its composer.lock pins v0.5.0 (ref 7bfc49f4) — the deployed vendor/ is stale relative to the lockfile. By moving `uri` exclusively into `meta.mcp`, #29 removed the only location the deployed adapter reads, so the URI became unresolvable and the error persists. Fix: declare `uri`/`mimeType` in BOTH top-level `meta` AND `meta.mcp` for all four resource abilities. This is adapter-version agnostic: - adapter < 0.5.0 finds top-level `meta.uri`; - adapter >= 0.5.0 finds `meta.mcp.uri` first (so no deprecation `_doing_it_wrong` notice is triggered). HelpAbility already reads `meta.mcp.uri ?? meta.uri`, and the meta-shape tests (HelpAbilityTest::test_resources_include_uri, SchemaValidationTest) remain satisfied. Note: the real underlying issue is the adapter-version skew on medihealth (deployed vendor < lockfile). This change makes gds-mcp robust across adapter versions regardless, but medihealth should also be redeployed so vendor/wordpress/mcp-adapter actually matches v0.5.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
oxyc
added a commit
that referenced
this pull request
Jul 31, 2026
…recation (#31) mcp-adapter 0.5.0 resolves resource meta through get_mcp_meta(), which prefers meta.mcp.{key} and logs a deprecation notice when it falls back to the top-level key. #29/#30 moved uri/mimeType into meta.mcp but left annotations at the top level, so every WP-CLI run logged four notices: Ability meta key "annotations" is deprecated. Use "mcp.annotations" instead. | Context: {"ability":"gds/block-types-list", ...} Mirror annotations into meta.mcp for the four resource abilities. The top-level copy stays: RegisterAbilityAsMcpTool still reads only $ability_meta['annotations'] in 0.5.0, and adapters < 0.5.0 read top-level for resources too. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
Production (medihealth) logs
Resource URI not found in ability meta for 'gds/block-types-list'(andgds/site-map,gds/design-theme-json,gds/acf-fields) continuously — every MCP resource registration fails. This persisted after #29 shipped and deployed.Root cause: two copies of
wordpress/mcp-adapter, older one wins the autoloadThere are two mcp-adapter installs on disk, both registering the
WP\MCP\namespace:web/app/plugins/mcp-adapter/meta.mcp.uri(with top-level fallback)web/app/plugins/woocommerce/vendor/wordpress/mcp-adapter/meta.urionlyWooCommerce bundles its own older copy, and its v0.4.1 autoloader wins, so v0.4.1 is the code actually executing. #29 moved
uri/mimeTypeout of top-levelmetaand intometa.mcp— correct for v0.5.0, but it removed the URI from exactly where the running v0.4.1 reads it → "Resource URI not found".Verified on the prod server
...at 'mcp.uri'), gds-mcp =f1ae4aa9(Fix: register MCP resource URI under meta.mcp.uri #29 deployed),BlockCatalogResourcehas'uri' => 'blocks://catalog'undermeta.mcp— all correct....in ability meta data) firing right up to "now".grep -rln "in ability meta data" ~/public/current/→.../plugins/woocommerce/vendor/wordpress/mcp-adapter/.../RegisterAbilityAsMcpResource.php(the v0.4.1 copy).So this is not OPcache and not a stale deploy — a PHP restart/redeploy does nothing. It's a duplicate-package namespace collision.
Fix (this PR)
Declare
uri/mimeTypein both top-levelmetaandmeta.mcpfor all 4 resource abilities (BlockCatalogResource, SiteMapResource, ThemeJsonResource, AcfFieldsResource). This resolves regardless of which adapter wins:meta.uri✓meta.mcp.urifirst (so no_doing_it_wrongdeprecation notice) ✓HelpAbilityalready readsmeta.mcp.uri ?? meta.uri.php -lclean;composer lint(pint) +composer stan(phpstan) pass; meta-shape tests unaffected (uri still present atmcp.uri).Follow-up (separate, not this PR)
The cleaner long-term fix is to eliminate the duplicate adapter so only one version loads — i.e. stop WooCommerce's bundled v0.4.1 from registering (composer-level dedupe, or a small mu-plugin forcing the v0.5.0 autoload first). Carrying two versions of the same library risks other conflicts. This PR makes gds-mcp robust either way in the meantime.
🤖 Generated with Claude Code