# MCP server limits and errors

## Protocol

The server is ViteHub's own MCP server. It uses no MCP SDK. The [ViteHub MCP](https://vitehub.dev/docs/development/mcp) of the Console uses the same server.

- It speaks the stateless JSON subset of Streamable HTTP, revisions `2025-11-25` and `2025-06-18`.
- It answers `initialize`, `ping`, `tools/list`, and `tools/call`. With prompts, it also answers `prompts/list` and `prompts/get`. With resources, it also answers `resources/list`, `resources/templates/list`, and `resources/read`. Other methods get JSON-RPC `-32601`.
- It keeps no session between requests and has no event stream. A request that is not `POST` gets `405`.
- It has no resource subscriptions, no list change notifications, and no pagination. A list returns all its entries.
- An unknown resource URI, or a resource handler that returns `undefined`, gets JSON-RPC `-32002`. Invalid prompt arguments get `-32602`.

## Errors

A wrong route, a wrong tool file name, or a `publicRoute` without sign-in fails the build. A tool that sets `public` without a `publicRoute` or `auth: 'optional'` fails the server. A second hooks module also fails the build.

### MCP_B0001

`mcp.route` is not a path, such as a route with a query or `//`. Set a path such as `/mcp`.

### MCP_B0002

A file in `server/mcp/tools/` has a name that MCP does not allow as a tool name. Rename the file.

### MCP_B0003

`mcp.publicRoute` is set with `mcp: { auth: false }` or `mcp: { auth: 'optional' }`. Then `mcp.route` serves the public tools already. Remove `publicRoute`, or set `auth: true` and add `mcpOAuth()` from `vite-hub/auth/mcp` to `server/auth.ts`.

### MCP_R0001

A tool sets `public`, but the MCP server has no `mcp.publicRoute` and its `auth` is not `'optional'`. The error names the tools. Set `mcp: { auth: 'optional' }` to serve them without sign-in on the same route, set `mcp: { route: '/mcp/account', publicRoute: '/mcp' }` to serve them on a second route, or remove `public` from the tools.

### SOURCE_B0010

[Content](https://vitehub.dev/docs/content/seo#page-mcp-server) also serves an MCP server at `/mcp` when `server/content.ts` sets `seo: { mcp: true }`. One route serves one MCP server, so the build stops. Give the app MCP server another `route` or `publicRoute`, such as `vitehub({ mcp: { route: '/mcp/app' } })`, or set `seo: { mcp: false }`.

### MCP_B0004

More than one server directory has an `mcp.ts` hooks module, such as `server/mcp.ts` and `app/mcp.ts`. Keep one `defineMcpHooks()` module.

<!-- 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) (this page)

Next: [Diagnostics](https://vitehub.dev/raw/docs/mcp/diagnostics.md)

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