Skip to content

feat(mcp): expose every documentation page as a resource - #48

Closed
benjamincanac wants to merge 1 commit into
mainfrom
feat/mcp-page-resources
Closed

benjamincanac wants to merge 1 commit into
mainfrom
feat/mcp-page-resources

Conversation

@benjamincanac

@benjamincanac benjamincanac commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

What

The MCP server now exposes every documentation page as a resource. A docs://page{+route} template lists one resource per page, with the page title, description and text/markdown, and reading one returns the same document /raw/<path>.md serves, resolved through getAgentDocument like the get-page tool. @modelcontextprotocol/sdk becomes a direct dependency for ResourceTemplate.

Why

The toolkit advertises the resources capability in the initialize handshake, but resources/list came back empty on every site built on the layer, which agent readiness audits score as a failure. Pages are the one thing these sites have to offer as resources, and listing them through the template keeps the list in sync with the content without a static resource per page.

Summary by CodeRabbit

  • New Features

    • Added an MCP documentation resource that lists available pages and serves individual pages as Markdown.
    • Added support for resolving documentation page resource links, including URLs with query parameters or fragments.
  • Tests

    • Added coverage for documentation resource link creation, parsing, and validation.

@coldtea-pr-lens

coldtea-pr-lens Bot commented Sep 16, 2026

Copy link
Copy Markdown

◈ PR Lens

🟢 +1 new · 🟠 ~1 changed · 🔴 -0 removed · 1 flow · 5 files · commit 543666b


Architecture

Architecture diagram for comarkdown/comark-docs at 543666b

2 components touched across 3 lanes.

Open the interactive canvas


Data flow

Data flow diagram for comarkdown/comark-docs at 543666b

Reading a documentation page resource

Open the interactive canvas


View

  • Architecture lens
  • Data flow lens
  • Expand every detail

Tip

The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change.

🪧 More tips
  • Run npx skills add coldteadotai/pr-lens, then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Run npx @coldtea/pr-lens-cli analyze --base origin/main on a branch, then npx @coldtea/pr-lens-cli render .pr-lens/graph.json. Same lenses, your own model key, before the pull request exists.
  • Untick Architecture lens or Data flow lens under View to hide a diagram, or tick Expand every detail to open every section. The comment redraws in a few seconds.
  • Click the link under each diagram to open it on a canvas you can zoom, pan and step through.
  • Open a diagram on the canvas, then press W or click play to walk through the change one step at a time.
  • The CLI's render reads .github/pr-lens.yml and applies your renames, exclusions and lane pins at draw time.
  • Set github.comment.collapsed: true in .github/pr-lens.yml to fold the comment behind one View architecture and data flow row. Drawing still runs on every push.
  • Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and your model provider's key as its api-key to run PR Lens from your own CI. Any /chat/completions endpoint works.
  • Push a commit and the comment redraws for the new head. A slow older run never overwrites a newer one.
  • Switch GitHub to dark mode and the diagrams follow. The moving dots are this pull request's data in motion.

Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

@vercel

vercel Bot commented Sep 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
comark-docs-layer Ready Ready Preview Sep 16, 2026 9:03am UTC

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0d48a190-2577-414c-b3da-54aafcbb3f55

📥 Commits

Reviewing files that changed from the base of the PR and between 2d97ac1 and 543666b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • package.json
  • server/mcp/resources/page.ts
  • server/utils/agent-resources.ts
  • test/agent-resources.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change adds MCP support for listing and reading discovered documentation pages. It introduces URI helpers for page resources, validates routes, returns Markdown content, and adds Vitest coverage.

Changes

MCP documentation page resource

Layer / File(s) Summary
Page resource URI contract
server/utils/agent-resources.ts, test/agent-resources.test.ts
The new helpers construct docs://page URIs and extract normalized routes. Tests cover strings, URL objects, query and fragment removal, and invalid URIs.
MCP page listing and reading
package.json, server/mcp/resources/page.ts
The MCP SDK is added as a runtime dependency. The page resource lists discovered pages and returns Markdown for valid routes. Missing, unavailable, and redirected pages raise not-found errors.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant MCPClient
  participant pageResource
  participant DocumentationDiscovery
  MCPClient->>pageResource: list page resources
  pageResource->>DocumentationDiscovery: read discovered pages
  DocumentationDiscovery-->>pageResource: return routes and metadata
  pageResource-->>MCPClient: return page resource list
  MCPClient->>pageResource: read docs://page route
  pageResource->>DocumentationDiscovery: resolve documentation route
  DocumentationDiscovery-->>pageResource: return Markdown or redirect
  pageResource-->>MCPClient: return Markdown or not-found error
Loading

Merge Risk: ⚪ Minimal · up to 54366

No concrete merge-blocking risk is established by the available evidence.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: exposing every documentation page as an MCP resource.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mcp-page-resources

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.


Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/comarkdown/comark-docs@48

commit: 543666b

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