Add an MCP registry tool
Tool to add: $ARGUMENTS
The MCP server lives in apps/api/src/mcp/ and is mounted at /mcp. Add tools in registry-server.ts. Delegate larger work to the mcp-tool-dev agent.
Steps
- Define the tool inside
buildRegistryMcpServerinregistry-server.tsviaserver.registerTool(name, { description, inputSchema }, handler): a clear agent-facingdescription(agents pick tools by this) and a Zod input schema. Reuse@skillist/contractsschemas (e.g.registryQuery,mcpServer) rather than inventing shapes. - Implement the handler in the
registerToolcallback. Reuse the same registry read/query helpers the/v1/registryroutes use — don't duplicate query logic. Keep results compact (agents pay for tokens). Throwing surfaces as anisErrortool result. - Register the tool name in
REGISTRY_MCP_TOOL_NAMESsomcpServerInfo//healthadvertising reflects it. - Auth: for session-gated tools call
requireSession(name)first (bearer tokens are verified inhandler.tsviacreateRegistryMcpAuth). Keep gated tools registered for all callers — the tool list iscacheScope: "public"and must not vary by caller. The endpoint is stateless: no sessions, no KV.
Verify
pnpm --filter @skillist/api exec vitest run src/mcp/registry-server.test.tsandtransport.test.ts; add a case for the new tool.pnpm check+pnpm typecheck.- Manual:
pnpm dev:api, then POST JSON-RPCtools/list(confirm it appears) andtools/call(confirm output) to/mcp.