midnight-nextjs-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MIDNIGHT_NETWORK | No | Midnight network to use (testnet, devnet, etc.) | testnet |
| MIDNIGHT_NODE_URL | No | URL for the Midnight RPC node | https://rpc.testnet.midnight.network |
| MIDNIGHT_INDEXER_URL | No | URL for the Midnight indexer GraphQL endpoint | https://indexer.testnet.midnight.network/graphql |
| MIDNIGHT_PROOF_SERVER_URL | No | URL for the Midnight proof server | https://proof-server.testnet.midnight.network |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {} |
| prompts | {} |
| resources | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| midnight_initA | ⚠️ CALL THIS FIRST - Initialize Midnight Network development context. IMPORTANT: This tool MUST be called at the START of every Midnight development session. This tool:
Use this tool to:
|
| midnight_network_statusB | Check the health status of Midnight Network services. Returns the status of:
Use this tool to:
|
| midnight_get_balanceA | Query token balance for a Midnight Network address. Returns:
Use this tool to:
Note: For testnet, you can get free tDUST from the faucet. |
| midnight_get_blockB | Query block information from the Midnight blockchain. Returns:
Use this tool to:
|
| midnight_get_transactionA | Query transaction details from the Midnight blockchain. Returns:
Use this tool to:
|
| midnight_search_docsA | Search Midnight Network official documentation. Searches across:
Use this tool to:
|
| midnight_scaffold_projectA | Scaffold a new Midnight dApp project from a template. Templates available:
Generates:
Use this tool to:
|
| midnight_compile_contractA | Compile a Compact smart contract to TypeScript bindings and ZK artifacts. Generates:
Use this tool to:
Note: Full compilation requires the |
| midnight_analyze_contractA | Perform static analysis on a Compact smart contract. Analyzes:
Use this tool to:
|
| midnight_check_versionsA | Check for updates to @midnight-ntwrk npm packages. Compares installed versions against the latest available on npm. Supports both stable and alpha/beta version tracking. Use this tool to:
|
| midnight_deploy_contractA | Deploy a compiled Compact smart contract to the Midnight Network. Prerequisites:
Deployment Process:
Returns:
Security: Use Testnet Faucet: Get free tDUST at https://faucet.testnet.midnight.network |
| midnight_call_contractA | Execute a circuit call on a deployed Midnight smart contract. Circuit Types:
Call Process:
Privacy Features:
Example: |
| midnight_create_walletA | Create a new Midnight wallet with a fresh seed phrase. Security Warning:
Wallet Features:
After Creation:
|
| midnight_wallet_stateA | Get detailed wallet state including balances, coins, and sync status. Returns:
Coin Types:
Use for:
|
| midnight_transfer_tokensA | Transfer tDUST tokens to another address. Transfer Types:
Requirements:
Fees:
Security: Use |
| midnight-search-docsB | Search Midnight documentation content. Use for finding guides, API docs, and conceptual explanations about the Midnight blockchain and Compact language. |
| midnight-fetch-docsB | Fetch documentation directly from the official Midnight docs. Use when you know the specific path or need the full content of a documentation page. |
| midnight-sync-docsB | Sync documentation from the official Midnight repository. Use to ensure documentation is up to date. |
| midnight-docs-statusB | Get the current status of documentation sync, including cache age and available updates. |
| midnight-list-docsC | List all available documentation sources with their sync status. |
| list_available_toolsetsA | List all available toolsets this MCP server can offer, providing the enabled status of each. Use this when a task could be achieved with a tool and the currently available tools aren't enough. Call get_toolset_tools with these toolset names to discover specific tools you can call. |
| get_toolset_toolsA | Lists all the capabilities that are enabled with the specified toolset. Use this to get clarity on whether enabling a toolset would help you to complete a task. |
| enable_toolsetA | Enable one of the sets of tools the MCP server provides. Use get_toolset_tools and list_available_toolsets first to see what this will enable. |
| disable_toolsetA | Disable a toolset that was previously enabled. The tools in this toolset will no longer be available. |
| get_session_infoA | Get information about the current MCP session including server version, enabled toolsets, and environment. Use this to understand the current context. |
| get_environment_infoA | Get information about the runtime environment including Node.js version, platform, and system resources. |
| get_server_statusA | Get the current server status including health, active connections, and resource usage. Use this to diagnose server issues. |
| list_enabled_featuresA | List all currently enabled features and feature flags. Use this to understand what capabilities are available. |
| browser_evalA | Automate and test web applications using Playwright browser automation. This tool connects to playwright-mcp server and provides access to all Playwright capabilities. CRITICAL FOR PAGE VERIFICATION: When verifying pages in Next.js projects (especially during upgrades or testing), you MUST use browser automation to load pages in a real browser instead of curl or simple HTTP requests. This is because:
IMPORTANT FOR NEXT.JS PROJECTS: If working with a Next.js application, PRIORITIZE using the 'nextjs_index' and 'nextjs_call' tools instead of browser console log forwarding. Next.js has built-in MCP integration that provides superior error reporting, build diagnostics, and runtime information directly from the Next.js dev server. Only use browser_eval's console_messages action as a fallback when these Next.js tools are not available or when you specifically need to test client-side browser behavior that Next.js runtime cannot capture. Available actions:
Note: The playwright-mcp server will be automatically installed if not present. |
| enable_cache_componentsB | Migrate Next.js applications to Cache Components mode and complete setup for Next.js 16. Use this tool when you need to:
This tool handles ALL steps for migrating and enabling Cache Components:
Key Features:
Requires:
This tool embeds complete knowledge base for:
|
| initA | ⚠️ CALL THIS FIRST - Initialize Next.js DevTools MCP context and establish MANDATORY documentation requirements. IMPORTANT: This tool MUST be called at the START of every Next.js development session. This tool:
Use this tool at the beginning of a Next.js session to:
|
| nextjs_docsB | Fetch Next.js official documentation by path. IMPORTANT: You MUST first read the Workflow:
Example: nextjs_docs({ path: "/docs/app/api-reference/functions/refresh" }) |
| nextjs_indexA | Discover all running Next.js development servers and list their available MCP tools. WHEN TO USE THIS TOOL - Use proactively in these scenarios:
KEY PRINCIPLE: If the request involves the running Next.js application (whether to investigate OR modify it), query the runtime FIRST to understand current state before proceeding. REQUIREMENTS:
Next.js 16+ exposes an MCP (Model Context Protocol) endpoint at /_next/mcp automatically when the dev server starts. No configuration needed - MCP is enabled by default in Next.js 16 and later. This tool discovers all running Next.js servers and returns:
After calling this tool, use 'nextjs_call' to execute specific tools. [IMPORTANT] If auto-discovery returns no servers:
If the MCP endpoint is not available:
|
| nextjs_callA | Call a specific MCP tool on a running Next.js development server. REQUIREMENTS:
Use 'nextjs_index' first to discover available servers, tools, and their input schemas. If 'nextjs_index' auto-discovery fails, ask the user for the port and call 'nextjs_index' again with the 'port' parameter. IMPORTANT: When calling tools:
Common Next.js MCP tools include:
Example usage:
|
| upgrade_nextjs_16A | Guide through upgrading Next.js to version 16. CRITICAL: Runs the official codemod FIRST (requires clean git state) for automatic upgrades and fixes, then handles remaining issues manually. The codemod upgrades Next.js, React, and React DOM automatically. Covers:
The codemod requires:
After codemod runs, provides manual guidance for any remaining issues not covered by the codemod. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| upgrade-nextjs-16 | Guide through upgrading Next.js to version 16. CRITICAL: Runs the official codemod FIRST (requires clean git state) for automatic upgrades and fixes, then handles remaining issues manually. The codemod upgrades Next.js, React, and React DOM automatically. Covers async API changes, config moves, image defaults, parallel routes, and deprecations. |
| enable-cache-components | Complete Cache Components setup for Next.js 16. Handles ALL steps: updates experimental.cacheComponents flag, removes incompatible flags, migrates Route Segment Config, starts dev server with MCP, detects all errors via chrome_devtools + get_errors, automatically fixes all issues by adding Suspense boundaries, 'use cache' directives, generateStaticParams, cacheLife profiles, cache tags, and validates everything with zero errors. |
| create_midnight_contract | Guided workflow for creating a new Compact smart contract. Use this prompt to: - Design a new contract from scratch - Get templates for common patterns - Understand best practices - Generate contract scaffolding Based on official Midnight documentation: https://docs.midnight.network |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| cache-components-overview | Critical errors AI agents make, quick reference for Cache Components |
| cache-components-core-mechanics | Fundamental paradigm shift and cacheComponents behavior |
| cache-components-public-caches | Public cache mechanics using 'use cache' |
| cache-components-private-caches | Private cache mechanics using 'use cache: private' |
| cache-components-runtime-prefetching | Prefetch configuration and stale time rules |
| cache-components-request-apis | Async params, searchParams, cookies(), headers() patterns |
| cache-components-cache-invalidation | updateTag(), revalidateTag() patterns and cache invalidation strategies |
| cache-components-advanced-patterns | cacheLife(), cacheTag(), draft mode and advanced caching strategies |
| cache-components-build-behavior | What gets prerendered, static shells, and build-time behavior |
| cache-components-error-patterns | Common errors and solutions for Cache Components |
| cache-components-test-patterns | Real test-driven patterns from 125+ fixtures |
| cache-components-reference | Mental models, API reference, and checklists for Cache Components |
| cache-components-route-handlers | Using 'use cache' directive in Route Handlers (API Routes) - must extract to helper function |
| nextjs-fundamentals-use-client | Learn when and why to use 'use client' in Server Components |
| nextjs16-migration-beta-to-stable | Complete guide for migrating from Next.js 16 beta to stable release |
| nextjs16-migration-examples | Real-world examples of migrating to Next.js 16 |
| Next.js Documentation Index (llms.txt) | Complete Next.js documentation index from nextjs.org/docs/llms.txt. You MUST read this resource first to find the correct path, then call nextjs_docs with that path. |
| Compact Language Overview | Introduction to Compact, the privacy-preserving smart contract language for Midnight Network |
| Compact Language Reference | Complete syntax and semantics reference for the Compact smart contract language |
| Compact Standard Library Reference | Complete reference for the Compact standard library including data structures, cryptographic primitives, and utility functions. |
| Midnight.js SDK Overview | Introduction to the Midnight JavaScript/TypeScript SDK for building decentralized applications |
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/DaJo-Code/midnight-nextjs-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server