node-red-mcp

node-red-mcp

A Model Context Protocol server for Node-RED integration, enabling AI agents to manage flows, install modules, and monitor Node-RED instances via natural language.

Category
访问服务器

README

🚀 MCP Node-RED Server

License: MIT Node.js Version TypeScript CI/CD CodeQL codecov Security Rating

A modern, production-ready Model Context Protocol (MCP) server for Node-RED integration, built with best practices.

🌟 Features

🚀 Architecture

  • Node.js 22 LTS with latest JavaScript features
  • TypeScript 5.7+ with strict type checking
  • ESM-first with dual ESM/CJS output using tsup
  • Yarn 4 with zero-installs and modern package management

🔄 Node-RED Integration

  • Node-RED v4 support with latest features
  • Real-time flow monitoring via SSE
  • Template flows for common MCP patterns
  • Admin API integration for flow management
  • WebSocket support for live updates

🛡️ Reliability & Resilience (2025 Updates)

  • Circuit Breaker Pattern for fault tolerance
  • Exponential Backoff Retry with smart failure handling
  • Request Timeout Management with proper cleanup
  • Server Discovery via .well-known/mcp.json (November 2025 spec)
  • MCP SDK 1.22.0 with latest protocol enhancements
  • Comprehensive Error Handling with 19 test cases

📊 Observability

  • Structured Logging with Pino
  • Circuit Breaker Metrics and health monitoring
  • Request Correlation IDs for debugging
  • Performance Metrics collection

📋 Table of Contents

⚡ Quick Start

Prerequisites

  • Node.js 22+ (LTS recommended)
  • Yarn 4.x (automatically managed via Corepack)
  • Claude Desktop or other MCP client (for stdio mode)
  • Docker & Docker Compose (optional, for containerized setup)

🚀 Option 1: Native Installation (For Claude Desktop)

# Clone the repository
git clone https://github.com/your-org/nodered-mcp.git
cd nodered-mcp

# Install dependencies (Yarn 4 will be automatically used)
yarn install

# Build the project (no .env file needed for stdio mode)
yarn build

# Test the server (optional)
echo '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}},"id":1}' | node dist/index.mjs

# Configure in Claude Desktop (see Usage section)

🐳 Option 2: Docker Compose (For HTTP Mode Development)

# Clone and start the full stack
git clone https://github.com/your-org/nodered-mcp.git
cd nodered-mcp

# Start all services (includes Node-RED, PostgreSQL, Redis, monitoring)
docker-compose up -d

# View logs
docker-compose logs -f mcp-server

Access the services:

  • MCP Server: http://localhost:3000
  • Node-RED: http://localhost:1880
  • Grafana: http://localhost:3001 (admin/admin)
  • Jaeger: http://localhost:16686

🔧 Installation

System Requirements

  • Node.js: 22.0.0 or higher
  • Memory: 512MB minimum, 2GB recommended
  • Storage: 1GB available space

Local Development Setup

# Enable Corepack (if not already enabled)
corepack enable

# Verify versions
node --version  # Should be 22.x.x
yarn --version  # Should be 4.x.x

# Install dependencies
yarn install

# Set up environment
cp env.example .env
# Edit .env file with your configuration

# Run in development mode with hot reload
yarn dev

🎯 Usage

Claude Desktop Integration (Recommended)

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "nodered": {
      "command": "node",
      "args": ["path/to/nodered_mcp/dist/index.mjs"],
      "env": {
        "NODERED_URL": "https://your-nodered-instance.com",
        "NODERED_USERNAME": "your-username",
        "NODERED_PASSWORD": "your-secure-password"
      }
    }
  }
}

Available MCP Tools

Tool Description Arguments
get_flows Get Node-RED flows (summary/full) includeDetails?: boolean
get_flow Get specific flow details flowId: string
create_flow Create a new Node-RED flow flowData: object
update_flow Update an existing flow flowId: string, flowData: object
enable_flow Enable a specific flow flowId: string
disable_flow Disable a specific flow flowId: string
search_modules Search Node-RED palette modules query: string, category?: string
install_module Install a Node-RED module moduleName: string, version?: string
get_installed_modules Get installed modules None

🔌 Connecting to the Server

The MCP server supports multiple transport modes and authentication methods. Choose the one that fits your setup.

Transport Modes

Mode Env Var Endpoint Use Case
Streamable HTTP MCP_TRANSPORT=http POST /mcp Production deployments, remote agents
Stdio MCP_TRANSPORT=stdio stdin/stdout Claude Desktop local integration

Authentication

The server supports two authentication methods (configured via environment variables):

  1. HTTP Basic Auth — Set MCP_USERNAME and MCP_PASSWORD. Clients send an Authorization: Basic <base64> header.
  2. Bearer Token (JWT) — After authenticating, clients receive a JWT for subsequent requests. Requires JWT_SECRET to be set.

Connecting via Streamable HTTP (Remote)

For remote MCP clients (Claude Code, custom agents, etc.), point them to the /mcp endpoint:

# Generic connection parameters
URL: https://<your-server-host>/mcp
Transport: streamable-http
Auth header: Authorization: Basic <base64(username:password)>

Claude Code CLI example:

claude mcp add node-red \
  --transport streamable-http \
  --url https://<your-server-host>/mcp \
  --header "Authorization: Basic <base64-credentials>"

Connecting via Stdio (Local)

For Claude Desktop or other local MCP hosts, use stdio mode:

{
  "mcpServers": {
    "nodered": {
      "command": "node",
      "args": ["path/to/nodered_mcp/dist/index.mjs"],
      "env": {
        "MCP_TRANSPORT": "stdio",
        "NODERED_URL": "https://your-nodered-instance.com",
        "NODERED_USERNAME": "your-username",
        "NODERED_PASSWORD": "your-password"
      }
    }
  }
}

Environment Variables

Variable Required Description
NODERED_URL Yes URL of your Node-RED instance
NODERED_USERNAME Yes Node-RED admin credentials
NODERED_PASSWORD Yes Node-RED admin credentials
MCP_TRANSPORT No http (default) or stdio
MCP_USERNAME No MCP server auth username
MCP_PASSWORD No MCP server auth password
JWT_SECRET No Secret for JWT token signing
HOST No Bind address (default: 0.0.0.0)
PORT No Listen port (default: 3000)
CORS_ORIGIN No Allowed CORS origins
LOG_LEVEL No debug, info, warn, error

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选