Token导航 LogoToken导航TokenDH.com
Flowsphere MCP logo
开发工具stdio官方级别未说明来源级核验

Flowsphere MCP

MCP Server

FlowSphere MCP Server是一个将FlowSphere JSON配置转换为Python、JavaScript和C#的生产级测试代码的服务,适用于自动化测试和持续集成场景。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
代码生成PythonClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ymoud

提供方

ymoud

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -r requirements.txt

详细介绍

FlowSphere MCP服务器

](https://github.com/ymoud/flowsphere-mcp/releases) ![License](LICENSE) ![Python](https://www.python.org/downloads/) ![Tests](tests/) ![Code Coverage](tests/) ![MCP](https://modelcontextprotocol.io)

用于FlowSphere代码生成的模型上下文协议(MCP)服务器

变换 FlowSphere 配置文件转换为生产就绪测试代码 python, JavaScript,以及 C.

______________________________________________________________________

它做什么

从FlowSphere JSON配置生成独立的可执行测试代码:

  • python -pytest,行为/BDD
  • JavaScript -杰斯特、摩卡、黄瓜/BDD
  • C -xUnit、NUnit、SpecFlow/BDD

例子: 一个20行的JSON配置变成了400多行工作测试代码,其中包含完整的HTTP执行、变量替换、条件和验证。

______________________________________________________________________

✨ 快速开始

选项1:与Claude Code CLI一起使用(推荐)

# 1. Install dependencies
cd C:\dev\GitHub\flowsphere-mcp-server
pip install -r requirements.txt

# 2. Add MCP server to Claude Code
claude mcp add --transport stdio flowsphere-mcp python "C:\dev\GitHub\flowsphere-mcp-server\src\flowsphere_mcp\server.py"

# 3. Restart Claude Code
claude

# 4. Verify connection
/mcp
# Should show: flowsphere-mcp ✓ Connected

现在让Claude生成测试:

"Generate Python pytest code from tests/fixtures/simple_config.json"
"Create JavaScript Jest tests from this FlowSphere config"
"Generate C# xUnit tests with namespace MyApp.Tests"

选项2:直接使用Python API

import json
from flowsphere_mcp.generators.python_generator import PythonPytestGenerator

# Load your FlowSphere config
with open('tests/fixtures/simple_config.json') as f:
    config = json.load(f)

# Generate Python pytest code
generator = PythonPytestGenerator()
code = generator.generate(config)

# Save to file
with open('test_api.py', 'w') as f:
    f.write(code)

print("✅ Generated test_api.py")

______________________________________________________________________

📦 安装和设置

先决条件

  • Python 3.10+
  • (Python包管理器)

再进行

cd C:\dev\GitHub\flowsphere-mcp-server
pip install -r requirements.txt

配置MCP服务器(Claude Code CLI)

# Add the server
claude mcp add --transport stdio flowsphere-mcp python "C:\path\to\flowsphere-mcp-server\src\flowsphere_mcp\server.py"

# Verify configuration
claude mcp list

# Get server details
claude mcp get flowsphere-mcp

# Restart Claude Code to connect
claude

配置已保存到: %USERPROFILE%\.claude.json

MCP连接故障排除

如果服务器显示“连接失败”:

  1. 验证Python包:
   pip install -r requirements.txt
  1. 检查服务器路径:
   claude mcp get flowsphere-mcp

路径应使用反斜杠: C:\path\to\...

  1. 如果需要,请重新添加服务器:
   claude mcp remove flowsphere-mcp -s local
   claude mcp add --transport stdio flowsphere-mcp python "C:\correct\path\src\flowsphere_mcp\server.py"
  1. 重新启动Claude代码 获取更改

______________________________________________________________________

🚀 用法

所有8个支持的生成器

语言框架MCP工具输出
Pythonpytestgenerate_python_pytest单个测试文件
Python行为(BDD)generate_python_behave功能+步骤
JavaScript恶作剧generate_javascript_jest测试+包.json
JavaScriptMochagenerate_javascript_mocha测试+包.json
JavaScript黄瓜(BDD)generate_javascript_cucumber功能+步骤
C#xUnitgenerate_csharp_xunit 测试+.csproj。
C#NUnitgenerate_csharp_nunit 测试+.csproj。
C#规范流(BDD)generate_csharp_specflow功能+步骤

示例:Python pytest

# Via MCP tool
result = mcp_server.call_tool("generate_python_pytest", {
    "config": your_flowsphere_config,
    "test_class_name": "APITests"  # Optional
})

# Generated output includes:
# - Complete APISequence class with all 18 FlowSphere features
# - Test class with all test methods
# - Variable substitution, conditions, validations
# - Dependencies list and usage instructions

运行生成的测试:

pip install pytest requests jsonpath-ng
pytest test_api.py -v

示例:JavaScript Jest

// Via MCP tool
result = mcp_server.call_tool("generate_javascript_jest", {
    "config": your_flowsphere_config
})

// Returns:
// - result.code: Complete Jest test file
// - result.package_json: NPM dependencies
// - result.usage_instructions: How to run

运行生成的测试:

npm install
npm test

示例:C#xUnit

// Via MCP tool
result = mcp_server.call_tool("generate_csharp_xunit", {
    "config": your_flowsphere_config,
    "namespace": "MyApp.Tests"  // Optional
})

// Returns:
// - result.code: Complete xUnit test file
// - result.csproj: Project file with NuGet packages
// - result.usage_instructions: How to run

运行生成的测试:

dotnet test

配置示例

测试/夹具/ 对于5种FlowSphere配置示例:

  • simple_config.json -基本GET请求
  • auth_flow_config.json -通过令牌提取进行身份验证
  • conditional_config.json -有条件执行
  • validation_config.json -响应验证
  • full_features_config.json -全部18个功能

了解更多关于FlowSphere的信息: https://github.com/ymoud/flowsphere

______________________________________________________________________

🧪 测试生成的代码

Python pytest

# Install dependencies
pip install pytest requests jsonpath-ng

# Run tests
pytest generated_test.py -v

# Run with debug output
pytest generated_test.py -v -s

Python行为(BDD)

# Install dependencies
pip install behave requests jsonpath-ng

# Organize files
mkdir -p features/steps
mv *.feature features/
mv *_steps.py features/steps/

# Run tests
behave -v

JavaScript恶作剧

# Install dependencies (from generated package.json)
npm install

# Run tests
npm test

# Run with coverage
npm test -- --coverage

JavaScript Mocha

# Install dependencies
npm install --save-dev mocha chai axios jsonpath-plus uuid

# Run tests
npx mocha test_file.test.js

JavaScript黄瓜

# Install dependencies
npm install --save-dev @cucumber/cucumber axios jsonpath-plus chai

# Organize files
mkdir -p features/step_definitions
mv *.feature features/
mv *_steps.js features/step_definitions/

# Run tests
npx cucumber-js

C# x单元

# Create project
dotnet new xunit -n MyTests

# Add packages (from generated .csproj)
dotnet add package xunit
dotnet add package Newtonsoft.Json

# Run tests
dotnet test

C#NUnit

# Create project
dotnet new nunit -n MyTests

# Add packages
dotnet add package NUnit
dotnet add package Newtonsoft.Json

# Run tests
dotnet test

C#规范流

# Create project
dotnet new classlib -n MyTests

# Add packages
dotnet add package SpecFlow
dotnet add package SpecFlow.NUnit

# Organize files
mkdir Features StepDefinitions
mv *.feature Features/
mv *Steps.cs StepDefinitions/

# Run tests
dotnet test

______________________________________________________________________

🔧 可用的MCP工具

服务器暴露 11个MCP工具 对于AI代理:

架构和文档工具

1. get_flowsphere_schema

获取完整的FlowSphere配置模式文档。

退货: 包含所有属性、类型、默认值和示例的全面模式

2. get_flowsphere_features

获取所有18个FlowSphere功能的详细文档。

退货: 功能描述、实施说明、示例

3. get_feature_checklist

获取必须在生成的代码中实现的所有功能的清单。

退货: 18项功能检查表

Python生成器

4. generate_python_pytest

生成生产就绪的Python pytest代码。

参数:

  • config (必填):FlowSphere配置对象
  • test_class_name (可选):自定义测试类名
  • generate_report (可选):生成综合生成报告
  • save_report_to (可选):保存报告的文件路径

退货:

  • status:“成功”或“错误”
  • code:生成的Python pytest代码
  • config_json:单独的配置文件内容
  • config_filename:“config.json”
  • dependencies:pip包列表
  • usage_instructions:如何运行测试
  • generation_report:可选详细报告(如果generate_report=true)

5. generate_python_behave

生成Python行为/BDD测试(Gherkin+步骤定义)。

参数:

  • config (必填):FlowSphere配置对象
  • feature_name (可选):自定义要素文件名
  • generate_report (可选):生成综合生成报告
  • save_report_to (可选):保存报告的文件路径

退货:

  • code:组合Gherkin特征+步长定义
  • config_json:单独的配置文件内容
  • dependencies:pip包列表(行为、请求、jsonpath ng)
  • note:文件组织说明
  • generation_report:可选详细报告

JavaScript生成器

6. generate_javascript_jest

生成JavaScript Jest测试。

参数:

  • config (必填):FlowSphere配置对象
  • test_class_name (可选):自定义测试类名
  • generate_report (可选):生成综合生成报告
  • save_report_to (可选):保存报告的文件路径

退货:

  • code:生成的Jest测试文件
  • config_json:单独的配置文件内容
  • package_json:完整的package.json
  • dependencies:npm包列表
  • usage_instructions:如何运行测试
  • generation_report:可选详细报告

7. generate_javascript_mocha

使用Chai断言生成JavaScript Mocha测试。

参数:

  • config (必填):FlowSphere配置对象
  • test_class_name (可选):自定义测试类名
  • generate_report (可选):生成综合生成报告
  • save_report_to (可选):保存报告的文件路径

退货:

  • code:生成的Mocha测试文件
  • config_json:单独的配置文件内容
  • package_json:完整的package.json
  • dependencies:npm包列表(mocha、chai、axios、jsonpath plus)
  • generation_report:可选详细报告

8. generate_javascript_cucumber

生成JavaScript Cucumber/BDD测试(Gherkin+步骤定义)。

参数:

  • config (必填):FlowSphere配置对象
  • feature_name (可选):自定义要素文件名
  • generate_report (可选):生成综合生成报告
  • save_report_to (可选):保存报告的文件路径

退货:

  • feature:小黄瓜特征文件内容
  • steps:步骤定义文件内容
  • config_json:单独的配置文件内容
  • package_json:完整的package.json
  • dependencies:npm包列表(@cucumber/cucumber,axios,chai)
  • note:文件组织说明
  • generation_report:可选详细报告

C#生成器

9. generate_csharp_xunit

生成C#xUnit测试。

参数:

  • config (必填):FlowSphere配置对象
  • test_class_name (可选):自定义测试类名
  • namespace (可选):自定义命名空间(默认:FlowSphere.Tests)
  • generate_report (可选):生成综合生成报告
  • save_report_to (可选):保存报告的文件路径

退货:

  • code:生成的xUnit测试文件
  • config_json:单独的配置文件内容
  • csproj:使用NuGet包完成.csproj文件
  • dependencies:NuGet包列表(xunit、Newtonsoft.Json)
  • usage_instructions:如何运行测试
  • generation_report:可选详细报告

10. generate_csharp_nunit

使用约束模型断言生成C#NUnit测试。

参数:

  • config (必填):FlowSphere配置对象
  • test_class_name (可选):自定义测试类名
  • namespace (可选):自定义命名空间(默认:FlowSphere.Tests)
  • generate_report (可选):生成综合生成报告
  • save_report_to (可选):保存报告的文件路径

退货:

  • code:生成的NUnit测试文件
  • config_json:单独的配置文件内容
  • csproj:使用NuGet包完成.csproj文件
  • dependencies:NuGet包列表(NUnit、Newtonsoft.Json)
  • usage_instructions:如何运行测试
  • generation_report:可选详细报告

11. generate_csharp_specflow

生成C#SpecFlow/BDD测试(Gherkin+步骤定义)。

参数:

  • config (必填):FlowSphere配置对象
  • feature_name (可选):自定义要素文件名
  • step_class_name (可选):自定义步骤定义类名
  • namespace (可选):自定义命名空间(默认:FlowSphere.Tests)
  • generate_report (可选):生成综合生成报告
  • save_report_to (可选):保存报告的文件路径

退货:

  • feature:小黄瓜特征文件内容
  • steps:C#步骤定义文件内容
  • config_json:单独的配置文件内容
  • csproj:使用NuGet包完成.csproj文件
  • dependencies:NuGet包列表(SpecFlow、NUnit)
  • note:文件组织说明
  • generation_report:可选详细报告

📊 生成报告

所有代码生成工具都支持可选的综合报告,包括:

  • 配置分析 -大小、节点数、检测到的特征
  • 令牌使用分析 -输入/输出令牌,实时跟踪
  • 成本估算 -GPT-4定价参考,节省计算
  • 优化建议 -上下文感知提示
  • 规模预测 -每日/每周/每月成本估算

示例用法:

result = mcp_server.call_tool("generate_python_pytest", {
    "config": your_config,
    "generate_report": True,
    "save_report_to": "reports/generation_report.md"
})

# Access the report
print(result['generation_report'])  # Full markdown report
print(result['report_path'])  # File path if saved

______________________________________________________________________

✅ 完整的功能覆盖

所有发电机支持 全部18个FlowSphere功能:

HTTP执行

  • ✅ GET、POST、PUT、DELETE、PATCH请求
  • ✅ 自定义标头(根据请求和默认值)
  • ✅ 请求正文(JSON)
  • ✅ 超时配置

变量替换(4种类型)

  • {{ .vars.key }} -全局变量
  • {{ .responses.nodeId.field }} -响应参考
  • {{ .input.variableName }} -用户输入
  • {{ $guid }}, {{ $timestamp }} -动态占位符

状态评估(8名操作员)

  • equals, notEquals
  • contains, notContains
  • greaterThan, lessThan
  • greaterThanOrEqual, lessThanOrEqual
  • ✅ 多种条件下的AND逻辑
  • ✅ 条件中的变量替换

响应验证

  • ✅ HTTP状态码验证
  • ✅ 使用所有运算符进行JSONPath字段验证
  • ✅ 跳过默认验证标志

高级功能

  • ✅ 带变量存储的字段提取(JSONPath)
  • ✅ 用户提示(promptMessage)
  • ✅ 浏览器启动(launchBrowser)
  • ✅ 跳过默认标题标志
  • ✅ 调试模式(enableDebug)

______________________________________________________________________

📂 项目结构

flowsphere-mcp-server/
├── src/flowsphere_mcp/
│   ├── server.py                    # MCP server (11 tools)
│   ├── schema/
│   │   ├── config_schema.py         # FlowSphere schema docs
│   │   └── features.py              # 18 features documentation
│   ├── templates/
│   │   ├── python/                  # pytest, behave templates
│   │   ├── javascript/              # Jest, Mocha, Cucumber templates
│   │   └── csharp/                  # xUnit, NUnit, SpecFlow templates
│   ├── generators/
│   │   ├── base_generator.py        # Base generator class
│   │   ├── python_generator.py      # Python pytest generator
│   │   ├── behave_generator.py      # Python behave generator
│   │   ├── javascript_generator.py  # JS Jest/Mocha/Cucumber generators
│   │   └── csharp_generator.py      # C# xUnit/NUnit/SpecFlow generators
│   └── utils/
│       └── report_generator.py      # Generation report builder
├── tests/
│   ├── fixtures/                    # 5 sample FlowSphere configs
│   ├── test_*_generator.py          # Generator tests (153 tests total)
│   └── generated_code/              # Example outputs
├── requirements.txt
├── ROADMAP.md
└── README.md

______________________________________________________________________

🗺️ 开发阶段

  • 第一阶段 -架构提供程序
  • 第2阶段 -Python pytest生成器(31个测试)
  • 第三期 -Python行为/BDD生成器(34个测试)
  • 阶段4 -JavaScript生成器(Jest、Mocha、Cucumber)(46次测试)
  • 阶段5 -C#生成器(xUnit、NUnit、SpecFlow)(39次测试)
  • 第7.1阶段 -令牌优化(配置文件加载)-每代保存3000个令牌
  • 🔄 第7阶段 -令牌效率和性能优化(正在进行中)
  • 📋 第6阶段 -出版与发行(PyPI、Smithery)

当前状态: 153项测试通过,100%覆盖,8台发电机可投入生产

______________________________________________________________________

❓ 故障排除

MCP服务器无法连接

症状: 服务器在中显示“连接失败” /mcp 输出

解决:

  1. 验证是否安装了Python包: pip install -r requirements.txt
  2. 检查配置中的服务器路径: claude mcp get flowsphere-mcp
  3. 确保Windows上的路径使用反斜杠: C:\path\to\...
  4. 重新添加服务器: claude mcp remove flowsphere-mcp -s local 然后 claude mcp add...
  5. 重新启动Claude代码:退出 /exit那么 claude

生成的Python测试失败

解决:

# Install dependencies
pip install pytest requests jsonpath-ng behave

# Verify Python version
python --version  # Should be 3.10+

# Check config file is in correct location
ls config.json  # Should be in same directory as test file

生成的JavaScript测试失败

解决:

# Install dependencies from generated package.json
npm install

# Verify Node.js version
node --version  # Should be 16+

# Check config file location
ls config.json  # Should be in same directory as test file

生成的C#测试失败

解决:

# Restore packages
dotnet restore

# Verify .NET SDK version
dotnet --version  # Should be 6.0+

# Check config file location
dir config.json  # Should be in project root or Configuration/ folder

生成的代码中存在导入错误

解决方案: 所有生成的代码都需要 config.json 从文件加载。确保:

  1. 保存 config_json 从MCP响应到名为的文件 config.json
  2. 将其放置在与测试相同的目录中(或 configuration/ 子目录)
  3. note MCP响应中的特定放置指令字段

______________________________________________________________________

🆘 支持和后续步骤

快速链接

后续步骤

  1. 尝试快速启动 -使用Claude Code CLI在5分钟内运行
  2. 生成您的第一个测试 -使用中的示例配置之一 tests/fixtures/
  3. 运行生成的代码 -看到它与真实的API协同工作
  4. 自定义配置 -尝试不同的FlowSphere功能
  5. 与CI/CD集成 -将生成的测试添加到您的管道中

运行单元测试

验证一切正常:

# Run all tests (153 tests)
pytest tests/ -v

# Run specific generator tests
pytest tests/test_python_generator.py -v       # 31 tests
pytest tests/test_behave_generator.py -v      # 34 tests
pytest tests/test_javascript_generator.py -v  # 30 tests
pytest tests/test_mocha_generator.py -v       # 8 tests
pytest tests/test_cucumber_generator.py -v    # 8 tests
pytest tests/test_xunit_generator.py -v       # 12 tests
pytest tests/test_nunit_generator.py -v       # 14 tests
pytest tests/test_specflow_generator.py -v    # 13 tests

______________________________________________________________________

📄 许可证

MIT许可证-请参阅 许可证 详见

______________________________________________________________________

内置❤️ FlowSphere社区

目录标签

目录标签

代码生成PythonClaude本地部署自动化测试持续集成多语言支持测试框架集成

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP