Get the FREE Ultimate OpenClaw Setup Guide →

midnight

Midnight MCP server giving AI assistants access to Midnight blockchain — search contracts, analyze code, explore docs

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio olanetsoft-midnight-mcp npx -y midnight-mcp@latest

How to use

Midnight MCP Server exposes a suite of AI-assisted tools that connect to the Midnight blockchain. It provides capabilities to search contracts, analyze code, fetch documentation, and explore repository content through 29 tools prefixed with midnight- (for example midnight-search-compact, midnight-analyze-contract, midnight-get-file, midnight-extract-contract-structure, midnight-compile-contract, and more). The server is designed to enable AI assistants to perform semantic search, static analysis, code extraction, versioning checks, and AI-assisted generation of contracts and documentation. You can integrate this MCP server with clients like Claude Desktop, VS Code Copilot, and Windsurf by adding an MCP configuration that references the Midnight MCP package; all interactions leverage the defined tool suite to streamline contract development and exploration.

To use the server, configure your client to point at the Midnight MCP server entry as shown in the Quick Start examples. For Claude Desktop, add the midnight server using an MCP entry with the command npx and the argument midnight-mcp@latest. The same approach applies to Windsurf and VS Code Copilot configurations, where you reference the midnight-mcp tools (e.g., midnight-search-compact, midnight-analyze-contract) in your mcp.json or equivalent config. The tools can perform semantic search, live documentation fetching, static analysis, and AI-generated code/documentation, helping you iterate more quickly on contracts and related content.

How to install

Prerequisites:

  • Node.js 20+ (LTS recommended)
  • npm (comes with Node.js)

Install and run the MCP server using the recommended npx command:

# Ensure Node.js is installed (Node.js 20+)
node --version

# Start Midnight MCP via npx (no local install required)
npx -y midnight-mcp@latest

If you need to use a shell-enabled setup (e.g., to select a Node version with nvm), you can follow the Claude Desktop pattern shown in the README:

# Example using nvm to ensure Node 20 is active before starting MCP
/bin/sh -c 'source ~/.nvm/nvm.sh && nvm use 20 >/dev/null 2>&1 && npx -y midnight-mcp@latest'

Configuration for clients (examples):

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

Notes:

  • You can also install and run the MCP server locally or via CI/CD depending on your deployment needs, but the simplest start is the npx approach above.
  • If upgrading from an older config, consider using @latest to get new features and fixes, and clear your npx cache if you encounter stale binaries: rm -rf ~/.npm/_npx

Additional notes

Tips and notes:

  • Default configuration uses the Midnight MCP package via npx; this fetches the latest release on each run if you specify @latest.
  • No API keys are required to use the embedded tools with standard configurations; you access various capabilities through the 29 tools under the midnight- namespace.
  • If you encounter issues with NPX caching, clear the cache as noted above and retry. Ensure Node.js 20+ is in use for compatibility with the server.
  • For seamless IDE integration (VS Code, Windsurf, Claude Desktop), use the examples in the README to add the corresponding mcp.json or configuration blocks in your editor/settings:
    • Claude Desktop, Windsurf, VS Code Copilot configurations rely on the same command pattern: command: npx, args: ["-y", "midnight-mcp@latest"]
  • If you need to run a specific version, replace latest with a tag like @0.0.123 (if published) and update the client config accordingly.
  • The server exposes categories like Search, Analysis, Repository, Versioning, AI Generation, Compound, Health, and Discovery; refer to the README for the exact tool names and capabilities.

Related MCP Servers

Sponsor this space

Reach thousands of developers