Fix: register MCP resource URI under meta.mcp.uri - #29
Merged
Merged
Conversation
The four MCP resource abilities (gds/block-types-list, gds/site-map, gds/design-theme-json, gds/acf-fields) declared their resource URI and mimeType at the top level of `meta`. WordPress/mcp-adapter >= 0.5.0 expects these under the `mcp` namespace (`meta.mcp.uri`); the top-level location is deprecated. When the adapter's RegisterAbilityAsMcpResource cannot resolve `mcp.uri`, it returns a `resource_uri_not_found` WP_Error, which surfaced in production as: [ERROR] Resource URI not found in ability meta for 'gds/block-types-list' (also gds/site-map, gds/design-theme-json, gds/acf-fields) ~448x/day on the medihealth site. Move `uri` and `mimeType` into `meta.mcp` (the canonical, non-deprecated location) and update HelpAbility to read `meta.mcp.uri` with a top-level fallback so the help index and its test keep working. Annotations are left at the top level since the integration suite asserts on that key. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
oxyc
added a commit
that referenced
this pull request
Jun 24, 2026
…mcp (#30) 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.
Problem
Kinsta production logs (site medihealth, ~448 errors/day) show:
(also
gds/site-map,gds/design-theme-json,gds/acf-fields), emitted byWP\MCP\Domain\Resources\RegisterAbilityAsMcpResourcein theWordPress/mcp-adapterdependency.Root cause
The four MCP resource abilities declared their
uriandmimeTypeat the top level ofmeta. As ofWordPress/mcp-adapter0.5.0, the adapter resolves the resource URI frommeta.mcp.uri(the canonical location); top-levelmeta.uri/meta.mimeTypeare deprecated. Whenmcp.uriis absent the adapter returns aresource_uri_not_foundWP_Error, which is what flooded the logs.The adapter's lookup (for reference):
Fix
uriandmimeTypeintometa.mcpfor all four resource abilities (BlockCatalogResource,SiteMapResource,ThemeJsonResource,AcfFieldsResource). This is the canonical, non-deprecated location and resolves both the error and the_doing_it_wrongdeprecation notices.HelpAbilityto readmeta.mcp.uriwith a top-level fallback so the help index (andHelpAbilityTest::test_resources_include_uri) keeps working.annotationsis intentionally left at the top level becauseSchemaValidationTest::test_all_abilities_have_annotationsasserts onmeta.annotations.Verification
php -lclean on all changed filescomposer lint(Pint) — passedcomposer stan(PHPStan, level per repo config) — no errors🤖 Generated with Claude Code