项目简介
Rocketship AI上下文服务是一个专门为LLM (大型语言模型) 客户端设计的MCP (Model Context Protocol) 服务器。它旨在以标准化的方式向AI编码代理提供有关Rocketship测试框架的丰富上下文信息和可调用工具,从而使LLM能够更智能地理解、生成、运行和维护集成测试。该服务通过动态加载Rocketship CLI的最新能力、测试示例、文档和Schema信息,为LLM提供实时、准确的知识。
主要功能点
- 托管和管理资源: 提供Rocketship测试配置文件(YAML)的Schema定义,帮助LLM理解文件结构和语法。托管丰富的测试示例和最佳实践,作为LLM生成新测试的参考。
- 注册和执行工具:
- 'get_rocketship_examples': 获取特定Rocketship功能或用例的真实测试示例。
- 'suggest_test_structure': 基于项目类型和用户流程建议合适的测试文件结构和组织方式。
- 'get_schema_info': 提供当前Schema信息,用于验证测试文件的正确语法和结构。
- 'get_cli_guidance': 提供当前Rocketship CLI的命令行使用模式和命令,指导LLM如何执行测试。
- 'get_rocketship_cli_installation_instructions': 提供不同平台下Rocketship CLI的安装步骤和故障排除指南。
- 'analyze_codebase_for_testing': 分析代码库信息以建议有意义的测试场景和策略。
- 定义和渲染Prompt模板: 通过上述工具动态生成丰富的文本内容,这些内容可被视为一种Prompt模板的渲染结果,为LLM交互提供可定制的模式。
- 会话管理和能力声明: 服务器通过JSON-RPC协议与客户端通信,声明其提供的工具和能力。
安装步骤
Rocketship CLI的MCP服务器部分是一个Node.js应用,可以通过'npx'命令直接运行,无需复杂安装。
- 确保Node.js和npm已安装: 如果您的系统尚未安装Node.js和npm,请先安装它们。
- 无需手动安装包: MCP服务器会通过'npx'命令按需下载和运行最新版本。
服务器配置
MCP服务器是给MCP客户端 (如VS Code Copilot Chat, Cursor等AI编码代理) 用的。MCP客户端通常需要在其项目配置 (例如'.mcp.json'文件) 中添加MCP服务器的启动命令。
以下是为MCP客户端配置Rocketship AI上下文服务服务器的示例信息:
{ "mcpServers": { "rocketship": { "command": "npx", "args": ["-y", "@rocketshipai/mcp-server@latest"], "comment": "启动Rocketship MCP服务器,提供测试框架的上下文和工具", "args_comment": [ "-y: 自动确认安装npm包", "@rocketshipai/mcp-server@latest: 指定要运行的最新MCP服务器包" ] } } }
配置说明:
- '"rocketship"': 这是您给MCP服务器起的名字,可以自定义。
- '"command": "npx"': 指定运行服务器的命令是'npx'。
- '"args": ["-y", "@rocketshipai/mcp-server@latest"]': 'npx'命令的参数。
- '-y': 表示自动同意安装npm包,无需手动确认。
- '@rocketshipai/mcp-server@latest': 这是Rocketship MCP服务器的npm包名称,'@latest'确保总是运行最新版本。
配置完成后,您的AI编码代理将能够识别并调用Rocketship AI上下文服务提供的工具。
基本使用方法
一旦MCP服务器在您的AI编码代理中配置并运行,您可以直接通过自然语言与代理交互,利用Rocketship的工具:
- 获取API测试示例:
- 您可以问:“Show me examples of API testing with step chaining”
- 代理会调用 'get_rocketship_examples(feature_type="http", use_case="API testing with chaining")' 并返回相关示例。
- 询问Schema信息:
- 您可以问:“What assertions should I use for JSON responses?”
- 代理会调用 'get_schema_info(section="assertions")' 并提供断言类型。
- 获取CLI安装指南:
- 您可以问:“How do I install the Rocketship CLI?”
- 代理会调用 'get_rocketship_cli_installation_instructions()' 并返回详细的安装步骤。
- 请求测试结构建议:
- 您可以问:“Give me a template for an E2E customer journey test for a React app.”
- 代理会调用 'suggest_test_structure(project_type="frontend", user_flows=["customer journey"])' 并返回建议的目录和文件结构。
- 分析代码库并建议测试:
- 您可以问:“My codebase is a Python backend with FastAPI and PostgreSQL, suggest some meaningful test scenarios focusing on critical paths.”
- 代理会调用 'analyze_codebase_for_testing(codebase_info="Python backend with FastAPI and PostgreSQL", focus_area="critical_paths")' 并给出测试建议。
信息
分类
开发者工具