nextjs-mcp-server

nextjs-mcp-server

1

This project is a Motion Control Protocol (MCP) server implemented using Next.js. It supports real-time communication through Server-Sent Events and provides a JSON-RPC compliant API for tool invocation. It is designed to integrate with Cursor as an external tool provider.

Next.js MCP Server

A Motion Control Protocol (MCP) server implementation using Next.js.

Features

  • Server-Sent Events (SSE) for real-time communication
  • JSON-RPC compliant API for tool invocation
  • House exploration example with rooms, items, and resources
  • Compatible with Cursor's MCP requirements

Getting Started

  1. Install dependencies
  2. Run the development server

Connecting with Cursor

  1. Make sure your server is running
  2. In Cursor, go to Settings > Tools > Motion Control Protocol
  3. Add a new MCP server with the provided URL

Available Tools

  • house.getDetails - Get general information about the house
  • house.getRooms - List all rooms (basic info)
  • house.getRoom - Get details about a specific room
  • getPassword - Get the password for accessing room 5
  • resources.list - List all available resources
  • resources.get - Get a specific resource by ID

Implementation Details

This MCP server is based on Next.js App Router and uses:

  • API Routes for JSON-RPC endpoints
  • Server-Sent Events for real-time communication
  • Next.js streaming responses
  • TypeScript for type safety