[{"data":1,"prerenderedAt":839,"buildId":840},["ShallowReactive",2],{"-model-context-protocol":3,"-model-context-protocol-surround":736,"navigation_docs":747},{"id":4,"title":5,"body":6,"description":718,"extension":719,"links":720,"meta":729,"navigation":731,"path":732,"seo":733,"stem":734,"__hash__":735},"docs\u002F9.model-context-protocol.md","MCP",{"type":7,"value":8,"toc":711},"minimark",[9,22,52,57,60,88,91,106,113,133,137,140,237,240,251,278,291,321,343,384,431,435,442,571,593,604,635,662,665,669,679,695,707],[10,11,12,13,17,18,21],"p",{},"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 ",[14,15,16],"code",{},"readOnlyHint"," nor ",[14,19,20],{},"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.",[10,23,24,25,28,29,28,32,28,35,28,38,28,41,28,44,47,48,51],{},"It activates on its own when Project Inventory contains ",[14,26,27],{},"h3-mcp",", ",[14,30,31],{},"okmcp",[14,33,34],{},"nitro-mcp-toolkit",[14,36,37],{},"@nuxtjs\u002Fmcp-toolkit",[14,39,40],{},"vite-hub",[14,42,43],{},"@vite-hub\u002Fmcp",[14,45,46],{},"@modelcontextprotocol\u002Fsdk",", or ",[14,49,50],{},"@modelcontextprotocol\u002Fserver",".",[53,54,56],"h2",{"id":55},"install-and-run","Install and run",[10,58,59],{},"Install Vite Doctor in the project:",[61,62,67],"pre",{"className":63,"code":64,"language":65,"meta":66,"style":66},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm add -D vite-doctor\n","bash","",[14,68,69],{"__ignoreMap":66},[70,71,74,78,82,85],"span",{"class":72,"line":73},"line",1,[70,75,77],{"class":76},"sBMFI","pnpm",[70,79,81],{"class":80},"sfazB"," add",[70,83,84],{"class":80}," -D",[70,86,87],{"class":80}," vite-doctor\n",[10,89,90],{},"The Recommended Preset runs automatically:",[61,92,94],{"className":63,"code":93,"language":65,"meta":66,"style":66},"pnpm vite-doctor .\n",[14,95,96],{"__ignoreMap":66},[70,97,98,100,103],{"class":72,"line":73},[70,99,77],{"class":76},[70,101,102],{"class":80}," vite-doctor",[70,104,105],{"class":80}," .\n",[10,107,108,109,112],{},"To diagnose one Rule, select it with ",[14,110,111],{},"--rules",":",[61,114,116],{"className":63,"code":115,"language":65,"meta":66,"style":66},"pnpm vite-doctor . --rules mcp\u002Ftools\u002Frequire-annotation-title\n",[14,117,118],{"__ignoreMap":66},[70,119,120,122,124,127,130],{"class":72,"line":73},[70,121,77],{"class":76},[70,123,102],{"class":80},[70,125,126],{"class":80}," .",[70,128,129],{"class":80}," --rules",[70,131,132],{"class":80}," mcp\u002Ftools\u002Frequire-annotation-title\n",[53,134,136],{"id":135},"what-doctor-reads","What Doctor reads",[10,138,139],{},"Doctor builds an inventory of tool definitions from these calls:",[141,142,143,156],"table",{},[144,145,146],"thead",{},[147,148,149,153],"tr",{},[150,151,152],"th",{},"Library",[150,154,155],{},"Definition",[157,158,159,174,185,196,215],"tbody",{},[147,160,161,168],{},[162,163,164,28,166],"td",{},[14,165,27],{},[14,167,31],{},[162,169,170,173],{},[14,171,172],{},"defineTool()"," imported from the package",[147,175,176,180],{},[162,177,178],{},[14,179,34],{},[162,181,182,173],{},[14,183,184],{},"defineMcpTool()",[147,186,187,191],{},[162,188,189],{},[14,190,37],{},[162,192,193,195],{},[14,194,184],{},", imported or auto-imported",[147,197,198,204],{},[162,199,200,28,202],{},[14,201,40],{},[14,203,43],{},[162,205,206,208,209,212,213],{},[14,207,184],{}," imported from ",[14,210,211],{},"vite-hub\u002Fmcp"," or ",[14,214,43],{},[147,216,217,223],{},[162,218,219,28,221],{},[14,220,46],{},[14,222,50],{},[162,224,225,228,229,232,233,236],{},[14,226,227],{},"server.registerTool(name, config, handler)"," on a ",[14,230,231],{},"const"," initialized with ",[14,234,235],{},"new McpServer()"," from an SDK import",[10,238,239],{},"A local function that happens to share one of these names is skipped.",[10,241,242,244,245,247,248,250],{},[14,243,37],{}," 1.x replaced its MCP SDK runtime with ",[14,246,34],{},", so Doctor diagnoses its tools as ",[14,249,34],{}," 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.",[10,252,253,254,257,258,261,262,265,266,269,270,273,274,277],{},"Both toolkits name a tool discovered under ",[14,255,256],{},"server\u002Fmcp\u002Ftools\u002F"," after its file in kebab case, and fill its top-level ",[14,259,260],{},"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 ",[14,263,264],{},"annotations",", which is why the inventory reads the two separately. ViteHub names a tool after its path below ",[14,267,268],{},"mcp\u002Ftools\u002F",", without the extension or a trailing ",[14,271,272],{},"\u002Findex",". It ignores the definition's ",[14,275,276],{},"name"," and fills no title.",[10,279,280,281,283,284,212,287,290],{},"Annotations can be an object literal or spread shared objects into one. Doctor follows a spread to a ",[14,282,231],{}," in the same file, to an export of a relatively imported file, and to a unique export in an auto-imported ",[14,285,286],{},"server\u002Futils",[14,288,289],{},"shared\u002Futils"," file. When it can't follow a spread or read a key, it reports nothing for that tool rather than guess.",[10,292,293,294,212,296,298,299,302,303,28,306,309,310,313,314,317,318,320],{},"An annotation title must be a non-empty string. A safety hint must set ",[14,295,16],{},[14,297,20],{}," to ",[14,300,301],{},"true","; ",[14,304,305],{},"false",[14,307,308],{},"undefined",", and values of the wrong type don't satisfy the Connector criteria. The MCP0002 fix follows the hints a tool declares: with ",[14,311,312],{},"readOnlyHint: false"," it asks for ",[14,315,316],{},"destructiveHint: true",", and with both hints ",[14,319,305],{},", 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.",[10,322,323,324,327,328,331,332,335,336,338,339,342],{},"Doctor looks for indented JSON returned directly by the handler or in a ",[14,325,326],{},"{ type: 'text', text: … }"," block in its returned ",[14,329,330],{},"content"," array. It follows returned helper calls up to two levels deep, including a shared ",[14,333,334],{},"toStructuredResult()"," in ",[14,337,286],{},". 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 ",[14,340,341],{},"JSON.stringify()"," and keep the replacer.",[10,344,345,346,348,349,351,352,355,356,358,359,361,362,365,366,369,370,28,373,376,377,380,381,383],{},"Both toolkits indent JSON on their own. ",[14,347,37],{}," 0.24.4 and ",[14,350,34],{}," send a handler's plain object or array as ",[14,353,354],{},"JSON.stringify(result, null, 2)",". Doctor excludes result envelopes, such as a return with array-valued ",[14,357,330],{},". A ",[14,360,34],{}," tool with an ",[14,363,364],{},"outputSchema"," also sends the plain object as ",[14,367,368],{},"structuredContent",", which clients may read instead of the text, so Doctor skips that case. Doctor reports statically recognizable plain values, including ",[14,371,372],{},".map()",[14,374,375],{},".filter()",", and ",[14,378,379],{},".flatMap()"," on known arrays. It skips uncertain shapes, such as when a binding might have been mutated or the type of ",[14,382,330],{}," is unknown.",[10,385,386,387,389,390,393,394,397,398,401,402,212,404,406,407,28,410,376,413,416,417,419,420,423,424,212,427,430],{},"In ",[14,388,37],{}," 0.x, ",[14,391,392],{},"jsonResult(data)"," and ",[14,395,396],{},"jsonResult(data, true)"," also indent JSON; 1.x removed the helper. Doctor reports direct toolkit imports of this helper, including aliases, and bare ",[14,399,400],{},"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 ",[14,403,286],{},[14,405,289],{}," 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 ",[14,408,409],{},"[]",[14,411,412],{},"{}",[14,414,415],{},"42"," that are already compact. Pass ",[14,418,305],{}," to an existing ",[14,421,422],{},"jsonResult()"," call. For plain data, use ",[14,425,426],{},"jsonResult(data, false)",[14,428,429],{},"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.",[53,432,434],{"id":433},"names-schemas-results-and-errors","Names, schemas, results, and errors",[10,436,437,438,441],{},"h3-mcp (okmcp) fails a whole ",[14,439,440],{},"tools\u002Flist",", or every call of one tool, for mistakes that are visible in source. These Rules catch them before a client does:",[141,443,444,457],{},[144,445,446],{},[147,447,448,451,454],{},[150,449,450],{},"Code",[150,452,453],{},"Rule",[150,455,456],{},"What breaks",[157,458,459,472,485,501,519,543],{},[147,460,461,464,469],{},[162,462,463],{},"MCP0011",[162,465,466],{},[14,467,468],{},"mcp\u002Ftools\u002Funique-name",[162,470,471],{},"h3-mcp answers HTTP 500 for the whole list; nitro-mcp-toolkit and the SDK refuse to start",[147,473,474,477,482],{},[162,475,476],{},"MCP0012",[162,478,479],{},[14,480,481],{},"mcp\u002Ftools\u002Foutput-schema-needs-structured-content",[162,483,484],{},"every call fails with a JSON-RPC error on h3-mcp and nitro-mcp-toolkit, or an output validation error on the SDK",[147,486,487,490,495],{},[162,488,489],{},"MCP0013",[162,491,492],{},[14,493,494],{},"mcp\u002Ftools\u002Fno-raw-standard-schema",[162,496,497,498],{},"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 ",[14,499,500],{},"object()",[147,502,503,506,511],{},[162,504,505],{},"MCP0014",[162,507,508],{},[14,509,510],{},"mcp\u002Ftools\u002Fobject-output-schema",[162,512,513,514,393,516,518],{},"MCP 2025-11-25 needs an object ",[14,515,364],{},[14,517,368],{},"; SDK clients reject the list or the result",[147,520,521,524,529],{},[162,522,523],{},"MCP0015",[162,525,526],{},[14,527,528],{},"mcp\u002Ftools\u002Fno-http-error-in-tool",[162,530,531,532,535,536,539,540],{},"a thrown h3 ",[14,533,534],{},"HTTPError"," becomes a protocol error instead of an ",[14,537,538],{},"isError"," result; on 2026-07-28 it's 500 ",[14,541,542],{},"-32603",[147,544,545,548,553],{},[162,546,547],{},"MCP0016",[162,549,550],{},[14,551,552],{},"mcp\u002Ftools\u002Fno-args-without-input-schema",[162,554,555,556,559,560,563,564,567,568],{},"without ",[14,557,558],{},"inputSchema",", h3-mcp calls ",[14,561,562],{},"handler(event)",", so ",[14,565,566],{},"({ id }) =>"," reads ",[14,569,570],{},"event.id",[10,572,573,574,577,578,581,582,585,586,589,590,592],{},"MCP0011 compares names only on one server: the same ",[14,575,576],{},"McpServer",", the same toolkit ",[14,579,580],{},"mcp\u002Ftools"," directory, or the same h3-mcp ",[14,583,584],{},"defineMcpHandler()",". Doctor checks each handler's ",[14,587,588],{},"tools"," array independently and counts each entry, even if it repeats the same tool. A ",[14,591,588],{}," array Doctor can't read, test files, and names built at runtime are skipped.",[10,594,595,596,393,598,600,601,603],{},"The inventory reads ",[14,597,558],{},[14,599,364],{}," as JSON Schema literals or as direct calls to Zod, Valibot, or ArkType, following a ",[14,602,231],{}," 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.",[10,605,606,607,610,611,613,614,616,617,212,619,621,622,212,625,628,629,632,633,51],{},"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 ",[14,608,609],{},"toolResult()"," envelopes count, because the toolkit puts plain objects in ",[14,612,368],{}," when a tool has an ",[14,615,364],{},". Doctor does not compare the returned data object against the schema or infer a mismatch from field names such as ",[14,618,330],{},[14,620,538],{},". MCP0014 skips h3-mcp tools whose every handler serves only the 2026-07-28 revision (",[14,623,624],{},"era: \"modern\"",[14,626,627],{},"defineMcpHandler"," from ",[14,630,631],{},"h3-mcp\u002Fmodern","), and nitro-mcp-toolkit tools in a package whose Nitro or Nuxt config sets ",[14,634,624],{},[10,636,637,638,640,641,643,644,393,647,650,651,654,655,212,658,661],{},"MCP0015 applies to h3-mcp only, because both toolkits turn an ",[14,639,534],{}," into an ",[14,642,538],{}," result. It reports ",[14,645,646],{},"throw createError()",[14,648,649],{},"throw new HTTPError()"," from h3 or Nitro in the handler body, and skips throws inside a ",[14,652,653],{},"try"," that catches them or inside nested functions. MCP0016 skips handlers that destructure an h3 event field such as ",[14,656,657],{},"req",[14,659,660],{},"context",", or use a rest element.",[10,663,664],{},"Doctor reads tool definitions from source. A tool that a Nitro hook or plugin changes at runtime is diagnosed as written.",[53,666,668],{"id":667},"check-a-running-server","Check a running server",[10,670,671,672,112],{},"Doctor never connects to a server. To check the tools a running server sends, and what each MCP client does with them, use ",[673,674,678],"a",{"href":675,"rel":676},"https:\u002F\u002Fismcpok.dev",[677],"nofollow","is-mcp-ok",[61,680,682],{"className":63,"code":681,"language":65,"meta":66,"style":66},"npx is-mcp-ok http:\u002F\u002Flocalhost:3000\u002Fmcp\n",[14,683,684],{"__ignoreMap":66},[70,685,686,689,692],{"class":72,"line":73},[70,687,688],{"class":76},"npx",[70,690,691],{"class":80}," is-mcp-ok",[70,693,694],{"class":80}," http:\u002F\u002Flocalhost:3000\u002Fmcp\n",[10,696,697,698,701,702,51],{},"For a server that needs a token, add ",[14,699,700],{},"--header \"Authorization: Bearer $TOKEN\"",". Its codes, including the client-limit checks that were MCP0005 to MCP0010 in earlier Doctor releases, are documented at ",[673,703,706],{"href":704,"rel":705},"https:\u002F\u002Fismcpok.dev\u002Fdocs\u002Freference\u002Fmcp",[677],"loadsheet.dev\u002Fdocs\u002Freference\u002Fmcp",[708,709,710],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":66,"searchDepth":712,"depth":712,"links":713},2,[714,715,716,717],{"id":55,"depth":712,"text":56},{"id":135,"depth":712,"text":136},{"id":433,"depth":712,"text":434},{"id":667,"depth":712,"text":668},"Diagnose MCP server tools before a client or a directory rejects them.","md",[721,725],{"label":722,"icon":723,"to":724},"MCP rules","i-lucide-list-checks","\u002Fmcp\u002Frules",{"label":726,"icon":727,"to":728},"MCP tools specification","i-lucide-book-open","https:\u002F\u002Fmodelcontextprotocol.io\u002Fspecification\u002F2025-11-25\u002Fserver\u002Ftools",{"icon":730},"i-simple-icons-modelcontextprotocol",true,"\u002Fmodel-context-protocol",{"title":5,"description":718},"9.model-context-protocol","BfgEe1GKilEZuBLkqxv4iKS200CqZuz0-1pFJ9RPMv4",[737,742],{"title":738,"path":739,"stem":740,"description":741,"children":-1},"H3","\u002Fh3","9.h3","Diagnose H3 request handling and H3 v2 migrations wherever H3 runs, in standalone H3 servers and in Nitro and Nuxt server code.",{"title":743,"path":744,"stem":745,"description":746,"children":-1},"Pinia","\u002Fpinia","9.pinia","Diagnose Pinia store definitions with the Pinia Rule Pack.",[748,776,780,784,788,792,796,808,812,836,837,838],{"title":749,"path":750,"stem":751,"children":752,"icon":775},"CLI","\u002Fcli","1.cli\u002F1.index",[753,755,759,763,767,771],{"title":754,"path":750,"stem":751},"Run Doctor",{"title":756,"path":757,"stem":758},"Reports","\u002Fcli\u002Freports","1.cli\u002F2.reports",{"title":760,"path":761,"stem":762},"Configuration","\u002Fcli\u002Fconfiguration","1.cli\u002F3.configuration",{"title":764,"path":765,"stem":766},"CI and changed files","\u002Fcli\u002Fci","1.cli\u002F4.ci",{"title":768,"path":769,"stem":770},"Workspaces","\u002Fcli\u002Fworkspaces","1.cli\u002F5.workspaces",{"title":772,"path":773,"stem":774},"Cache and speed","\u002Fcli\u002Fcache","1.cli\u002F6.cache","i-lucide-terminal",{"title":777,"path":778,"stem":779},"Nuxt","\u002Fnuxt","2.nuxt",{"title":781,"path":782,"stem":783},"Vue","\u002Fvue","3.vue",{"title":785,"path":786,"stem":787},"Vite","\u002Fvite","4.vite",{"title":789,"path":790,"stem":791},"Nitro","\u002Fnitro","5.nitro",{"title":793,"path":794,"stem":795},"TypeScript","\u002Ftypescript","6.typescript",{"title":797,"path":798,"stem":799,"children":800,"icon":807},"Design system","\u002Fdesign-system","7.design-system\u002F1.index",[801,803],{"title":802,"path":798,"stem":799},"Overview",{"title":804,"path":805,"stem":806},"Classes and styles","\u002Fdesign-system\u002Fclasses","7.design-system\u002F2.classes","i-lucide-swatch-book",{"title":809,"path":810,"stem":811},"Package","\u002Fpackage","8.package",{"title":813,"path":814,"stem":815,"children":816,"icon":835},"Extending Doctor","\u002Fextending","9.extending\u002F1.index",[817,819,823,827,831],{"title":818,"path":814,"stem":815},"Write an extension",{"title":820,"path":821,"stem":822},"Visitors","\u002Fextending\u002Fvisitors","9.extending\u002F2.visitors",{"title":824,"path":825,"stem":826},"Ship with a library","\u002Fextending\u002Fshipping","9.extending\u002F3.shipping",{"title":828,"path":829,"stem":830},"Test a Rule","\u002Fextending\u002Ftesting","9.extending\u002F4.testing",{"title":832,"path":833,"stem":834},"Rule inputs","\u002Fextending\u002Frule-inputs","9.extending\u002F5.rule-inputs","i-lucide-puzzle",{"title":738,"path":739,"stem":740},{"title":5,"path":732,"stem":734},{"title":743,"path":744,"stem":745},1796502517163,"459135de-a4df-4ea8-9b4b-cb70e139bb1e"]