mcp-flowise

MIT License
18

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

mcp-flowise

mcp-flowise是一个 Python 包,实现了与 Flowise API 集成的模型上下文协议 (MCP) 服务器。它提供了一种标准化且灵活的方式来列出聊天流、创建预测,并为 Flowise 聊天流或助手动态注册工具。

它支持两种操作模式:

  • 低级模式(默认) :动态注册从 Flowise API 检索的所有聊天流的工具。
  • FastMCP 模式:提供列出聊天流和创建预测的静态工具,适用于更简单的配置。

特征

  • 动态工具暴露:低级模式为每个聊天流或助手动态创建工具。
  • 更简单的配置:FastMCP 模式公开list_chatflowscreate_prediction工具以进行最少设置。
  • 灵活过滤:两种模式都支持通过 ID 或名称(正则表达式)通过白名单和黑名单过滤聊天流。
  • MCP 集成:无缝集成到 MCP 工作流程中。

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 mcp-flowise:

npx -y @smithery/cli install @matthewhand/mcp-flowise --client claude

先决条件

  • Python 3.12 或更高版本
  • uvx包管理器

通过uvx安装并运行

确认您可以使用uvx直接从 GitHub 存储库运行服务器:

uvx --from git+https://github.com/matthewhand/mcp-flowise mcp-flowise

添加到 MCP 生态系统( mcpServers配置)

您可以将mcp-flowise添加到mcpServers配置中,从而将其集成到您的 MCP 生态系统中。例如:

{ "mcpServers": { "mcp-flowise": { "command": "uvx", "args": [ "--from", "git+https://github.com/matthewhand/mcp-flowise", "mcp-flowise" ], "env": { "FLOWISE_API_KEY": "${FLOWISE_API_KEY}", "FLOWISE_API_ENDPOINT": "${FLOWISE_API_ENDPOINT}" } } } }

操作模式

1.FastMCP模式(简单模式)

通过设置FLOWISE_SIMPLE_MODE=true启用。此模式:

  • 公开两个工具: list_chatflowscreate_prediction
  • 允许使用FLOWISE_CHATFLOW_IDFLOWISE_ASSISTANT_ID进行静态配置。
  • 通过list_chatflows列出所有可用的聊天流。

2. 低级模式(FLOWISE_SIMPLE_MODE=False)

特征

  • 将所有聊天流动态注册为单独的工具。
  • 工具以聊天流程名称命名(规范化)。
  • 使用来自FLOWISE_CHATFLOW_DESCRIPTIONS变量的描述,如果没有提供描述,则返回到聊天流名称。

例子

  • my_tool(question: str) -> str

使用uvx在 Windows 上运行

如果您在 Windows 上使用uvx时遇到--from git+https的问题,建议的解决方案是将仓库克隆到本地,并使用uvx.exe和克隆仓库的完整路径配置mcpServers 。此外,请根据需要添加APPDATALOGLEVEL和其他环境变量。

MCP 生态系统的示例配置(Windows 上的mcpServers

{ "mcpServers": { "flowise": { "command": "C:\\Users\\matth\\.local\\bin\\uvx.exe", "args": [ "--from", "C:\\Users\\matth\\downloads\\mcp-flowise", "mcp-flowise" ], "env": { "LOGLEVEL": "ERROR", "APPDATA": "C:\\Users\\matth\\AppData\\Roaming", "FLOWISE_API_KEY": "your-api-key-goes-here", "FLOWISE_API_ENDPOINT": "http://localhost:3000/" } } } }

笔记

  • 完整路径:对uvx.exe和克隆的存储库使用完整路径。
  • 环境变量:如果需要,将APPDATA指向您的 Windows 用户配置文件(例如, C:\\Users\\<username>\\AppData\\Roaming )。
  • 日志级别:根据需要调整LOGLEVELERRORINFODEBUG等)。

环境变量

一般的

  • FLOWISE_API_KEY :您的 Flowise API Bearer 令牌(必需)。
  • FLOWISE_API_ENDPOINT :Flowise 的基本 URL(默认值: http://localhost:3000 )。

低级模式(默认)

  • FLOWISE_CHATFLOW_DESCRIPTIONS :以逗号分隔的chatflow_id:description对列表。例如:
    FLOWISE_CHATFLOW_DESCRIPTIONS="abc123:Chatflow One,xyz789:Chatflow Two"

FastMCP 模式( FLOWISE_SIMPLE_MODE=true

  • FLOWISE_CHATFLOW_ID :单个聊天流 ID(可选)。
  • FLOWISE_ASSISTANT_ID :单个助手 ID(可选)。
  • FLOWISE_CHATFLOW_DESCRIPTION :针对所公开的单个工具的可选描述。

过滤聊天流

可以使用以下环境变量在两种模式下应用过滤器:

  • 按 ID 加入白名单
    FLOWISE_WHITELIST_ID="id1,id2,id3"
  • 按 ID 加入黑名单
    FLOWISE_BLACKLIST_ID="id4,id5"
  • 按名称列入白名单(正则表达式)
    FLOWISE_WHITELIST_NAME_REGEX=".*important.*"
  • 按名称列入黑名单(正则表达式)
    FLOWISE_BLACKLIST_NAME_REGEX=".*deprecated.*"

注意:白名单优先于黑名单。如果同时设置了白名单和黑名单,则采用最严格的规则。

安全

  • 保护您的 API 密钥:确保FLOWISE_API_KEY的安全,不会在日志或存储库中暴露。
  • 环境配置:使用.env文件或环境变量进行敏感配置。

.env添加到你的.gitignore中:

# .gitignore .env

故障排除

  • 缺少 API 密钥:确保FLOWISE_API_KEY设置正确。
  • 无效配置:如果同时设置了FLOWISE_CHATFLOW_IDFLOWISE_ASSISTANT_ID ,服务器将拒绝启动。
  • 连接错误:验证FLOWISE_API_ENDPOINT是否可访问。

执照

本项目遵循 MIT 许可证。详情请参阅LICENSE文件。

待办事项

  • [x] Fastmcp 模式
  • [x] 低级模式
  • [x] 过滤
  • [x] Claude 桌面集成
  • [ ] 助理
-
security - not tested
A
license - permissive license
-
quality - not tested

Flowise MCP 服务器使客户能够列出聊天流程和呼叫预测,并与 DIY Flowise 或 Flowise Cloud 帐户无缝集成。它提供了一个简单的界面,可使用现有的 Flowise 配置执行聊天流程/助手预测。

  1. Features
    1. Installation
      1. Installing via Smithery
      2. Prerequisites
      3. Install and Run via uvx
      4. Adding to MCP Ecosystem (mcpServers Configuration)
    2. Modes of Operation
      1. 1. FastMCP Mode (Simple Mode)
      2. 2. LowLevel Mode (FLOWISE_SIMPLE_MODE=False)
    3. Running on Windows with uvx
      1. Example Configuration for MCP Ecosystem (mcpServers on Windows)
      2. Notes
    4. Environment Variables
      1. General
      2. LowLevel Mode (Default)
      3. FastMCP Mode (FLOWISE_SIMPLE_MODE=true)
    5. Filtering Chatflows
      1. Security
        1. Troubleshooting
          1. License
            1. TODO
              ID: h3cdir1w9a