RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • AI Agent Framework
  • GFlow Approval Workflow (opens new window)
  • TPCLAW Agent Platform (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • AI Agent Framework
  • GFlow Approval Workflow (opens new window)
  • TPCLAW Agent Platform (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • Quick Start

  • Rule Chain

  • Standard Components

  • Extension Components

    • Extension Components Overview
    • filter

    • action

    • transform

    • external

    • ai

      • LLM
      • generate-image
      • Agent
      • Intent Recognition
      • Local Intent Recognition
      • MCP Client
        • Dual Role
        • Configuration
        • Execution Result
        • Configuration Examples
          • Invoking a Remote Tool Directly
          • Dynamic Tool Name (from Message Metadata)
          • Stdio Mode (Local Process)
          • As the Agent's Tool Provider
        • Application Example
      • MCP Server
    • ci

    • IoT

    • Stream Processing

    • Service Discovery

    • file

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • Agent Framework

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

  • StreamSQL

目录

MCP Client

The ai/mcpClient component: v0.36.0+ an MCP (Model Context Protocol) client node that connects to a remote MCP server, invokes the specified tool, and writes the result to the message for downstream nodes. It can also register itself as an MCPToolProvider in the RuleConfig UDF, so agents can call remote tools via ai/agent's self mode.

# Dual Role

The MCP client can be used in two ways inside a rule chain:

  1. Direct invocation: as a rule chain node, calls the specified remote MCP tool on OnMsg
  2. Tool provider: at startup, auto-discovers all tools of the remote MCP server and registers them as an MCPToolProvider for agent MCP tools (server: "self")

# Configuration

Field Type Description Default
server string MCP server address. Supports HTTP URLs (http:///https://) and stdio commands required
toolName string Remote tool name to invoke. Supports ${metadata.xxx} and ${msg.xxx} expressions. Empty = taken from metadata.mcpToolName
args string Tool arguments JSON template. Supports ${msg.xxx} and ${metadata.xxx} expressions. Empty = the message body JSON
toolFilter []string Tool filter (affects MCPToolProvider registration only); empty or ["*"] = register all tools

# Execution Result

  • The tool result is written to msg.Data and passed downstream via the Success relation
  • On failure, the error is passed via the Failure relation

# Configuration Examples

# Invoking a Remote Tool Directly

{
  "id": "s1",
  "type": "ai/mcpClient",
  "name": "Get Weather",
  "configuration": {
    "server": "http://localhost:8080/mcp",
    "toolName": "get_weather",
    "args": "{\"city\": \"${msg.city}\", \"unit\": \"celsius\"}"
  }
}
1
2
3
4
5
6
7
8
9
10

# Dynamic Tool Name (from Message Metadata)

{
  "id": "s1",
  "type": "ai/mcpClient",
  "name": "MCP Tool Call",
  "configuration": {
    "server": "http://localhost:8080/mcp",
    "toolName": "${metadata.mcpToolName}",
    "args": ""
  }
}
1
2
3
4
5
6
7
8
9
10

When toolName is empty, the component reads the tool name from msg.Metadata["mcpToolName"]. When args is empty, the JSON in msg.Data is used as the tool arguments.

# Stdio Mode (Local Process)

{
  "id": "s1",
  "type": "ai/mcpClient",
  "name": "Local MCP Tool",
  "configuration": {
    "server": "mcp-server --port 8080",
    "toolName": "search",
    "args": "{\"query\": \"${msg.query}\"}"
  }
}
1
2
3
4
5
6
7
8
9
10

When server is not an HTTP URL, the component parses it as a command line and communicates with the MCP service over stdio.

# As the Agent's Tool Provider

At startup (Start()), the MCP client connects to the remote server, discovers tools, and registers them as an MCPToolProvider. Once configured in a rule chain, agents can use these remote tools in self mode:

{
  "tools": [
    {
      "type": "mcp",
      "config": {
        "server": "self",
        "tools": ["get_weather", "search"]
      }
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11

toolFilter controls which tools are registered into the MCPToolProvider:

{
  "toolFilter": ["get_weather", "search"]
}
1
2
3

# Application Example

{
  "ruleChain": {
    "id": "mcp-demo",
    "name": "MCP Invocation Demo",
    "root": true
  },
  "metadata": {
    "firstNodeIndex": 0,
    "nodes": [
      {
        "id": "node_mcp",
        "type": "ai/mcpClient",
        "name": "Call Remote Tool",
        "configuration": {
          "server": "http://localhost:8080/mcp",
          "toolName": "get_weather",
          "args": "{\"city\": \"${msg.city}\"}"
        }
      },
      {
        "id": "node_log",
        "type": "log",
        "name": "Log Result",
        "configuration": {
          "jsScript": "return 'Weather result: ' + msg.data;"
        }
      }
    ],
    "connections": [
      {"fromId": "node_mcp", "toId": "node_log", "type": "Success"}
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Edit this page on GitHub (opens new window)
Last Updated: 2026/09/11, 05:25:57
Local Intent Recognition
MCP Server

← Local Intent Recognition MCP Server→

Theme by Vdoing | Copyright © 2023-2026 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式