# MCP server diagnostics

<!-- Generated by docs/modules/diagnostics from the package catalogs. Write a guide in docs/diagnostics/<CODE>.md instead of editing this file. -->

Each MCP server error has a stable `code`. Its `docs` link opens the page of that code. This page lists all 5 codes, and [All diagnostics](https://vitehub.dev/docs/reference/diagnostics) lists every primitive.

## Runtime errors

| Code | What happened |
| --- | --- |
| [`MCP_R0001`](https://vitehub.dev/docs/mcp/diagnostics/mcp_r0001) | The MCP tools \<value\> set public, but the MCP server at \<route\> has no publicRoute and its auth is not "optional". |

## Build errors

| Code | What happened |
| --- | --- |
| [`MCP_B0001`](https://vitehub.dev/docs/mcp/diagnostics/mcp_b0001) | mcp.\<option\> must be a path such as "/mcp", without a query or "//". Got \<value\>. |
| [`MCP_B0002`](https://vitehub.dev/docs/mcp/diagnostics/mcp_b0002) | \<value\> would be the MCP tool "\<name\>". A tool name has 1 to 128 letters, digits, "_", "-", or ".". Rename the file, for example to "\<value\>.ts". |
| [`MCP_B0003`](https://vitehub.dev/docs/mcp/diagnostics/mcp_b0003) | mcp.publicRoute needs auth: true. With mcp: { auth: \<auth\> }, the tools with public: true are public on \<route\> already. |
| [`MCP_B0004`](https://vitehub.dev/docs/mcp/diagnostics/mcp_b0004) | Only one MCP hooks module is allowed. Keep one of: \<value\>. |

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/mcp.md)
- [Get started](https://vitehub.dev/raw/docs/mcp/get-started.md)
- [Configure](https://vitehub.dev/raw/docs/mcp/configure.md)
- [Server API](https://vitehub.dev/raw/docs/mcp/server-api.md)
- [Limits and errors](https://vitehub.dev/raw/docs/mcp/limits-and-errors.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
