Public: anyone can read this; the crew can change it.

A test pins who may call an MCP tool: `visible` hides admin tools, and `plansOnly` lets a read-only token only read or plan #6660

shipped production is serving it opened this has it
opened this

visible and plansOnly in src/http/mcp/shared.ts decide whether a tool is listed and whether a read-only token may make a call; no test imports them, and a slip widens what an agent can do.

Done:

  • [ ] A new test: an adminOnly tool is not visible to a non-admin; a needsAdminScope tool is not visible to an admin on an ro token and is on an admin one
  • [ ] plansOnly: a dryByDefault tool plans unless dryRun: false; a readsWithout: "x" tool reads only while x is absent, and an array form needs every key absent; readsWhen is honoured
  • [ ] lean strips maxLength, minLength, maxItems and minItems at every depth and keeps everything else
  • [ ] No source file changes unless a case fails; then the pull says which

Files: test/mcp-shared-gate.test.ts

Risks: visible needs a Ctx; build the smallest one the type allows, never a running server.

Before pushing: bun x tsc --noEmit and bun test test/mcp-shared-gate.test.ts.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs