---
title: "Model Context Protocol (MCP)"
description: "Connect AI agents like Claude to your Nuxt site via MCP servers with built-in tools and resources."
canonical_url: "https://nuxtseo.com/docs/ai-ready/guides/mcp"
---

> Index of every page on this site: [llms.txt](https://nuxtseo.com/llms.txt)

Use [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) to let clients list, search, and read your indexed pages.
Install [`@nuxtjs/mcp-toolkit`](https://github.com/nuxt-modules/mcp-toolkit) to host the MCP endpoint in your Nuxt server.

## Installation

The site tools read stored pages from the runtime database.
The database needs `drizzle-orm`, an optional peer dependency.

```bash
npx nuxt module add @nuxtjs/mcp-toolkit
npx nypm add drizzle-orm@1.0.0-rc.4
```

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  modules: [
    'nuxt-ai-ready',
    '@nuxtjs/mcp-toolkit',
  ],
  mcp: {
    enabled: true,
  },
})
```

Module order does not matter. Nuxt AI Ready also detects Toolkit installations declared as a later module's dependency.

If the app installs Toolkit but not `drizzle-orm`, the build fails and names the install command.
If you use Toolkit only for your own tools, set `aiReady: { database: false }`{lang="ts"}. The site tools then stay off and the app does not need `drizzle-orm`.

See [@nuxtjs/mcp-toolkit docs](https://mcp-toolkit.nuxt.dev/) for server configuration and transport options.

Cloudflare Workers and Pages also require Toolkit's `agents`{lang="bash"} peer:

```bash
pnpm add agents
```

## Connection

Connect your MCP client's Streamable HTTP transport to `https://example.com/mcp`{lang="text"}.
Use your configured Toolkit route if you changed it.

Start with `list_pages`, then pass a returned route to `get_page_markdown`.
If the list is empty, check [Data Availability](#data-availability) before changing the client configuration.

Client setup differs. Follow your client's remote MCP instructions and the [Toolkit documentation](https://mcp-toolkit.nuxt.dev/).

## Tools

### `list_pages`

Returns page metadata as JSON with pagination. Cached 1 hour.

**Parameters:**

| Param    | Type     | Description                                     |
| -------- | -------- | ----------------------------------------------- |
| `limit`  | `number` | Max pages to return, from 1 to 50 (default: 20) |
| `offset` | `number` | Skip first N pages (default: 0)                 |

**Example decoded response:**

```json
{
  "pages": [
    {
      "route": "/docs/getting-started",
      "title": "Getting Started",
      "description": "Quick start guide",
      "headings": [{ "h1": "Getting Started" }, { "h2": "Installation" }]
    }
  ],
  "total": 1,
  "limit": 20,
  "offset": 0,
  "hasMore": false
}
```

### `search_pages`

Searches stored pages. SQLite-compatible databases use FTS5 across title, description, route, headings, keywords, and content.
[PostgreSQL](https://postgresql.org) uses case-insensitive matching across title, description, headings, and content, with `score: 0`. The tool caches results for five minutes.

**Parameters:**

| Param   | Type     | Description                             |
| ------- | -------- | --------------------------------------- |
| `query` | `string` | Search query                            |
| `limit` | `number` | Max results, from 1 to 50 (default: 10) |

**Example decoded response:**

```json
[
  {
    "route": "/docs/installation",
    "title": "Installation",
    "description": "Install the module",
    "score": 0.15
  }
]
```

### `get_page_markdown`

Returns the indexed markdown for one route. Cached 5 minutes.

| Param   | Type     | Description                                 |
| ------- | -------- | ------------------------------------------- |
| `route` | `string` | Page route, with or without a leading slash |

```md
# Installation

Install the module...
```

Missing pages return a tool error instead of an empty response.

## Resources

**`resource://nuxt-ai-ready/pages`** returns the same page metadata as `list_pages`, cached for one hour.
It accepts `?limit=N&offset=N`, with a default limit of 100 and a maximum of 500.
Use the resource when your client reads MCP resources instead of calling tools.

## Data Availability

MCP tools read the runtime database. On the first MCP request, Nuxt AI Ready restores page data produced during the build before the Toolkit resolves its tools.

| Environment    | Data Source                                    |
| -------------- | ---------------------------------------------- |
| **Dev mode**   | Empty (no prerender data)                      |
| **Production** | Build index restored into the runtime database |

Prerender at least the pages you want to expose, or enable [runtime indexing](https://nuxtseo.com/docs/ai-ready/guides/runtime-indexing). Test the MCP server with `nuxi build`{lang="bash"} and a running Nitro server. A fully static `nuxi generate`{lang="bash"} deployment cannot host the Toolkit server route.

## Configuration

`aiReady.tools`{lang="ts"} configures definitions shared by MCP and WebMCP. Transport settings stay with the attachment:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  aiReady: {
    tools: {
      listPages: {
        defaultLimit: 10,
        mcp: { enabled: false },
      },
      searchPages: {
        defaultLimit: 5,
      },
    },
    mcp: {
      resources: false,
    },
    webmcp: true,
  }
})
```

Here, `list_pages` stays available to WebMCP but is left off the regular MCP server. `search_pages` defaults to five results on both transports. Set `aiReady.mcp.tools`{lang="ts"} to `false` to detach all three tools from MCP Toolkit.

These settings only affect Nuxt AI Ready definitions. Tools added directly through MCP Toolkit keep their own config.

Configure optional card metadata under `aiReady.mcpServerCard`{lang="ts"}:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  aiReady: {
    mcpServerCard: {
      name: 'com.example/docs-mcp',
      title: 'Acme docs MCP',
      websiteUrl: 'https://example.com/docs/mcp',
      cacheMaxAge: 900,
    },
  },
})
```

The card name must use reverse-DNS/server format. Without an explicit name, Nuxt AI Ready derives one from `site.url`{lang="ts"} and the MCP route, then synchronizes MCP Toolkit to the same runtime identity. A pre-existing human-readable `mcp.name`{lang="ts"} is retained as the card title.

## Server discovery

Runtime MCP servers publish a [SEP-2127 Server Card](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2127) beside the Streamable HTTP endpoint. A server at `/mcp`{lang="bash"} publishes its card at `/mcp/server-card`{lang="bash"}. Custom MCP routes and `app.baseURL`{lang="ts"} are preserved.

The module also serves the same card at `/.well-known/mcp/server-card.json`{lang="bash"} and `/.well-known/mcp.json`{lang="bash"}.
Agent readiness scanners, such as Cloudflare's [isitagentready](https://isitagentready.com), look for a card at these paths.

::warning
Server Cards and AI Catalog discovery are experimental. SEP-2127 remains a draft, and its mandated canonical schema URL may return 404 until MCP publishes the v1 schema upstream.
::

When `site.url`{lang="ts"} is set, the module publishes the same catalog at two origin paths:

- [`/.well-known/ard.json`](https://github.com/ards-project/ard-spec), the ARD v0.91 discovery path.
- [`/.well-known/ai-catalog.json`](https://ai-catalog.io/spec/), the AI Catalog discovery path.

Each entry includes the Server Card's title, description, identifier, media type, and URL.
If the card has no title, the entry uses its server name.
Agents can find the Server Card without knowing the MCP route.

```bash
curl -H 'Accept: application/mcp-server-card+json' https://example.com/mcp/server-card
curl -H 'Accept: application/mcp-server-card+json' https://example.com/.well-known/mcp/server-card.json
curl -H 'Accept: application/ai-catalog+json' https://example.com/.well-known/ai-catalog.json
curl -H 'Accept: application/ai-catalog+json' https://example.com/.well-known/ard.json
```

The card publishes static identity and connection metadata, including every protocol version supported by the installed MCP SDK. Tools, resources, prompts and capabilities remain discoverable through the live MCP protocol. Responses include CORS headers, a strong `ETag`{lang="http"}, and support `If-None-Match`{lang="http"} revalidation.

Set `aiReady.mcpServerCard`{lang="ts"} to `false` to remove the card and its AI Catalog entry. A fully static `nuxi generate`{lang="bash"} deployment does not publish either because it cannot host an MCP server.

`llms.txt`{lang="bash"} links the card at `/.well-known/mcp/server-card.json`{lang="bash"}, not the MCP endpoint.
The endpoint answers `GET`{lang="http"} with 405 or 406, so `llms.txt`{lang="bash"} link checkers count an endpoint link as broken.
The card link's description names the endpoint URL.
With `aiReady.mcpServerCard: false`{lang="ts"}, `llms.txt`{lang="bash"} has no MCP entry. The API Catalog still lists the endpoint.

If you enable built-in MCP tools, the module adds usage guidance to the handshake and the `llms.txt` card link.
Set `mcp.instructions`{lang="ts"} to provide your own handshake guidance.
Use `aiReady.llmsTxt.notes`{lang="ts"} to explain which product tasks your site supports.

## Extending the Server

Use the Toolkit hooks when its config API is too coarse:

- `mcp:config:resolved` can adjust the resolved tools, resources and server config.
- `mcp:server:created` exposes the low-level MCP server for custom registration.

See the [Toolkit hooks guide](https://mcp-toolkit.nuxt.dev/advanced/hooks) for hook payloads and examples. Custom Toolkit paths also work with Nuxt AI Ready. See [custom paths](https://mcp-toolkit.nuxt.dev/advanced/custom-paths).

## Sitemap

See the full [sitemap](https://nuxtseo.com/sitemap.md) for all pages.
