From 1819db0fd70ebe9fdc5459e837cdba3d8ae8b7e0 Mon Sep 17 00:00:00 2001 From: Kyle Bernhardy Date: Wed, 22 Jul 2026 09:45:38 -0600 Subject: [PATCH] fix(mcp): correct the exportTypes MCP-gating example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- reference/mcp/tools-and-resources.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/mcp/tools-and-resources.md b/reference/mcp/tools-and-resources.md index 749f3032..38a9ebd7 100644 --- a/reference/mcp/tools-and-resources.md +++ b/reference/mcp/tools-and-resources.md @@ -112,10 +112,10 @@ The corresponding instance method runs through Harper's normal `transactional()` ### `exportTypes` gating -The MCP surface mirrors the public REST surface. A Resource is filtered out of MCP enumeration entirely when its registration sets `exportTypes.mcp = false`: +The MCP surface mirrors the public REST surface. A Resource is filtered out of MCP enumeration entirely when its registration sets `exportTypes.mcp = false`. The `exportTypes` map is supplied to the registration call — `server.resources.set(path, Resource, exportTypes)` — not to `server.http` (which registers HTTP handlers and does not read `exportTypes`), and a `static exportTypes` field on the class is not read either: ```ts -server.http(Resource, { name: 'internal-thing', exportTypes: { mcp: false } }); +server.resources.set('internal-thing', Resource, { mcp: false }); ``` This is independent of the `http` exportType — the only switch that operators set to scope MCP visibility is `mcp`.