feat(cms): add getPageUrl MCP tool for resolving page URLs#38
Merged
Conversation
Resolves the frontend URL for a page document by its collection and ID, working for both published and draft pages. Returns a preview URL with a token by default; pass preview=false for the canonical public URL. Mirrors the getPageUrl tool from the tm-websites repo, adapted to this repo's inline MCP plugin config and zod v4 setup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XoTWiBZkvv2xQ4UKHg7rsV
This repo's generatePageURL does not append a preview token (it only prepends the /preview path segment), so drop the inaccurate "with a token" wording. Also reword the summary to "Get the frontend page URL". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XoTWiBZkvv2xQ4UKHg7rsV
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
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.
Summary
Adds a new MCP (Model Context Protocol) tool called
getPageUrlthat allows resolving frontend page URLs for documents by their collection and ID. This tool supports both published and draft pages, with an optional preview mode.Changes
New parameter schema (
getPageUrlParameters): Defines the input parameters for the tool:collection: The page collection slug (e.g., pages, projects, articles, authors)id: The document ID (string or number)preview: Optional boolean flag to generate preview URLs (defaults to true)New MCP tool handler (
getPageUrl): Implements the tool with the following logic:Implementation Details
req.payload.findByID()withdraft: trueto support both published and unpublished pagesgeneratePageURL()utility functionoverrideAccess: falsehttps://claude.ai/code/session_01XoTWiBZkvv2xQ4UKHg7rsV