Skip to content

fix(mcp): correct the exportTypes MCP-gating example#601

Open
kylebernhardy wants to merge 1 commit into
mainfrom
docs/fix-mcp-exporttypes-gating
Open

fix(mcp): correct the exportTypes MCP-gating example#601
kylebernhardy wants to merge 1 commit into
mainfrom
docs/fix-mcp-exporttypes-gating

Conversation

@kylebernhardy

Copy link
Copy Markdown
Member

Summary

The ### exportTypes gating section on the MCP Tools and Resources page documents gating a Resource out of the MCP surface with:

server.http(Resource, { name: 'internal-thing', exportTypes: { mcp: false } });

That call does not gate anything. server.http (= httpServer, harper server/http.ts) registers HTTP handlers and reads port/name/before/after/urlPath/host/runFirst — it has zero exportTypes handling. The exportTypes map is consumed by the resource registration call:

server.resources.set('internal-thing', Resource, { mcp: false });

Verified against harper main: Resources.set(path, resource, exportTypes) (resources/Resources.ts) stores it, and the MCP enumerator reads entry.exportTypes?.mcp (components/mcp/resources.ts). Also added a note that a static exportTypes field on the class is not read — a common adjacent mistake.

Why now

@kriszyp flagged this same pattern in the harper-mcp skill review (HarperFast/skills#69), where it was corrected. The harper-mcp skill is being flipped to generate its rules from these docs, and automatic-verb-tools is the one docs-mapped rule that can't flip until this example is fixed — generating from the buggy source would bake the broken call back into the skill. This unblocks that flip.

Where to look

One example swapped in reference/mcp/tools-and-resources.md plus a one-sentence clarification. Prose about the exportTypes.mcp concept is unchanged and was already correct.

Cross-links: HarperFast/skills#69.

🤖 Generated with Claude Code (Claude Opus 4.8)

The `### exportTypes gating` example showed
`server.http(Resource, { exportTypes: { mcp: false } })`, but server.http
(= httpServer in harper server/http.ts) registers HTTP handlers and never reads
exportTypes — so that call does not gate MCP. The mechanism is the resource
registration call, `server.resources.set(path, Resource, { mcp: false })`
(resources/Resources.ts). Verified against harper main.

Also notes that a `static exportTypes` field on the class is not read, which is
a common adjacent mistake.

Comment generated by kAIle (Claude Opus 4.8)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation in reference/mcp/tools-and-resources.md to clarify that exportTypes gating is configured via server.resources.set rather than server.http, and updates the corresponding code example. There are no review comments, and I have no additional feedback to provide.

@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-601

This preview will update automatically when you push new commits.

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.

2 participants