Socket
Book a DemoInstallSign in
Socket

@fractal-mcp/mcp-nextjs

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fractal-mcp/mcp-nextjs

Next.js API utilities for MCP server hosting

latest
npmnpm
Version
0.10.0
Version published
Weekly downloads
11
-57.69%
Maintainers
1
Weekly downloads
 
Created
Source

@fractal-mcp/mcp-nextjs

Next.js utilities for hosting Model Context Protocol (MCP) servers. This mirrors the functionality of @fractal-mcp/mcp-express but targets Next.js applications.

Installation

npm install @fractal-mcp/mcp-nextjs

Usage

Create a Next.js API route using the pages router:

// pages/api/mcp.ts
import { FractalMCPServer } from '@fractal-mcp/mcp';
import { createNextApiHandler } from '@fractal-mcp/mcp-nextjs';

const mcpServer = new FractalMCPServer({ name: 'example', version: '1.0.0' });
// register tools ...

export default createNextApiHandler(mcpServer);

For projects using the newer app router you can proxy requests to the pages route:

// app/api/mcp/route.ts
import { NextRequest } from 'next/server';

export async function GET(req: NextRequest) {
  return fetch(new URL('/api/mcp', req.url), { headers: req.headers });
}
export async function POST(req: NextRequest) {
  return fetch(new URL('/api/mcp', req.url), {
    method: 'POST',
    headers: req.headers,
    body: req.body,
  });
}

The helpers defaultCorsMiddleware and defaultAuthMiddleware are available if you need more control.

FAQs

Package last updated on 15 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.