Midnight + Next.js MCP

平台与服务

by fractionestate

為 Midnight 區塊鏈開發與 Next.js dApps 提供統一的 MCP server,整合常用開發流程。

什么是 Midnight + Next.js MCP

為 Midnight 區塊鏈開發與 Next.js dApps 提供統一的 MCP server,整合常用開發流程。

README

Midnight + Next.js Development MCP Server

A Model Context Protocol (MCP) server combining Midnight Network blockchain development tools with Next.js DevTools for building decentralized applications.

Compatible with all MCP-enabled AI assistants: Claude, GitHub Copilot, Cursor, Windsurf, Codeium, Continue.dev, Zed, Sourcegraph Cody, and more.

🤖 Supported AI Assistants

This MCP server works with any AI assistant that supports the Model Context Protocol:

AI AssistantPlatformConfiguration
ClaudeDesktop App, VS CodeNative MCP support
GitHub CopilotVS Code, JetBrainsMCP extension
CursorIDEBuilt-in MCP support
WindsurfIDEBuilt-in MCP support
CodeiumVS Code, JetBrainsMCP integration
Continue.devVS Code, JetBrainsMCP config file
ZedIDEMCP support
Sourcegraph CodyVS CodeMCP extension

🌙 Features

Midnight Network Tools

Contract Development

  • midnight_init - Initialize development context
  • midnight_compile_contract - Compile Compact contracts to TypeScript/ZK artifacts
  • midnight_analyze_contract - Static analysis for contracts
  • midnight_deploy_contract - Deploy contracts to the network
  • midnight_call_contract - Execute circuit calls on deployed contracts
  • midnight_scaffold_project - Create new dApp projects from templates

Wallet & Tokens

  • midnight_create_wallet - Generate new wallet with seed phrase
  • midnight_wallet_state - Get detailed wallet state and balances
  • midnight_transfer_tokens - Transfer tDUST tokens
  • midnight_get_balance - Query token balances

Network & Queries

  • midnight_network_status - Check network health (Indexer, Proof Server, Node)
  • midnight_get_block - Query blockchain blocks
  • midnight_get_transaction - Query transaction details
  • midnight_check_versions - Check for Midnight package updates

Documentation

  • midnight_search_docs - Search Midnight documentation
  • midnight-fetch-docs - Fetch specific documentation pages
  • midnight-sync-docs - Sync documentation from official repo
  • midnight-docs-status - Check documentation sync status
  • midnight-list-docs - List available documentation sources

Next.js DevTools

  • init - Initialize Next.js development context
  • nextjs_docs - Search Next.js documentation
  • nextjs_index - Discover running dev servers
  • nextjs_call - Execute runtime diagnostic tools
  • browser_eval - Browser automation with Playwright
  • upgrade_nextjs_16 - Next.js 16 upgrade guide
  • enable_cache_components - Cache Components migration

📦 Installation

bash
# Clone the repository
git clone https://github.com/your-username/midnight-nextjs-mcp.git
cd midnight-nextjs-mcp

# Install dependencies
pnpm install

# Build
pnpm build

🚀 Usage

Quick Start with npx

The easiest way to use this MCP server is via npx — no installation required:

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

Configuration Examples

The MCP configuration format is standardized across most AI assistants. Below are platform-specific examples:


Universal MCP Configuration

Most MCP clients use this standard JSON format. Add to your client's MCP configuration file:

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

VS Code (GitHub Copilot / Claude Extension)

Add to your VS Code settings.json or workspace .vscode/mcp.json:

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

Or for Claude extension specifically:

json
{
  "claude.mcpServers": {
    "midnight-nextjs-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "midnight-nextjs-mcp@latest"]
    }
  }
}

Claude Desktop (macOS)

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

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

Claude Desktop (Windows)

Edit %APPDATA%\Claude\claude_desktop_config.json:

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

Claude Desktop (Linux)

Edit ~/.config/Claude/claude_desktop_config.json:

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

Cursor IDE

Add to your Cursor MCP configuration (.cursor/mcp.json in your project or global settings):

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

Windsurf / Codeium

Add to your Windsurf MCP settings:

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

Continue.dev (VS Code / JetBrains)

Add to ~/.continue/config.json or your project's .continue/config.json:

json
{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "name": "midnight-nextjs-mcp",
        "transport": {
          "type": "stdio",
          "command": "npx",
          "args": ["-y", "midnight-nextjs-mcp@latest"]
        }
      }
    ]
  }
}

Zed Editor

Add to your Zed settings (~/.config/zed/settings.json on Linux, ~/Library/Application Support/Zed/settings.json on macOS):

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

Sourcegraph Cody

Add to your Cody MCP configuration:

json
{
  "cody.experimental.mcp.servers": {
    "midnight-nextjs-mcp": {
      "command": "npx",
      "args": ["-y", "midnight-nextjs-mcp@latest"]
    }
  }
}

JetBrains IDEs (IntelliJ, WebStorm, etc.)

For AI assistants in JetBrains IDEs that support MCP, add to your MCP configuration:

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

Using Global Installation

If you prefer a global install instead of npx:

bash
npm install -g midnight-nextjs-mcp

Then configure:

json
{
  "mcpServers": {
    "midnight-nextjs-mcp": {
      "type": "stdio",
      "command": "midnight-nextjs-mcp"
    }
  }
}

Local Development / From Source

json
{
  "mcpServers": {
    "midnight-nextjs-mcp": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/midnight-nextjs-mcp/dist/index.js"]
    }
  }
}

Docker

Run the MCP server in a Docker container:

json
{
  "mcpServers": {
    "midnight-nextjs-mcp": {
      "type": "stdio",
      "command": "docker",
      "args": ["run", "-i", "--rm", "fractionestate/midnight-nextjs-mcp:latest"]
    }
  }
}

CLI Flags

bash
# Enable both tool categories (default)
npx midnight-nextjs-mcp@latest

# Disable Midnight tools (Next.js only)
npx midnight-nextjs-mcp@latest --no-midnight

# Disable Next.js tools (Midnight only)
npx midnight-nextjs-mcp@latest --no-nextjs

# Check package versions on startup
npx midnight-nextjs-mcp@latest --check-versions

# Set version polling interval (default 24 hours)
npx midnight-nextjs-mcp@latest --poll-interval=12

🏗️ Project Structure

code
midnight-nextjs-mcp/
├── src/
│   ├── index.ts                    # Server entry point
│   ├── tools/
│   │   ├── index.ts                # Unified tool registry
│   │   ├── midnight/               # Midnight Network tools
│   │   │   ├── init.ts
│   │   │   ├── network-status.ts
│   │   │   ├── get-balance.ts
│   │   │   ├── get-block.ts
│   │   │   ├── get-transaction.ts
│   │   │   ├── search-docs.ts
│   │   │   ├── scaffold-project.ts
│   │   │   ├── compile-contract.ts
│   │   │   └── analyze-contract.ts
│   │   └── nextjs/                 # Next.js DevTools
│   │       ├── init.ts
│   │       ├── nextjs-docs.ts
│   │       ├── nextjs_index.ts
│   │       ├── nextjs_call.ts
│   │       ├── browser-eval.ts
│   │       ├── upgrade-nextjs-16.ts
│   │       └── enable-cache-components.ts
│   ├── providers/                  # Midnight API providers
│   │   ├── index.ts
│   │   ├── indexer.ts              # GraphQL indexer client
│   │   ├── proof-server.ts         # Proof generation client
│   │   └── node.ts                 # Node RPC client
│   ├── resources/                  # MCP resources
│   │   ├── (midnight-compact)/     # Compact language docs
│   │   ├── (midnight-sdk)/         # SDK documentation
│   │   ├── (cache-components)/     # Next.js cache docs
│   │   └── ...
│   ├── prompts/                    # MCP prompts
│   │   ├── create-midnight-contract.ts
│   │   ├── upgrade-nextjs-16.ts
│   │   └── enable-cache-components.ts
│   └── types/                      # TypeScript definitions
│       ├── midnight.ts
│       └── mcp.ts
├── package.json
└── README.md

🔧 Configuration

Environment Variables

You can pass environment variables to the MCP server in your configuration:

json
{
  "mcpServers": {
    "midnight-nextjs-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "midnight-nextjs-mcp@latest"],
      "env": {
        "MIDNIGHT_NETWORK": "testnet",
        "MIDNIGHT_INDEXER_URL": "https://indexer.testnet.midnight.network/graphql"
      }
    }
  }
}

Available Environment Variables

bash
# Midnight Network (optional, defaults to testnet)
MIDNIGHT_NETWORK=testnet
MIDNIGHT_INDEXER_URL=https://indexer.testnet.midnight.network/graphql
MIDNIGHT_PROOF_SERVER_URL=https://proof-server.testnet.midnight.network
MIDNIGHT_NODE_URL=https://rpc.testnet.midnight.network

Network Configurations

NetworkIndexerProof Server
Testnetindexer.testnet.midnight.networkproof-server.testnet.midnight.network
Devnetlocalhost:8080localhost:6300

📚 Resources

The server exposes documentation resources:

Midnight Resources

  • midnight://compact/overview - Compact language introduction
  • midnight://compact/reference - Complete syntax reference
  • midnight://sdk/overview - Midnight.js SDK guide

Next.js Resources

  • nextjs-docs://llms-index - Documentation index
  • cache-components://overview - Cache Components guide

🧪 Development

bash
# Watch mode
pnpm dev

# Type check
pnpm typecheck

# Run tests
pnpm test

# Build
pnpm build

📖 Documentation

Client-Specific MCP Documentation

🤝 Contributing

Contributions welcome! Please read the contributing guidelines first.

📄 License

MIT License - see LICENSE for details.


Built with ❤️ for the Midnight and Next.js communities.

常见问题

Midnight + Next.js MCP 是什么?

為 Midnight 區塊鏈開發與 Next.js dApps 提供統一的 MCP server,整合常用開發流程。

相关 Skills

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描123.0k

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描123.0k

邮件模板

by alirezarezvani

Universal
热门

快速搭建生产可用的事务邮件系统:生成 React Email/MJML 模板,接入 Resend、Postmark、SendGrid 或 AWS SES,并支持本地预览、i18n、暗色模式、反垃圾优化与追踪埋点。

面向营销与服务场景,快速搭建高质量邮件模板,省去反复设计与切图成本,成熟度和社区认可都很高。

平台与服务
未扫描12.5k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
84.2k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
78.5k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
38.1k

评论