---
title: "Create an MCP server in Nuxt"
description: "Expose application tools, resources, and prompts through the shared Nitro MCP runtime in Nuxt 4.6 or later."
canonical_url: "https://mcp-toolkit.nuxt.dev/1.x/getting-started/introduction"
---
# Create an MCP server in Nuxt

> Expose application tools, resources, and prompts through the shared Nitro MCP runtime in Nuxt 4.6 or later.

## Choose what to expose

An MCP client connects an AI application to capabilities you publish. A **tool** performs an operation, a **resource** supplies content at a URI, and a **prompt** supplies a reusable conversation template. Your application owns its data and authorization.

Nuxt MCP Toolkit discovers these definitions from files. Nuxt supplies layers, server middleware, auto-imports, DevTools integration, and installation links. The shared `nitro-mcp-toolkit` runtime handles the protocol on Nitro 2 and Nitro 3.

This documentation describes the 1.0 beta API. Existing 0.x applications should follow the [migration guide](https://mcp-toolkit.nuxt.dev/1.x/getting-started/beta-migration). Built-in MCP Apps and Code Mode are excluded from this beta.

## Start with a useful tool

```ts [server/mcp/tools/greet.ts]
import { z } from 'zod'
import { defineMcpTool } from '@nuxtjs/mcp-toolkit/server'

export default defineMcpTool({
  description: 'Greet someone by name',
  annotations: { readOnlyHint: true, openWorldHint: false },
  inputSchema: z.object({ name: z.string().min(1) }),
  outputSchema: z.object({ greeting: z.string() }),
  handler: ({ name }) => ({ greeting: `Hello ${name}!` }),
})
```

The filename supplies the name `greet`. Inputs are parsed before the handler runs. The output schema validates returned data and advertises its shape; clients receive structured data and a JSON text fallback.

## Keep request state explicit

With inputs, callbacks receive `(args, event)`; without inputs, they receive `event`. Use verified request context for identity. Keep services and storage independent of MCP, and authorize each operation before accessing private data.

The default endpoint is `/mcp`. Configure [independent endpoints](https://mcp-toolkit.nuxt.dev/1.x/handlers/overview) when catalogs or authentication differ. Keep `era: 'dual'` for modern and legacy client paths; advanced interactions still depend on client capabilities.

Continue with [installation](https://mcp-toolkit.nuxt.dev/1.x/getting-started/installation), [OAuth](https://mcp-toolkit.nuxt.dev/1.x/getting-started/oauth), or [tool schemas](https://mcp-toolkit.nuxt.dev/1.x/tools/schema-handler).


## Sitemap

See the full [sitemap](https://mcp-toolkit.nuxt.dev/sitemap.md) for all pages.
