- Cypress MCP Test Generator
Cypress MCP Test Generator
Content
Cypress MCP Test Generator
This project provides a Model Context Protocol (MCP) server that generates Cypress tests from natural language prompts. Simply describe your test scenario in plain English, and the server will generate a fully functional Cypress test.
Table of Contents
Setup
Prerequisites
- Node.js (v16 or higher)
- npm (comes with Node.js)
- VS Code
- TypeScript
Installation
- Clone the repository:
git clone <repository-url>
cd your-project-directory
- Install dependencies:
npm install
- Build the project:
npm run build
- Create VS Code MCP configuration:
mkdir -p .vscode
- Create
.vscode/mcp.jsonwith the following content (update the path to match your system):
{
"servers": {
"cypress-mcp": {
"type": "stdio",
"command": "node",
"args": ["path/to/your/project/build/index.js"]
}
}
}
Usage
- Open your project in VS Code
- The MCP server will start automatically
- Open VS Code's command palette and type your test description
- The server will generate a Cypress test based on your description
How it Works
- Your natural language prompt is processed by the MCP server
- The server generates appropriate Cypress commands and assertions
- A new test file is created in the cypress/e2e directory
- The test is ready to run using Cypress
Example Prompts
Here are some example prompts you can use:
- Basic Navigation and Search:
"Go to google.com and search for 'cypress testing'"
Generated test will:
- Navigate to Google
- Handle cookie consent if present
- Type search term
- Verify search results
- Login Flow:
"Visit login page, enter username 'test@example.com', type password 'password123', click login button, and verify dashboard appears"
Generated test will:
- Navigate to login page
- Fill in credentials
- Submit form
- Verify successful login
- Form Submission:
"Navigate to contact-form.com, fill in name 'John Doe', enter email 'john@example.com', type message 'Hello World', click submit button, and verify success message appears"
Configuration
Project Structure
project-root/
├── src/
│ ├── index.ts # MCP server implementation
│ └── cypress/
│ └── commands.ts # Custom Cypress commands
├── cypress/
│ ├── e2e/ # Generated test files
│ └── support/ # Support files
└── .vscode/
└── mcp.json # MCP server configuration
Customizing the Server
You can customize test generation by modifying:
- Test templates in src/index.ts
- Custom commands in src/cypress/commands.ts
- Error handling and retry mechanisms
Troubleshooting
Common Issues
-
Server Not Starting
- Verify paths in mcp.json are correct
- Check build/index.js exists
- Ensure Node.js version is compatible
-
Test Generation Fails
- Check prompt format
- Verify server logs for errors
- Ensure all dependencies are installed
-
VS Code Integration Issues
- Reload VS Code window
- Check VS Code's output panel for errors
- Verify .vscode/mcp.json configuration
Error Messages
-
"Server exited before responding"
- Check file paths in mcp.json
- Rebuild the project
- Restart VS Code
-
"Cannot find module"
- Run npm install
- Check build folder exists
- Rebuild the project
Logs Location
- Server logs: VS Code's Output panel (Cypress MCP Server)
- Generated test files: cypress/e2e directory
- Build output: build directory
Script Commands
{
"scripts": {
"build": "tsc",
"start": "node build/index.js",
"dev": "tsc --watch",
"cypress:open": "cypress open",
"cypress:run": "cypress run"
}
}
Best Practices for Prompts
-
Be Specific
- Include URLs when applicable
- Specify exact text for inputs
- Mention expected verifications
-
Use Clear Actions
- "visit" or "go to" for navigation
- "type" or "enter" for input
- "click" for button interactions
- "verify" or "check" for assertions
-
Include Verification Steps
- Mention what should appear after actions
- Include expected text or elements
- Specify timeouts if needed
Support
For issues and questions:
- Check the troubleshooting guide
- Review server logs
- Check VS Code's output panel
- Verify file paths and configurations
Notes
- The server automatically handles common scenarios like cookie consent dialogs
- Generated tests include retry mechanisms for reliability
- Custom commands are available for complex interactions
- Tests are generated with TypeScript support
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
CursorThe AI Code Editor
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Serper MCP ServerA Serper MCP Server
DeepChatYour AI Partner on Desktop
Playwright McpPlaywright MCP server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Tavily Mcp
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Amap Maps高德地图官方 MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
ChatWiseThe second fastest AI chatbot™
WindsurfThe new purpose-built IDE to harness magic