Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Latest commit

 

History

History
71 lines (48 loc) · 1.89 KB

File metadata and controls

71 lines (48 loc) · 1.89 KB

@modelfetch/next

npm version npm license docs

Run flexible MCP servers with Next.js.

Installation

npm install @modelfetch/next

Usage

Next.js App Router

import handle from "@modelfetch/next";
import server from "./server"; // Import your McpServer

const handler = handle(server);

// Export as Next.js App Router API route handlers
export const GET = handler;
export const POST = handler;
export const DELETE = handler;

Use Node.js Runtime

import handle from "@modelfetch/next";
import server from "./server"; // Import your McpServer

const handler = handle(server);

// Export as Next.js App Router API route handlers
export const GET = handler;
export const POST = handler;
export const DELETE = handler;

// Use Node.js runtime (default)
export const runtime = "nodejs";

Use Edge Runtime

import handle from "@modelfetch/next";
import server from "./server"; // Import your McpServer

const handler = handle(server);

// Export as Next.js App Router API route handlers
export const GET = handler;
export const POST = handler;
export const DELETE = handler;

// Use Edge runtime
export const runtime = "edge";

API Reference

handle(server)

Creates a Next.js App Router API route handler from an McpServer instance