MCP Frontend Testing Server

Integrations

  • Enables serverless deployment on AWS Lambda for scalable test execution and analysis

  • Provides tools for generating and executing Cypress tests, supporting unit, component, and e2e test types for JavaScript/TypeScript code

  • Provides containerization support for deploying the testing server in isolated environments

MCP 前端测试服务器

描述

该 MCP 服务器提供前端测试工具,包括:

  • 代码分析:分析 JavaScript/TypeScript 代码以确定适当的测试策略。
  • 测试生成:为 Jest 和 Cypress 生成单元和组件测试。
  • 测试运行:使用 Jest 和 Cypress 执行测试并返回结果。
  • 组件测试:提供专门用于测试 React 组件的工具。

入门

安装

  1. 克隆存储库: `git clone mcp-frontend-testing`
  2. 导航到项目目录: `cd mcp-frontend-testing`
  3. 安装依赖项: `npm install`

运行服务器

HTTP 传输

```bash

构建服务器

npm 运行构建

使用 HTTP 传输启动服务器

npm 运行开始:http ```

标准传输

```bash

构建服务器

npm 运行构建

使用 Stdio 传输启动服务器

npm 运行开始:stdio ```

用法

工具

  • analyzeCode :分析代码并返回分析结果。
    • 参数
      • `code`(字符串,必需):要分析的源代码。
      • `language`(枚举,可选):代码的语言(`javascript` | `typescript` | `jsx` | `tsx`,默认值:`javascript`)。
  • generateTest :根据源代码和框架生成测试代码。
    • 参数
      • `code`(字符串,必需):生成测试的源代码。
      • `framework`(枚举,必需):测试框架(`jest` | `cypress`)。
      • `type` (枚举,必需):测试类型 (`unit` | `component` | `e2e`)。
      • `language`(枚举,可选):代码的语言(`javascript` | `typescript` | `jsx` | `tsx`,默认值:`javascript`)。
      • `description`(字符串,可选):测试用例的描述。
  • runTest :运行测试并返回结果。
    • 参数
      • `sourceCode`(字符串,必需):正在测试的源代码。
      • `testCode`(字符串,必需):要执行的测试代码。
      • `framework`(枚举,必需):测试框架(`jest` | `cypress`)。
      • `type` (枚举,必需):测试类型 (`unit` | `component` | `e2e`)。
      • `config`(记录,可选):测试执行的配置对象。
  • testReactComponent :专门针对 React 组件运行组件测试。
    • 参数
      • `componentCode`(字符串,必需):React 组件的源代码。
      • `testCode`(字符串,可选):组件的测试代码(如果未提供则自动生成)。
      • `framework` (枚举,可选):测试框架(`jest` | `cypress`,默认值:`jest`)。
      • `props`(记录,可选):测试期间传递给组件的道具。
      • `autoGenerateTest`(布尔值,可选):如果未提供,则自动生成测试代码(默认值:`true`)。

资源

  • templates :提供测试模板。
    • URI`templates://{framework}/{type}`
    • 参数
      • `framework`(字符串,必需):测试框架(`jest` | `cypress`)。
      • `type` (字符串,必需):模板类型 (`unit` | `component`)。
  • docs :提供测试框架的文档。
    • URI`docs://{topic}`
    • 参数
      • `topic` (字符串,必需):文档主题 (`jest` | `cypress` | `react-testing-library`)。

部署

Docker

使用 Docker 构建并运行服务器:

```bash docker build -t mcp-frontend-testing.docker run -p 3000:3000 mcp-frontend-testing```

部署到 AWS Lambda、Google Cloud Run 或 Azure Functions 等云平台,实现无服务器或容器化部署。


注意:此服务器设计用于与 MCP 客户端一起使用,以使 LLM 能够执行前端测试任务。

-
security - not tested
F
license - not found
-
quality - not tested

提供前端测试工具,包括代码分析、测试生成、测试执行以及针对 Jest 和 Cypress 框架的 React 组件测试。

  1. Description
    1. Getting Started
      1. Installation
      2. Running the Server
    2. Build the server
      1. Start the server with HTTP transport
        1. Stdio Transport
      2. Build the server
        1. Start the server with Stdio transport
          1. Usage
          2. Deployment
        ID: x9qtnbbphu