Skip to content

feat: migrate to the MCP Toolkit 1.0 preview - #2567

Draft
HugoRCD wants to merge 5 commits into
mainfrom
feat/mcp-toolkit-beta
Draft

HugoRCD wants to merge 5 commits into
mainfrom
feat/mcp-toolkit-beta

Conversation

@HugoRCD

@HugoRCD HugoRCD commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Written by an AI agent on behalf of @HugoRCD, who shaped the solution. @HugoRCD has not reviewed it yet.

Migrate nuxt.com’s MCP endpoints to the shared Nitro runtime using mcp-toolkit#406, including its runtime authentication and DX improvements. Pin @nuxtjs/mcp-toolkit to https://pkg.pr.new/@nuxtjs/mcp-toolkit@2fa99b1; the preview package pins its matching Nitro runtime to the same commit. Local verification used packed builds of both packages, followed by the published preview. Keep this draft for testing and switch to a published beta before merging.

  • Keep complete Zod schemas and JSON Schema examples while removing satisfies boilerplate and empty input schemas. Preserve tool names, descriptions and examples.
  • Use native Nitro cached functions with the existing lifetimes and cache keys containing the request origin and parsed arguments. Enable Nitro async context for application services that need the host request event.
  • Keep metadata and the long admin instructions beside the definitions in server/mcp/index.ts and server/mcp-admin/index.ts, using defineMcpServer(). The admin index also defines runtime authentication. Remove root mcp.config.ts and the separate auth file; Nuxt config only selects each server’s directory.
  • Infer admin definition names and display titles from filenames; omit the redundant name, title and group fields. Existing unit-test handlers supply their own names because they compose definitions directly.
  • Discover both endpoints through mcp.servers: public definitions in server/mcp, admin definitions in server/mcp-admin. Replace the manually composed admin route and its definition imports with discovery and per-folder configuration.
  • Read the admin credential from runtime configuration. Missing, incorrect or unconfigured tokens return 401; the private-chat restrictions remain covered by existing unit tests.
  • Generate the public server card from the public handler’s catalog, retaining discovery links and tool-call metrics.
  • Consume the Nitro 2 bundling/tree-shaking improvements. The toolkit’s isolated fixture measurements are not a size or speed claim for nuxt.com.

Per-folder configuration with discovery

nuxt.config.ts only selects servers:

mcp: {
  servers: {
    default: {},
    admin: { dir: 'mcp-admin' }
  }
}

server/mcp/index.ts holds the public name, icons and documentation link. server/mcp-admin/index.ts holds the existing admin metadata/instructions and reads the private token when a request arrives:

import { defineMcpServer } from '@nuxtjs/mcp-toolkit/server'
import { useRuntimeConfig } from 'nitropack/runtime'

export default defineMcpServer({
  name: 'admin',
  // Existing metadata and instructions live here.
  auth: {
    schemes: ['bearer'],
    validate: ({ token }) => {
      const { mcpAdminToken } = useRuntimeConfig()
      return Boolean(mcpAdminToken) && token === mcpAdminToken
    }
  }
})

Set NUXT_MCP_ADMIN_TOKEN when starting the app. The same production artifact is checked with and without a demo token, without rebuilding. New admin definitions are discovered without adding imports. The complete admin instruction text is unchanged. Installation links use the public name from its index.

Endpoint separation and inferred metadata

A temporary check compares each complete tool/prompt catalog with the files under that server’s own directory, rejects cross-server tool calls, checks that the complete admin instruction text is preserved, and verifies that installation links read the public index. Both protocol generations pass; missing and wrong admin tokens are refused. The earlier metadata cleanup also compared inferred names/titles against the preceding production build.

Current raw output from the published preview, exit 0:

modern /mcp: exact 12-tool / 3-prompt catalog matches its own directory; cross-server calls rejected
modern /mcp/admin: exact 10-tool / 5-prompt catalog matches its own directory; cross-server calls rejected
legacy /mcp: exact 12-tool / 3-prompt catalog matches its own directory; cross-server calls rejected
legacy /mcp/admin: exact 10-tool / 5-prompt catalog matches its own directory; cross-server calls rejected
installation links: discovered public server name Nuxt
modern: admin rejects missing and incorrect tokens; authenticated admin prompt returns expected instructions
legacy: admin rejects missing and incorrect tokens; authenticated admin prompt returns expected instructions
server card: exact public catalog, no admin definitions, no-cache

Exit code: 0

The production build, type check, lint and all 447 existing unit tests also pass after the metadata cleanup. Moving the configuration preserves the admin instructions exactly; Nuxt preparation and generated type checking pass with the per-folder indexes. No new test or verification file is committed.

Validation

Check Current result
Frozen lockfile install, then Nuxt preparation Passed
ESLint, including fixes before commit Passed
Generated Nuxt types (vue-tsc -b --noEmit) Passed
Existing unit tests 447 passed
Nuxt integration tests 46 passed
Production Node-server build Passed
Real modern and legacy MCP clients against the production build Passed

Earlier raw output from the temporary production check against locally packed candidates, exit 0:

modern: public 12 tools / 3 resources / 3 prompts; docs, repeated read, blog, resource and prompt OK; admin 10 tools / 5 prompts; missing and invalid tokens rejected
legacy: public 12 tools / 3 resources / 3 prompts; docs, repeated read, blog, resource and prompt OK; admin 10 tools / 5 prompts; missing and invalid tokens rejected
server card: public catalog only, no-cache OK
admin route variants: missing and invalid tokens rejected

Exit code: 0

The same build started without NUXT_MCP_ADMIN_TOKEN, exit 0:

unset runtime admin token: both protocol generations refuse missing and supplied credentials

Exit code: 0

The final published-preview production build, frozen install, lint, type checking and all 493 tests pass. Its focused protocol checks above pass on both revisions. Repeating the broader documentation-content smoke against that artifact was blocked by the external GitHub source lookup:

AssertionError [ERR_ASSERTION]: [403] GitHub commits query for nuxt/nuxt#4.x failed with 403

That run exits 1; it is not reported as a successful documentation-content check. The preceding local-candidate build had content available and passed the broader check shown above.

These checks read local public Nuxt documentation, public blog/deployment content and a harmless admin prompt. Admin tools that access private chats, feedback or Google APIs were not invoked; the existing unit suites use fixtures to check those restrictions.

The temporary smoke runner stays outside the repository. The extra auth spec and committed verification script were removed as requested; the PR no longer advertises pnpm test:mcp. Browser screenshots, model-backed MCP evals, live provider login and a fresh development-server smoke test were not run for this update. The final production build emitted dependency/bundler warnings and completed successfully. Its generated discovery report confirms index.ts for both endpoints. The 391 toolkit tests also pass, including index/layer discovery, reloads, runtime auth, and Nuxt installation-link/llms.txt integration.

The local pnpm 12.18 install needed its URL-subdependency block disabled for the explicitly pinned preview runtime; the repo itself remains on pnpm 12.15. No policy override was committed.

Each MCP server now keeps its settings beside its tools. Public documentation stays public, and team tools read their access token at runtime before serving requests.

@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nuxt Ready Ready Preview Nov 10, 2026 10:53am UTC

Request Review

@nuxt-com-bundle-report

Copy link
Copy Markdown

Production bundle

Comparing ad5aa0cf with 4a00c8d7. Compressed sizes are calculated from the emitted production assets.

Initial page load

Page Base JS (Brotli) PR JS (Brotli) Δ JS Δ CSS Δ files
/ 555.0 KiB 555.0 KiB +9 B (+0.0%) — —
/docs/4.x/getting-started/introduction 613.3 KiB 613.3 KiB +24 B (+0.0%) — —
/modules/ui 545.4 KiB 545.5 KiB +62 B (+0.0%) — —
/updates 450.2 KiB 450.2 KiB +19 B (+0.0%) — —
/blog/v4-6 573.7 KiB 573.7 KiB +19 B (+0.0%) — —
/templates 431.0 KiB 431.0 KiB +16 B (+0.0%) — —

Entry script, modulepreload chunks and stylesheets referenced by the prerendered HTML. Lazy and prefetched chunks are excluded.

All client assets

Metric Base (Brotli) PR (Brotli) Δ Brotli Δ gzip
Client JavaScript 2.20 MiB 2.20 MiB +54 B (+0.0%) -5 B (-0.0%)
Client CSS 34.3 KiB 34.3 KiB — —
Other client assets 339.3 KiB 339.3 KiB -2 B (-0.0%) -1 B (-0.0%)
Total client assets 2.56 MiB 2.56 MiB +52 B (+0.0%) -6 B (-0.0%)

Largest module increases

Module Base (Brotli) PR (Brotli) Δ Brotli
virtual:nuxt-workers.mjs?source=%2Fhome%2Frunner%2Fwork%2Fnuxt.com%2Fnuxt.com%2Fapp%2Fworkers%2Fsearch.ts 0 B 408 B +408 B
/app/pages/nuxters/async-data-chunk-5.js 0 B 237 B +237 B
/app/pages/modules/[slug]/async-data-chunk-8.js 0 B 213 B +213 B
/app/async-data-chunk-25.js 0 B 187 B +187 B
/app/pages/docs/async-data-chunk-6.js 0 B 161 B +161 B
/app/pages/modules/[slug]/async-data-chunk-9.js 0 B 135 B +135 B
/app/pages/blog/async-data-chunk-16.js 0 B 121 B +121 B
/app/pages/async-data-chunk-11.js 0 B 120 B +120 B
/app/pages/enterprise/async-data-chunk-0.js 0 B 118 B +118 B
/app/pages/modules/async-data-chunk-23.js 0 B 118 B +118 B

Module values come from Nuxt’s analyzer and are attribution estimates. This workflow is currently report-only.

Workflow run

This branch was successfully deployed

1 active deployment
Preview — dfcb0ffb Deployed Nov 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant