GitHub 37
Skip to content
ViteHub is still experimental. Expect bugs and breaking changes.

MCP server

Give Agents the tools of your app. Write one file for each tool, and connect the Agent to /mcp.

server/mcp/tools/add.ts
import { defineMcpTool } from 'vite-hub/mcp'
import { z } from 'zod'

// The file name is the tool name: add
export default defineMcpTool({
  description: 'Add two numbers.',
  input: z.object({ a: z.number(), b: z.number() }),
  handler: ({ a, b }) => ({ sum: a + b }),
})
server/mcp/tools/add.ts

One file is one tool

Each file in server/mcp/tools/ is one tool. The file name is the tool name.

Arguments are checked

input is a Standard Schema, such as Zod or Valibot. The server checks the arguments before your handler runs.

Sign in with MCP OAuth

With Auth, the server needs an access token. Your handler knows which user and client called it.

No MCP SDK

ViteHub's own stateless Streamable HTTP server. It keeps no session between requests.

Prompts and resources

Add prompts in server/mcp/prompts/ and resources in server/mcp/resources/, one file each.

Inspect the tools

Run vitehub inspect definitions --kind mcp-tool to list every tool the build discovered.