Next.js Template MCP server

Provides a production-ready Next.js application template with Clerk authentication, Prisma database operations, and Neon PostgreSQL integration for building scalable web applications with user management, API key tracking, request logging, webhook handling, and OAuth 2.1 support with PKCE.
Back to servers
Setup instructions
Provider
Vedat Erenoglu
Release date
Aug 17, 2025
Stats
1 star

The Model Context Protocol (MCP) server with Clerk authentication provides a secure gateway to AI functionalities through a Next.js implementation. It offers user-specific API key management and multiple authentication methods for controlled access to MCP capabilities.

Getting Started

Installation

Clone the repository and install dependencies:

git clone [repository-url]
cd ve-nextjs-mcp-server
npm install

Configuration

Before running the server, you need to set up Clerk authentication:

  1. Create a Clerk account and application
  2. Disable sign-ups in the Clerk dashboard
  3. Copy the required environment variables to a .env.local file in your project root

Starting the Server

Run the development server with:

npm run dev

Once running, access the dashboard at http://localhost:3000

Using the MCP Server

Dashboard Access

  1. Visit http://localhost:3000 in your browser
  2. Sign in with an authorized account
  3. Use the dashboard to create and manage API keys

API Key Management

The dashboard provides a user interface for:

  • Creating new API keys
  • Viewing existing keys
  • Managing key permissions
  • Revoking access when needed

Making API Requests

Once you've created an API key through the dashboard, you can make requests to the MCP server:

curl -X POST http://localhost:3000/api/mcp \
  -H "Authorization: Bearer mcp_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "get_nextjs_docs",
      "arguments": {"topic": "app router"}
    },
    "id": 1
  }'

Authentication Methods

The server supports multiple authentication methods:

  • User-specific API keys
  • OAuth 2.1 with PKCE (Proof Key for Code Exchange)
  • Bearer tokens

Security Features

The MCP server implements several security measures:

  • Sign-in only access (no public registration)
  • Admin-controlled user management
  • User-isolated API keys to prevent cross-user access
  • Scoped permissions for granular control
  • Secure key generation practices

These features ensure that only authorized users can access the MCP functionality, with clear separation between different users' resources.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "ve-nextjs-mcp-server" '{"url":"http://localhost:3000/api/mcp","auth":{"type":"bearer"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "ve-nextjs-mcp-server": {
            "url": "http://localhost:3000/api/mcp",
            "auth": {
                "type": "bearer"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "ve-nextjs-mcp-server": {
            "url": "http://localhost:3000/api/mcp",
            "auth": {
                "type": "bearer"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later