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 }),
})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.