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

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@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