MCP Cypress Page Object Generator
This MCP server automatically generates Cypress Page Object classes and comprehensive test suites for any web page by analyzing its structure.
Core Capabilities:
Web Scraping & Analysis: Uses Puppeteer to fetch and render web pages (including dynamic content) and Cheerio to parse HTML elements
Page Object Generation: Creates TypeScript classes with private element locators, public getters, interaction methods (click, type, select, clear), and workflow methods for common patterns like login and search
Comprehensive Test Generation: Produces test suites covering positive tests (interactions, workflows, validation), negative tests (error handling, edge cases), and additional tests (accessibility, performance, responsive design, security)
Element Support: Handles buttons, input fields, links, select dropdowns, textareas, and forms
Workflow Detection: Intelligently identifies patterns like login forms, search forms, and navigation flows to generate appropriate methods and tests
File Creation: Directly writes Page Object and test files into your Cypress project structure with custom naming and workspace path options
Available Tools:
generateLocator: Returns generated Page Object and test suite code for a given URLcreateCypressFiles: Creates and saves files directly into your Cypress project with configuration options
Uses Cheerio to parse HTML and extract element information from web pages for test generation
Generates complete Cypress Page Object classes and comprehensive test suites for web pages, including positive and negative test cases, workflow tests, and accessibility tests
Uses Puppeteer for web scraping and page rendering to fetch and analyze web pages before generating tests
Creates TypeScript Page Object classes with private element locators, public getter methods, and interaction methods
Utilizes Zod for schema validation in the generated test suites
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Cypress Page Object Generatorcreate a page object for the login page at https://example.com/login"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Cypress Page Object Generator
This MCP server automatically generates Cypress Page Object classes for any web page provided.
NPM package:
Related MCP server: Web-QA
Features
Web Scraping: Uses Puppeteer to fetch and render web pages
HTML Parsing: Uses Cheerio to parse HTML and extract element information
Page Object Generation: Creates complete TypeScript Page Object classes with:
Private element locators
Public getter methods
Interaction methods (click, type, select, etc.)
Sample prompt:
Create a page object file using the following url: https://www.saucedemo.com/ Generated Output
The server generates:
1. Page Object Class ({ClassName}.ts)
export class ExampleComLoginPage {
// Private elements
#elements = {
button_login: () => cy.get('#login-button'),
input_username: () => cy.get('input[name="username"]'),
link_home: () => cy.contains('a', 'Home')
}
// Public getters
get ButtonLogin() { return this.#elements.button_login() }
get InputUsername() { return this.#elements.input_username() }
get LinkHome() { return this.#elements.link_home() }
// Interaction methods
clickButtonLogin() { return this.#elements.button_login().click() }
typeInputUsername(text: string) { return this.#elements.input_username().type(text) }
clickLinkHome() { return this.#elements.link_home().click() }
}Element Types Supported
Buttons: Click interactions with validation
Input Fields: Type, clear, check/uncheck (for checkboxes/radio)
Links: Click interactions with navigation verification
Select Dropdowns: Select options with validation
Textareas: Type and clear with content verification
Forms: Submit interactions with success/error handling
Installation
Follow standard procedures to install an MCP in the client of your choice
Usage
Start the server:
node index.jsUse with an MCP client: The server exposes a
generatePageObjectFiletool that accepts a URL parameter.Example tool call:
{ "method": "tools/call", "params": { "name": "generatePageObjectFile", "arguments": { "url": "https://example.com/login" } } }Response format: The server returns both the Page Object class:
// ===== PAGE OBJECT CLASS ===== // Save this as: ExampleComLoginPage.ts export class ExampleComLoginPage { ... }
Dependencies
@modelcontextprotocol/sdk: MCP server implementationpuppeteer: Web scraping and page renderingcheerio: HTML parsing and element selectionzod: Schema validationtypescript: Type safety
Error Handling
The server includes comprehensive error handling for:
Invalid URLs
Network connectivity issues
Page loading failures
HTML parsing errors
Browser Configuration
The server uses Puppeteer with the following settings:
Headless mode for server environments
No-sandbox mode for containerized deployments
Network idle waiting for dynamic content
Contributing
To add support for new element types, interaction methods, or test patterns, modify the generatePageObjectClass function in index.js.
Troubleshooting: Updating to the Latest MCP Version
If you are intending to update to the latest version of this MCP server package but the new version is not being pulled by npm, try this:
Clear the NPM cache and reinstall the package:
npm cache clean --force npm install @jprealini/cypress-mcp@latest --save-devIf using a lockfile (
package-lock.jsonoryarn.lock), delete it and run:npm installFor global installs, update globally:
npm install -g @jprealini/cypress-mcp@latestVerify the installed version:
npm list @jprealini/cypress-mcp
These steps ensure consumers always get the latest published MCP version and avoid issues with cached or locked old versions.
Example: Generated Page Object Format (saucedemo.com)
Below is an example of the expected Page Object format generated by MCP for saucedemo.com:
export class Swag_labsPage {
// Private elements
#elements = {
inputUsername: () => cy.get('[data-test="username"]'),
inputPassword: () => cy.get('[data-test="password"]'),
inputLoginButton: () => cy.get('[data-test="login-button"]')
}
// Element meta (currently not used for bulk actions)
// Public getters
get inputUsername() { return this.#elements.inputUsername() }
get inputPassword() { return this.#elements.inputPassword() }
get inputLoginButton() { return this.#elements.inputLoginButton() }
// Value/State getters
getValueInputUsername() { return this.#elements.inputUsername().invoke('val') }
getValueInputPassword() { return this.#elements.inputPassword().invoke('val') }
getTextInputLoginButton() { return this.#elements.inputLoginButton().invoke('text') }
// Interaction methods (per-element actions)
typeInputUsername(text) { return this.#elements.inputUsername().type(text) }
clearInputUsername() { return this.#elements.inputUsername().clear() }
typeInputPassword(text) { return this.#elements.inputPassword().type(text) }
clearInputPassword() { return this.#elements.inputPassword().clear() }
clickInputLoginButton() { return this.#elements.inputLoginButton().click() }
}This format follows one of the mostly used page object standards, using data attributes for selectors, private element encapsulation, public getters, value/state getters, and interaction methods for each element.
If you need or expect a different pattern, you can generate this base structure using this MCP, and then use your own instruction set to edit it to fit your needs, using a prompt like:
Create a page object file using the following url: https://www.saucedemo.com/ and after creating it, edit it to meet the requirements described in my instructions.md fileAvailable Tools
1 toolcreate_Page_Object_fileCreate Page Object FileC
Create Page Object file directly in the Cypress project by analyzing the provided URL
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL of the web page | |
| workspacePath | No | Workspace path (optional, it is detected automatically if not provided) | |
| pageObjectName | No | Custom name for the page object (optional) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a file by analyzing a URL but omits critical details like what permissions are needed, how the analysis works, whether it overwrites existing files, error handling, or output format. This is inadequate for a tool that performs file creation and web analysis.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's action and key input (URL). It is front-loaded with the core purpose and wastes no words, making it highly concise and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (involving file creation, URL analysis, and Cypress integration), no annotations, and no output schema, the description is insufficient. It lacks details on behavioral traits, error cases, or what the created file contains, leaving significant gaps for an AI agent to understand and use the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond implying URL analysis, which is already suggested by the parameter descriptions. This meets the baseline of 3 since the schema handles parameter documentation effectively.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Create Page Object file directly in the Cypress project by analyzing the provided URL.' It specifies the verb ('Create'), resource ('Page Object file'), and context ('Cypress project'), but lacks differentiation from siblings since none exist, making a perfect 5 unnecessary.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or exclusions. It mentions analyzing a URL but doesn't specify what types of URLs are suitable or any constraints, leaving usage unclear beyond the basic action.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
v1.0.0- Added
create_Page_Object_file - Removed
createCypressFiles - Removed
generateLocator
2 tool updates
- First observed
createCypressFiles - First observed
generateLocator
TDQS
With only one tool, there is no possibility for ambiguity or overlap between tools. The single tool has a clear, distinct purpose focused on creating a Page Object file from a URL.
The single tool name follows a consistent verb_noun pattern (create_Page_Object_file), and with only one tool, there is no inconsistency to evaluate. The naming is clear and predictable.
One tool is too few for a server named 'MCP Cypress Page Object Generator', as it suggests a broader scope for generating and managing page objects. A single tool feels thin and incomplete for this domain, limiting functionality to just creation without supporting operations like updating, listing, or deleting.
The tool surface is severely incomplete for page object generation. It only provides creation from a URL, with no tools for updating existing files, listing generated objects, deleting them, or handling other aspects like validation or testing integration. This will cause significant agent failures in typical workflows.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for Mint — AI-powered QA that runs your app in a real browser on every PR.
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
An MCP server that provides access to Testiny projects, test cases and test runs
Related MCP Servers
- -licenseAqualityNot gradedmaintenanceA TypeScript-based MCP server that generates API clients from OpenAPI specifications, allowing automated code generation through natural language.1441-
- AlicenseNot gradedqualityDmaintenanceAn AI-powered MCP server that automates web testing workflows by enabling recording, execution, and discovery of tests through natural language prompts.67Apache 2.0
- AlicenseNot gradedqualityDmaintenanceAn MCP server that automates Playwright-based UI and API testing, supporting test case generation from requirements or API specs, and execution with detailed reports.171MIT
- AlicenseBqualityDmaintenanceMCP server for end-to-end QA automation: generates test scenarios, discovers Playwright locators, creates TypeScript test code, executes tests, and creates GitHub issues for failures.617MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jprealini/cypress-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server