MCP Hub
Back to servers

Midnight + Next.js MCP

Requires Setup

A robust developer toolset combining Midnight blockchain smart contract (Compact) analysis with comprehensive Next.js development utilities, featuring semantic search across 39 repositories and runtime diagnostics.

Tools
36
Updated
Jan 7, 2026
Validated
Jan 9, 2026

Quick Install

npx -y midnight-nextjs-mcp

Midnight + Next.js MCP Server

npm version npm downloads MCP Registry License TypeScript CI

Unified MCP server that gives AI assistants access to Midnight blockchain and Next.js development—combining Compact contract analysis, turbo monorepo scaffolding, and full-stack dApp development in one package.

Requirements

  • Node.js 20+ (LTS recommended)

Check your version: node --version

Using nvm? Click for Claude Desktop setup

If you use nvm, Claude Desktop may not see your nvm-managed Node. Use this config instead:

{
  "mcpServers": {
    "midnight-nextjs": {
      "command": "/bin/sh",
      "args": [
        "-c",
        "source ~/.nvm/nvm.sh && nvm use 20 >/dev/null 2>&1 && npx -y midnight-nextjs-mcp@latest"
      ]
    }
  }
}

Quick Start

VS Code with GitHub Copilot (MCP Registry)

The easiest way to install! Open VS Code and:

  1. Open the Extensions panel (Ctrl+Shift+X / Cmd+Shift+X)
  2. Click the filter icon and select MCP Registry
  3. Search for midnight-nextjs-mcp
  4. Click Install

Or manually add to .vscode/mcp.json:

{
  "servers": {
    "midnight-nextjs-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "midnight-nextjs-mcp@latest"]
    }
  }
}

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "midnight-nextjs": {
      "command": "npx",
      "args": ["-y", "midnight-nextjs-mcp@latest"]
    }
  }
}

Config file locations:

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

Cursor

One-click install:

Install MCP Server

Or manually add to .cursor/mcp.json:

{
  "mcpServers": {
    "midnight-nextjs": {
      "command": "npx",
      "args": ["-y", "midnight-nextjs-mcp@latest"]
    }
  }
}

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "midnight-nextjs": {
      "command": "npx",
      "args": ["-y", "midnight-nextjs-mcp@latest"]
    }
  }
}

No API keys required. Restart your editor after adding the config.

Why @latest? Unlike cached npx packages that never auto-update, @latest ensures you get new features and fixes on each restart. If upgrading from an older config without @latest, also clear your npx cache: rm -rf ~/.npm/_npx


What's Included

29 Midnight Tools + 7 Next.js Tools

CategoryToolsDescription
Midnight Searchsearch-compact, search-typescript, search-docs, fetch-docsSemantic search + live docs fetching
Contract Analysisanalyze-contract, explain-circuit, extract-contract-structureStatic analysis with 15+ checks (P0-P2 severity)
Repositoryget-file, list-examples, get-latest-updatesAccess files and examples
Versioningget-version-info, check-breaking-changes, get-migration-guide, get-file-at-version, compare-syntax, get-latest-syntaxVersion tracking and migration
AI Generationgenerate-contract, review-contract, document-contractAI-powered code generation (requires sampling)
Compoundupgrade-check, get-repo-contextMulti-step operations (saves 50-70% tokens)
Next.jsinit, nextjs-docs, browser-eval, nextjs-index, nextjs-call, upgrade-nextjs-16, enable-cache-componentsRuntime diagnostics, docs, browser automation
Healthhealth-check, get-status, check-version, data-freshness, auto-update-configServer status, version, and data freshness
Discoverylist-tool-categories, list-category-tools, suggest-toolExplore available tools and get recommendations

Midnight tools are prefixed with midnight- (e.g., midnight-search-compact), Next.js tools with nextjs-.

📍 Listed on GitHub MCP Registry: Install directly in VS Code via Extensions → MCP Registry → search "midnight"

Next.js DevTools (Bundled)

This server bundles next-devtools-mcp (v0.3.9+) for unified development:

ToolDescription
nextjs-initCall first! Initialize DevTools context
nextjs-nextjs-docsSearch/get official Next.js documentation
nextjs-browser-evalPlaywright browser automation
nextjs-nextjs-indexDiscover running Next.js 16+ dev servers
nextjs-nextjs-callExecute runtime diagnostics (get_errors, get_logs, get_page_metadata)
nextjs-upgrade-nextjs-16Automated upgrade with codemods
nextjs-enable-cache-componentsCache Components setup and migration
⚠️ Auto-Initialize Every Session (click to expand)

Always call nextjs-init at the start of every Next.js development session!

Add this to your agent's configuration:

Claude Desktop/Claude Code (.claude/CLAUDE.md):

When starting work on a Next.js project, ALWAYS call the `nextjs-init` tool from
midnight-nextjs-mcp FIRST to set up proper context and establish documentation
requirements. Do this automatically without being asked.

Cursor (.cursorrules):

When working with Next.js, always call the init tool from midnight-nextjs-mcp
at the start of the session to establish proper context and documentation requirements.

Next.js MCP Resources (Proxied)

Resources from next-devtools-mcp are automatically available:

📚 Cache Components (13 sections)
  • cache-components://overview - Introduction
  • cache-components://core-mechanics - How caching works
  • cache-components://public-caches - Shared data caching
  • cache-components://private-caches - User-specific caching
  • cache-components://runtime-prefetching - Prefetching strategies
  • cache-components://request-apis - Request-scoped APIs
  • cache-components://cache-invalidation - Revalidation patterns
  • cache-components://advanced-patterns - Complex scenarios
  • cache-components://build-behavior - Build-time caching
  • cache-components://error-patterns - Common errors and fixes
  • cache-components://test-patterns - Testing cached components
  • cache-components://reference - Complete API reference
  • cache-components://route-handlers - Route handler caching
📦 Next.js 16 Migration & Fundamentals
  • nextjs16://migration/beta-to-stable - Migration from beta
  • nextjs16://migration/examples - Migration code examples
  • nextjs-fundamentals://use-client - Client component directive

MCP Capabilities

CapabilityFeature
Tools36 tools with listChanged notifications
Resources35 embedded resources with subscription support
Prompts9 workflow prompts (Midnight + Next.js)
LoggingClient-controllable log level
CompletionsAutocomplete for prompt arguments
ProgressReal-time progress for compound tools
SamplingAI-powered generation (when client supports it)
Next.jsFull turbo monorepo integration

35 Embedded Resources

Quick references available offline:

  • Compact syntax guide (v0.16-0.18)
  • SDK API reference
  • OpenZeppelin contracts
  • Tokenomics overview
  • Wallet integration
  • Common errors & solutions
  • Next.js integration patterns
  • Turbo monorepo configuration
  • Cache Components guide
  • Next.js 16 migration guide

Static Analysis

extract-contract-structure catches common mistakes before compilation:

CheckSeverityDescription
deprecated_ledger_blockP0Catches ledger { } → use export ledger field: Type;
invalid_void_typeP0Catches Void → use [] (empty tuple)
invalid_pragma_formatP0Catches old pragma → use >= 0.16 && <= 0.18
unexported_enumP1Enums need export for TypeScript access
module_level_constP0Use pure circuit instead
+ 10 more checksP1-P2Overflow, division, assertions, etc.

9 Prompts

Midnight Prompts:

  • midnight:create-contract — Generate new contracts
  • midnight:review-contract — Security and code review
  • midnight:explain-concept — Learn Midnight concepts
  • midnight:compare-approaches — Compare implementation patterns
  • midnight:debug-contract — Troubleshoot issues
  • midnight:nextjs-dapp — Scaffold Midnight + Next.js turbo monorepo

Next.js Prompts:

  • nextjs:upgrade-to-16 — Guide for upgrading to Next.js 16
  • nextjs:enable-cache-components — Cache Components migration workflow
  • nextjs:runtime-diagnostics — Diagnose runtime issues in Next.js 16+

GitHub MCP Registry

This server is listed on the official GitHub MCP Registry!

One-Click Install (VS Code + Copilot)

  1. Open VS Code Extensions panel (Ctrl+Shift+X / Cmd+Shift+X)
  2. Click the filter icon → select MCP Registry
  3. Search for midnight-nextjs-mcp
  4. Click Install

Registry Details

PropertyValue
Registry Nameio.github.FractionEstate/midnight-nextjs-mcp
npm Packagemidnight-nextjs-mcp
Version0.3.0
Transportstdio

Verify Registration

curl "https://registry.modelcontextprotocol.io/v0.1/servers?search=midnight-nextjs-mcp"

Indexed Repositories

The API indexes 39 Midnight repositories:

CategoryRepositories
Corecompact, midnight-js, midnight-wallet, midnight-docs, midnight-node, midnight-indexer, midnight-ledger, midnight-zk
Examplesexample-counter, example-bboard, example-dex, create-mn-app
Infrastructuremidnight-node-docker, midnight-dapp-connector-api, compact-tree-sitter, setup-compact-action
Partner LibrariesOpenZeppelin/compact-contracts, OpenZeppelin/midnight-apps (LunarSwap)
Official Partnersbricktowers/midnight-seabattle, bricktowers/midnight-identity, bricktowers/midnight-rwa, MeshJS/midnight-starter-template, midnames/core
Core PartnerPaimaStudios/midnight-game-2, PaimaStudios/midnight-wasm-prover, PaimaStudios/midnight-batcher, PaimaStudios/midnight-impact-rps-example
Hackathon WinnersSea Battle: ErickRomeroDev/naval-battle-game_v2, eddex/midnight-sea-battle-hackathon • Mini DApp: statera-protocol, nel349/midnight-bank, Imdavyking/zkbadge

Advanced Configuration

HTTP Mode

Run as an HTTP server for web integrations or remote deployment:

# Start HTTP server on port 3000
npx midnight-nextjs-mcp --http --port 3000

Endpoints:

  • /health - Health check
  • /mcp - Streamable HTTP (MCP protocol)
  • /sse - Server-Sent Events

CLI Options

npx midnight-nextjs-mcp --help

Options:
  --stdio          Use stdio transport (default, for Claude Desktop)
  --http           Use HTTP transport with SSE support
  --port <number>  HTTP port (default: 3000)
  --json           Output in JSON (default: YAML for better LLM efficiency)
  --github-token   GitHub token (overrides GITHUB_TOKEN env var)
  -h, --help       Show help
  -v, --version    Show version

Why YAML by default? YAML is ~20-30% more token-efficient than JSON, which means AI assistants can process more context from tool responses.

Local Mode

Run everything locally for privacy or offline use:

{
  "mcpServers": {
    "midnight-nextjs": {
      "command": "npx",
      "args": ["-y", "midnight-nextjs-mcp@latest"],
      "env": {
        "MIDNIGHT_LOCAL": "true",
        "OPENAI_API_KEY": "sk-...",
        "CHROMA_URL": "http://localhost:8000"
      }
    }
  }
}

Requires ChromaDB (docker run -d -p 8000:8000 chromadb/chroma) and OpenAI API key.

GitHub Token

Add "GITHUB_TOKEN": "ghp_..." for higher GitHub API rate limits (60 → 5000 requests/hour).


Developer Setup

git clone https://github.com/FractionEstate/midnight-nextjs-mcp.git && cd midnight-nextjs-mcp
npm install && npm run build && npm test

The hosted API runs on Cloudflare Workers + Vectorize. See api/README.md for backend details.


Links

License

MIT

Thanks to all Stargazers ⭐️

Reviews

No reviews yet

Sign in to write a review