The MCP Rule Pack checks the tools an MCP server defines. A server can work in your own tests and still be rejected later: Anthropic's Connectors Directory flags tools without a title or a safety hint, and clients treat a tool that declares neither readOnlyHint nor destructiveHint as destructive. A tool can also answer with more tokens than its data needs, such as indented JSON. The pack finds those problems in source, before you submit.
It activates on its own when Project Inventory contains h3-mcp, okmcp, nitro-mcp-toolkit, @nuxtjs/mcp-toolkit, vite-hub, @vite-hub/mcp, @modelcontextprotocol/sdk, or @modelcontextprotocol/server.
Install and run
Install Vite Doctor in the project:
pnpm add -D vite-doctor
The Recommended Preset runs automatically:
pnpm vite-doctor .
To diagnose one Rule, select it with --rules:
pnpm vite-doctor . --rules mcp/tools/require-annotation-title
What Doctor reads
Doctor builds an inventory of tool definitions from these calls:
| Library | Definition |
|---|---|
h3-mcp, okmcp | defineTool() imported from the package |
nitro-mcp-toolkit | defineMcpTool() imported from the package |
@nuxtjs/mcp-toolkit | defineMcpTool(), imported or auto-imported |
vite-hub, @vite-hub/mcp | defineMcpTool() imported from vite-hub/mcp or @vite-hub/mcp |
@modelcontextprotocol/sdk, @modelcontextprotocol/server | server.registerTool(name, config, handler) on a const initialized with new McpServer() from an SDK import |
A local function that happens to share one of these names is skipped.
@nuxtjs/mcp-toolkit 1.x replaced its MCP SDK runtime with nitro-mcp-toolkit, so Doctor diagnoses its tools as nitro-mcp-toolkit tools, and its messages name that package. Doctor reads the version installed next to the tool file, then the range the package declares, and keeps the 0.x model when it can tell neither.
Both toolkits name a tool discovered under server/mcp/tools/ after its file in kebab case, and fill its top-level title from the file name. Doctor applies the same naming to default exports in that directory. It does not infer named-server registration from directory names. Neither toolkit copies that title into annotations, which is why the inventory reads the two separately. ViteHub names a tool after its path below mcp/tools/, without the extension or a trailing /index. It ignores the definition's name and fills no title.
Annotations can be an object literal or spread shared objects into one. Doctor follows a spread to a const in the same file, to an export of a relatively imported file, and to a unique export in an auto-imported server/utils or shared/utils file. When it can't follow a spread or read a key, it reports nothing for that tool rather than guess.
An annotation title must be a non-empty string. A safety hint must set readOnlyHint or destructiveHint to true; false, undefined, and values of the wrong type don't satisfy the Connector criteria. The MCP0002 fix follows the hints a tool declares: with readOnlyHint: false it asks for destructiveHint: true, and with both hints false, which MCP uses for tools that only add data, it explains that the Directory review will still flag the tool. Doctor follows statically readable constant values and respects the order of spread overrides. When a relevant value is only known at runtime, it skips that Rule for the tool.
Doctor looks for indented JSON returned directly by the handler or in a { type: 'text', text: … } block in its returned content array. It follows returned helper calls up to two levels deep, including a shared toStructuredResult() in server/utils. Metadata, structured content, unrelated callbacks, and indents Doctor can't read are skipped. To compact the JSON without changing which data is serialized, remove only the third argument to JSON.stringify() and keep the replacer.
Both toolkits indent JSON on their own. @nuxtjs/mcp-toolkit 0.24.4 and nitro-mcp-toolkit send a handler's plain object or array as JSON.stringify(result, null, 2). Doctor excludes result envelopes, such as a return with array-valued content. A nitro-mcp-toolkit tool with an outputSchema also sends the plain object as structuredContent, which clients may read instead of the text, so Doctor skips that case. Doctor reports statically recognizable plain values, including .map(), .filter(), and .flatMap() on known arrays. It skips uncertain shapes, such as when a binding might have been mutated or the type of content is unknown.
In @nuxtjs/mcp-toolkit 0.x, jsonResult(data) and jsonResult(data, true) also indent JSON; 1.x removed the helper. Doctor reports direct toolkit imports of this helper, including aliases, and bare jsonResult calls that Nitro resolves to the toolkit. Without Nitro's resolved auto-imports, Doctor assumes the toolkit supplies the helper unless a project utility in server/utils or shared/utils exports that auto-import name. This source-only fallback cannot see helpers registered by external layers or other modules. Doctor skips other explicit imports of that name, unknown flags, and literals such as [], {}, and 42 that are already compact. Pass false to an existing jsonResult() call. For plain data, use jsonResult(data, false) or JSON.stringify(data) in the MCP handler. If a shared helper can also return strings or MCP result envelopes, serialize only the plain-data branch and pass the other results through unchanged. Keep what the helper returns to other callers unchanged.
Names, schemas, results, and errors
h3-mcp (okmcp) fails a whole tools/list, or every call of one tool, for mistakes that are visible in source. These Rules catch them before a client does:
| Code | Rule | What breaks |
|---|---|---|
| MCP0011 | mcp/tools/unique-name | h3-mcp answers HTTP 500 for the whole list; nitro-mcp-toolkit and the SDK refuse to start |
| MCP0012 | mcp/tools/output-schema-needs-structured-content | every call fails with a JSON-RPC error on h3-mcp and nitro-mcp-toolkit, or an output validation error on the SDK |
| MCP0013 | mcp/tools/no-raw-standard-schema | h3-mcp lists a Zod, Valibot, or ArkType schema object as it is: SDK clients reject the list, or see no fields of a Valibot object() |
| MCP0014 | mcp/tools/object-output-schema | MCP 2025-11-25 needs an object outputSchema and structuredContent; SDK clients reject the list or the result |
| MCP0015 | mcp/tools/no-http-error-in-tool | a thrown h3 HTTPError becomes a protocol error instead of an isError result; on 2026-07-28 it's 500 -32603 |
| MCP0016 | mcp/tools/no-args-without-input-schema | without inputSchema, h3-mcp calls handler(event), so ({ id }) => reads event.id |
MCP0011 compares names only on one server: the same McpServer, the same toolkit mcp/tools directory, or the same h3-mcp defineMcpHandler(). Doctor checks each handler's tools array independently and counts each entry, even if it repeats the same tool. A tools array Doctor can't read, test files, and names built at runtime are skipped.
The inventory reads inputSchema and outputSchema as JSON Schema literals or as direct calls to Zod, Valibot, or ArkType, following a const or an import to where the schema is built. MCP0013 also needs the installed version of that library: Zod 4.2 and ArkType 2.1.28 add Standard JSON Schema, which h3-mcp converts, and nitro-mcp-toolkit converts sync Valibot schemas itself. Without an installed version, it reports nothing.
MCP0012 and MCP0014 read the object literals a handler returns, directly or through helper calls up to two levels deep. A result with a spread or computed key is skipped. On nitro-mcp-toolkit, only toolResult() envelopes count, because the toolkit puts plain objects in structuredContent when a tool has an outputSchema. Doctor does not compare the returned data object against the schema or infer a mismatch from field names such as content or isError. MCP0014 skips h3-mcp tools whose every handler serves only the 2026-07-28 revision (era: "modern" or defineMcpHandler from h3-mcp/modern), and nitro-mcp-toolkit tools in a package whose Nitro or Nuxt config sets era: "modern".
MCP0015 applies to h3-mcp only, because both toolkits turn an HTTPError into an isError result. It reports throw createError() and throw new HTTPError() from h3 or Nitro in the handler body, and skips throws inside a try that catches them or inside nested functions. MCP0016 skips handlers that destructure an h3 event field such as req or context, or use a rest element.
Doctor reads tool definitions from source. A tool that a Nitro hook or plugin changes at runtime is diagnosed as written.
Check a running server
Doctor never connects to a server. To check the tools a running server sends, and what each MCP client does with them, use is-mcp-ok:
npx is-mcp-ok http://localhost:3000/mcp
For a server that needs a token, add --header "Authorization: Bearer $TOKEN". Its codes, including the client-limit checks that were MCP0005 to MCP0010 in earlier Doctor releases, are documented at loadsheet.dev/docs/reference/mcp.