Skip to content

fix(mcp): read get-page content from content body#1304

Open
onmax wants to merge 2 commits intonuxt-content:mainfrom
onmax:fix/mcp-worker-get-page
Open

fix(mcp): read get-page content from content body#1304
onmax wants to merge 2 commits intonuxt-content:mainfrom
onmax:fix/mcp-worker-get-page

Conversation

@onmax
Copy link
Contributor

@onmax onmax commented Mar 11, 2026

Follow-up to #1302.

Summary

get-page now derives its url from the incoming request origin, which is correct for proxied and deployed environments. The remaining problem is that it still fetches its markdown body by issuing an HTTP request back to /raw${path}.md.

That works locally, but on Cloudflare Workers the same-worker subrequest returns 404, so list-pages works while get-page fails with Failed to get page.

This keeps the request-origin URL behavior but removes the HTTP self-fetch. Instead, get-page reads the page body directly from the Content DB, serializes the minimark AST, and reconstructs markdown-like content with frontmatter.

Reproduction

Variant Source Deployed worker Result
Bug onmax/repros/docus-mcp-get-page-worker-repro docus-mcp-get-page-repro.je-cf9.workers.dev get-page returns Failed to get page
Fix onmax/repros/docus-mcp-get-page-worker-repro-fix docus-mcp-get-page-repro-fix.je-cf9.workers.dev get-page returns serialized page content

Verify

Broken worker:

curl -sS \
  -H 'accept: application/json, text/event-stream' \
  -H 'content-type: application/json' \
  -X POST https://docus-mcp-get-page-repro.je-cf9.workers.dev/mcp \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get-page","arguments":{"path":"/test"}}}'

Fixed worker:

curl -sS \
  -H 'accept: application/json, text/event-stream' \
  -H 'content-type: application/json' \
  -X POST https://docus-mcp-get-page-repro-fix.je-cf9.workers.dev/mcp \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get-page","arguments":{"path":"/test"}}}'

Local source verification:

pnpm typecheck

@vercel
Copy link

vercel bot commented Mar 11, 2026

@onmax is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 11, 2026

Open in StackBlitz

npm i https://pkg.pr.new/create-docus@1304
npm i https://pkg.pr.new/docus@1304

commit: f5c00e4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant