Flowise MCP 服务器

一个提供与Flowise AI工作流平台程序化集成的MCP服务器,支持创建、管理和运行Flowise聊天流和代理流。

  • by wksbx
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 wksbx/flowise-mcp-server

使用说明

Flowise MCP服务器

A. 模型上下文协议(MCP) 提供程序化集成的服务器 流式 AI工作流平台。这使得基于LLM的工具(如Claude Code)能够创建、管理和运行Flowise聊天流和代理流。

特性

  • 运行预测:执行包含问题、对话历史、文件上传或潜在客户捕获的聊天流
  • 管理聊天流:以编程方式创建、更新、删除和列出聊天流
  • 节点发现:列出所有可用节点并获取建筑流程的详细规范
  • 全流量类型:支持CHATFLOW、AGENTFLOW、MULTIAGENT和ASSISTANT类型

先决条件

安装

# Clone the repository
git clone https://github.com/wksbx/flowise-mcp-server.git
cd flowise-mcp-server

# Install dependencies
pnpm install

# Build the project
pnpm build

配置

  1. 复制示例环境文件:
cp .env.example .env
  1. 编辑 .env 使用Flowise设置:
FLOWISE_BASE_URL=http://localhost:3000
FLOWISE_API_KEY=your-api-key-here
  • FLOWISE_BASE_URL:Flowise实例运行的URL
  • FLOWISE_API_KEY:Flowise中的API密钥(设置>API密钥)

用法

直接运行

pnpm start

使用Docker运行

# Build the Docker image
pnpm docker:build

# Run the container
pnpm docker:run

使用MCP客户端进行配置

添加到您的MCP客户端配置中(例如,Claude Desktop、Claude Code):

直接使用Node:

{
  "mcpServers": {
    "flowise": {
      "command": "node",
      "args": ["/path/to/flowise-mcp-server/dist/index.js"],
      "env": {
        "FLOWISE_BASE_URL": "http://localhost:3000",
        "FLOWISE_API_KEY": "your-api-key-here"
      }
    }
  }
}

使用Docker:

{
  "mcpServers": {
    "flowise": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "--add-host=host.docker.internal:host-gateway",
        "--env-file", "/path/to/your/.env",
        "flowise-mcp-server"
      ]
    }
  }
}

可用工具

预测工具

工具 说明
create_prediction 用问题运行聊天流
create_prediction_with_history 运行对话历史记录以获取上下文
create_prediction_with_files 使用文件附件(图像、文档)运行
create_prediction_with_lead 运行并捕获潜在客户电子邮件

聊天流管理

工具 说明
list_chatflows 列出所有可用的聊天流
get_chatflow 获取特定聊天流的配置
create_chatflow 创建新的聊天流
update_chatflow 更新现有聊天流
delete_chatflow 删除聊天流(不可逆)

节点发现

工具 说明
list_nodes 列出所有可用节点类型
get_nodes_by_category 获取按类别筛选的节点
get_node 获取特定节点类型的详细规格

例子

运行聊天流

Use create_prediction with:
- chatflowId: "abc123"
- question: "What is the weather today?"

创建一个简单的聊天流

1. Use get_node to fetch specs for needed nodes (e.g., "chatOpenAI", "llmChain")
2. Use create_chatflow with:
   - name: "My Chatflow"
   - flowData: { nodes: [...], edges: [...] }
   - type: "CHATFLOW"

发展

# Build TypeScript
pnpm build

# Run in development mode (build + run)
pnpm dev

测试

该项目包括使用 Vitest.

# Run tests once
pnpm test

# Run tests in watch mode
pnpm test:watch

# Run tests with coverage report
pnpm test:coverage

测试结构

src/
├── flowise-api.test.ts   # API client tests (8 tests)
└── handlers.test.ts      # Tool handler tests (26 tests)

项目结构

flowise-mcp-server/
├── src/
│   ├── index.ts           # MCP server entry point
│   ├── flowise-api.ts     # Flowise API client
│   ├── handlers.ts        # Tool handler functions
│   └── *.test.ts          # Unit tests
├── dist/                  # Compiled JavaScript (generated)
├── package.json
├── tsconfig.json
├── vitest.config.ts       # Test configuration
├── Dockerfile
├── .env.example           # Environment template
└── mcp-config.example.json

故障排除

连接问题

  • 确保Flowise正在运行,并且可以在配置的URL上访问
  • 使用Docker时,请使用 host.docker.internal 连接到主机上的Flowise
  • 验证您的API密钥在Flowise设置中是否正确

身份验证错误

  • 检查你的 FLOWISE_API_KEY 匹配Flowise中配置的一个
  • API密钥可以在Flowise中的“设置”>“API密钥”下创建

许可证

麻省理工学院-见 许可证

贡献

欢迎投稿!请随时提交拉取请求。

相关项目