Next.js MCP Server

Next.js MCP Server is an open-source template and implementation for hosting Model Context Protocol servers inside a Next.js web application deployed on Vercel. Developed by Run-Llama, it connects MCP clients to custom application endpoints using OAuth 2.1 authentication, backing user sessions and client registrations with PostgreSQL and Prisma. Developers building AI-enabled web services use this server to expose custom tools, resources, and API integrations securely to remote AI agents. The project utilizes the Vercel MCP adapter to support both Server-Sent Events and Streamable HTTP transports. A Redis instance is supported to handle session persistence for SSE connections. It also integrates Auth.js with Google as a default login provider for the host application consent screens, enabling builders to scaffold custom authenticated endpoints for Claude Desktop, Cursor, Visual Studio Code, and MCP Inspector without writing authentication and transport protocols from scratch.

Category: Databases & Data Stores

Tags: authentication, nextjs, oauth, postgresql, redis

Visit Next.js MCP Server

How to install and configure Next.js MCP Server

Follow these steps to install and run the Next.js MCP Server locally and configure it in your client: 1. Clone the repository and install dependencies using npm install. 2. Set up your .env file with DATABASE_URL, AUTH_SECRET, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and optionally REDIS_URL. 3. Generate the database client and push the initial schema using prisma generate and prisma db push. 4. Start the development server by executing npm run dev. 5. For Cursor, add the server to your mcp.json file: json { "mcpServers": { "MyServer": { "name": "LlamaIndex MCP Demo", "url": "https://example.com/mcp/mcp", "transport": "http-stream" } } } 6. For Claude Desktop or Claude.ai, connect via the SSE transport by providing the full URL ending in /mcp/sse.

What you can do with Next.js MCP Server

  • Deploying a custom Next.js application that exposes internal business APIs to AI coding assistants using OAuth 2.1 authentication. * Integrating Claude Desktop and Claude.ai with backend tools over Server-Sent Events supported by Redis-backed session management. * Providing streamable HTTP endpoints to Cursor or Visual Studio Code with token verification and database-backed client registration. * Prototyping custom MCP tools and endpoints using the Vercel MCP adapter and Prisma database ORM tooling.

Key facts

  • Open Source
  • https://github.com/run-llama/mcp-nextjs
  • Databases & Data Stores, Developer Tools & Code Intelligence
  • authentication, nextjs, oauth, postgresql, redis

Part of MCP Servers

Related MCP servers

  • MCP LaTeX Server — MCP LaTeX Server is an MCP server that provides tools for creating, editing, validating, and compiling LaTeX documents directly through…
  • MCP JSON — MCP JSON is an MCP server collection that bundles tools for file system operations, Google search, browser-based web automation, and…
  • MCP Jupyter Complete — MCP Jupyter Complete is an MCP server that provides tools for manipulating Jupyter notebook files through position-based cell operations and…
  • MCP LSP Go — MCP LSP Go is an MCP server that connects AI assistants to the official Go Language Server Protocol implementation, gopls,…
  • MCP Manager — MCP Manager is an MCP server management tool that connects directly to your Claude Desktop environment, enabling users to discover,…
  • MCP Lab — MCP Lab is an MCP server development environment designed for building, testing, and debugging custom Model Context Protocol servers integrated…

What is Next.js MCP Server?

Next.js MCP Server is an open-source reference implementation by Run-Llama for running an MCP server inside a Next.js application on Vercel. It provides OAuth 2.1 authentication handling, Prisma-based PostgreSQL storage, and dual transport support.

Which MCP clients work with Next.js MCP Server?

The server works with Claude Desktop, Claude.ai, Cursor, Visual Studio Code, and the official MCP Inspector. Claude requires connecting via the SSE transport route, while Cursor and VSCode connect via Streamable HTTP.

What databases are required for Next.js MCP Server?

A PostgreSQL database is required to store OAuth clients, tokens, and session details using Prisma. If you plan to support Claude via SSE transport, a Redis database connection is also required.

Is Next.js MCP Server open source?

Yes, Next.js MCP Server is open source and hosted on GitHub under the run-llama organization. Note that the repository is currently archived and serves primarily as an architectural template for developers.

  • AI Tools
  • Categories
  • Industries
  • CLI Coding Agents
  • MCP Servers
  • MCP Categories