A custom MCP (Model Context Protocol) server designed for local Playwright project control through LLM interactions.
Unlike global Playwright MCP installations, this project enables intelligent automation and management of specific Playwright projects within your local development environment.
- Purpose and Scope
- Comparison with Copilot/Cursor
- What is MCP?
- Features
- MCP-Compatible Applications
- Configuration
- Getting Started
- Available Commands
- Project Structure
- License
This is not a global Playwright MCP server. Instead, it's a specialized MCP implementation that:
- β Controls local Playwright projects through natural language interactions
- β Manages project-specific testing workflows intelligently
- β Provides context-aware automation for your development environment
- β Integrates seamlessly with existing Playwright projects without global installation requirements
This local Playwright MCP approach offers distinct advantages over traditional AI coding assistants.
How they work:
- Provide code suggestions and completions within your editor
- Generate code snippets based on comments or context
- Require manual execution of generated commands
- Work primarily at the file/code level
Limitations:
- β No execution capability - They suggest code but can't run it
- β Editor-bound - Limited to the specific IDE/editor environment
- β Manual workflow - You must copy, paste, and execute suggested commands
- β Context switching - Need to switch between AI suggestions and terminal/testing tools
- β Generic responses - Not aware of your specific project structure and testing patterns
How it works:
- β Direct execution - Actually runs tests, manages git operations, and performs project tasks
- β Conversational control - Natural language commands that immediately execute
- β Project awareness - Understands your specific project structure, test patterns, and configurations
- β Workflow integration - Seamlessly combines multiple operations (search β test β commit β push)
Feature | Copilot/Cursor | This MCP Approach |
---|---|---|
Code Execution | β Suggests only | β Actually executes |
Project Context | β File-level only | β Full project awareness |
Workflow Integration | β Manual steps | β Automated workflows |
Natural Language Control | β Comment-based | β Conversational |
Testing Operations | β Code generation | β Live test execution |
Git Integration | β Suggests commands | β Performs git operations |
Multi-step Tasks | β Requires manual coordination | β Intelligent task chaining |
Environment Awareness | β Generic | β Project-specific |
1. Ask: "How do I run my login tests?"
2. Get code suggestion: `npx playwright test login.spec.ts`
3. Copy the command
4. Switch to terminal
5. Paste and execute
6. Manually interpret results
7. Repeat for any follow-up actions
1. Say: "Run my login tests and show me the results"
2. β
Tests execute automatically
3. β
Results are analyzed and presented
4. β
Ready for follow-up: "Stage the test files and commit them"
5. β
Git operations happen automatically
- Writing new code or functions
- Need code suggestions while typing
- Working on general programming tasks
- Want autocomplete and code generation
- Managing existing Playwright projects
- Need to execute testing workflows
- Want conversational project control
- Require integrated git operations
- Need project-aware automation
- Want to chain multiple development tasks
These approaches can work together:
- Copilot/Cursor for writing and generating test code
- This MCP for running, managing, and orchestrating those tests
- Combined workflow: Generate tests with AI assistants, then control and execute them through natural language with this MCP
The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. This implementation specifically focuses on local Playwright project management rather than general-purpose web automation.
- Dynamic test discovery - Automatically find and analyze tests in your project
- Context-aware execution - Run tests based on project state and requirements
- Smart test filtering - Execute specific test suites based on natural language descriptions
- Result analysis - Interpret and explain test outcomes
- Self-healing tests - Automatic retry with trace/debug on failures
- Local file operations - Work within your project's directory structure
- Configuration management - Modify Playwright configs based on requirements
- Dependency handling - Manage project dependencies intelligently
- Development workflow integration - Seamlessly integrate with existing processes
- Custom reporters - Run tests with various output formats (list, dot, json, junit, html)
- Natural language commands - Control your Playwright project through conversation
- Context understanding - Maintains awareness of your project structure and history
- Intelligent suggestions - Provides recommendations based on project analysis
- Adaptive responses - Adjusts behavior based on project-specific needs
Claude Desktop is the primary application supporting this local MCP implementation:
- Connect to your specific Playwright project
- Control local testing workflows through conversation
- Access project files and configurations
- Manage development tasks intelligently
OS | Path |
---|---|
macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
Windows | %APPDATA%\Claude\claude_desktop_config.json |
{
"mcpServers": {
"local-playwright-control": {
"command": "/opt/homebrew/opt/node@22/bin/npx",
"args": [
"ts-node",
"--esm",
"/path/to/your/playwright/repo/index.ts"
],
"cwd": "/path/to/your/playwright/repo"
},
"filesystem": {
"command": "npx",
"args": [
"@modelcontextprotocol/server-filesystem",
"/path/to/your/playwright/project"
],
"env": {
"MCP_FILESYSTEM_READ_ONLY": "false"
}
},
"github": {
"command": "npx",
"args": ["@modelcontextprotocol/server-github", "--transport=stdio"],
"env": {
"GITHUB_TOKEN": "YOUR_TOKEN"
}
}
}
}
- Purpose: Controls your specific Playwright project, not global operations
- Scope: Limited to your designated project directories
- Intelligence: Understands your project structure and testing patterns
- Customization: Adapts to your specific project needs and conventions
- Project-focused directories: Only accesses your Playwright project and related folders
- Contextual awareness: Understands relationships between project files
- Safe operations: Limited scope prevents accidental global changes
- Development-friendly: Integrates with your existing project structure
- π Project Analysis: Understand test structure and dependencies
- π§ͺ Intelligent Test Execution: Run tests based on contextual requirements
- π» Code Generation: Create tests and page objects suited to your project
- βοΈ Configuration Management: Modify project settings intelligently
- π Debugging Assistance: Help identify and resolve project-specific issues
- π Workflow Optimization: Suggest improvements based on project analysis
- π Self-Healing Tests: Automatically retry failed tests with trace and debug information
- Test Pattern Recognition: Identifies your testing patterns and conventions
- Dependency Mapping: Understands relationships between project components
- Configuration Analysis: Reads and interprets your Playwright configuration
- File Structure Awareness: Navigates your project intelligently
- History Tracking: Remembers previous operations and contexts
- β Existing Playwright project
- β Node.js 16 or higher
- β Claude Desktop application
- β This MCP server repository
- Update MCP configuration with your project paths
- Ensure filesystem access includes your Playwright project directory
- Set working directory to this MCP server location
- Add the configuration JSON with your specific paths
- Restart Claude Desktop
- Verify connection to your local project
- Open Claude Desktop
- Begin conversation about your Playwright project
- Use natural language to describe testing needs
- Let the MCP server intelligently manage your project
- β Project-specific context instead of generic web automation
- β Intelligent project understanding rather than basic command execution
- β Safe, scoped operations within your designated project boundaries
- β Development workflow integration tailored to your specific needs
- β Natural language project control through conversational interface
- β Context-aware automation that understands your project's unique characteristics
- β Intelligent suggestions based on project analysis and patterns
- β Seamless integration with existing development tools and workflows
playwright-mcp-local/
βββ index.ts # Main MCP server implementation
βββ package.json # Dependencies and configuration
βββ README.md # This documentation
βββ .git/ # Version control
This MCP server acts as an intelligent bridge between your natural language requests and your local Playwright project, enabling sophisticated project control through conversational interaction.
Once configured, you can control your Playwright project using natural language commands through Claude Desktop. Here are the available operations:
Initialize a new Playwright project with TypeScript
Set up Playwright with JavaScript support
List all available tests in the project
Show me what tests are available
Run the login test
Execute the user registration test suite
Run tests for changed files only
Run tests with HTML reporter
Run tests with custom reporter and filter by grep pattern
Run the login test with self-healing (auto-retry with trace on failure)
Execute tests with JSON reporter
Run tests using 4 parallel workers
Filter and run tests matching "authentication" pattern
Search for "login" in all project files
Find all references to "user authentication"
Show me where "playwright.config" is mentioned
Initialize git repository
Show current git status
Check which branch I'm on
Show recent commit history
Display git configuration
Stage the test file for commit
Add package.json to git
Restore the staged config file
Remove outdated-test.spec.ts from git tracking
Create a new branch called "feature-login-tests"
Switch to the main branch
Commit staged files with message "Add new login tests"
Push current branch to origin
Stash current changes
Apply the most recent stash
Show git configuration
Show diff for all changes in working directory
Show diff for specific file: tests/login.spec.ts
Show git blame for the authentication file
View who last modified each line in the test file
Search for "login" tests, then run them
List all tests, run the ones related to authentication
Show me which files changed, then run tests for those files
Run the checkout test with self-healing enabled
Initialize Playwright with TypeScript, then show available tests
Check git status, stage all test files, and commit with message "Update test suite"
Create a new branch "fix-failing-tests", run all tests, then show results
Run tests with HTML reporter and open the report
Search for "page.click" usage across the project
Find all test files that use "expect"
Show me where configuration files are mentioned
Show me the diff for the config file
Check who last modified the failing test
Run the problematic test with self-healing to capture traces
Show me the diff between current and last commit
Check git blame for the file causing issues
Run tests with JUnit reporter for CI integration
The MCP server understands natural language, so you can phrase commands conversationally:
Playwright Test Commands:
- "Initialize a new Playwright project with TypeScript" β
init-playwright
- "List all available tests in the project" β
list-tests
- "Can you run the login test for me?" β
run-test
- "Run tests only for the files I've recently modified" β
run-tests-changed
- "Execute tests with HTML reporter" β
run-tests-report
- "If the test fails, automatically retry it with trace enabled" β
run-test-selfheal
Search Commands:
- "Search for 'authentication' in all project files" β
search-text-in-file
- "Find where navigation logic is implemented" β
search-text-in-file
Git Repository Commands:
- "Initialize a new git repository" β
git-init
- "Show me the current state of my git repository" β
git-status
- "Which branch am I currently on?" β
git-branch
- "Show me the recent commit history" β
git-log
- "Display my git configuration" β
git-config
Git File Management:
- "Stage my test files for commit" β
git-add
- "Unstage the config file" β
git-restore
- "Remove this file from git tracking" β
git-remove
Git Branching and Commits:
- "Create a new branch called feature-login" β
git-checkout-new
- "Switch to the main branch" β
git-checkout
- "Commit staged files with message 'Add tests'" β
git-commit
- "Push my changes to origin" β
git-push
Git Stash Operations:
- "Stash my current changes" β
git-stash
- "Apply the most recent stash" β
git-stash-pop
Git Code Analysis:
- "What changes did I make to the config file?" β
git-diff
- "Show me who last changed this test file" β
git-blame
- "Show diff for all my working directory changes" β
git-diff
Category | Available Operations |
---|---|
π Playwright | init-playwright , list-tests , run-test , run-tests-changed , run-tests-report , run-test-selfheal |
π Search | search-text-in-file (find text across all project files) |
π¦ Git Basics | git-init , git-status , git-branch , git-log , git-config |
π File Management | git-add , git-restore , git-remove |
πΏ Branching | git-checkout , git-checkout-new , git-push |
πΎ Version Control | git-commit , git-stash , git-stash-pop |
π Code Analysis | git-diff , git-blame |
init-playwright
- Initialize new Playwright project with TypeScript or JavaScriptlist-tests
- Discover and list all tests in the projectrun-test
- Execute a specific test by namerun-tests-changed
- Run tests only for files that have changedrun-tests-report
- Run tests with custom reporters (list, dot, json, junit, html)run-test-selfheal
- Run test with automatic retry using trace/debug on failure
git-init
- Initialize a new Git repositorygit-status
- Show working tree statusgit-branch
- List, create, or delete branchesgit-add
- Stage files for commitgit-restore
- Unstage filesgit-remove
- Remove files from Git trackinggit-commit
- Record changes to the repositorygit-push
- Update remote refsgit-checkout
- Switch branchesgit-checkout-new
- Create and switch to new branchgit-stash
- Stash changes in working directorygit-stash-pop
- Apply stashed changesgit-log
- Show commit logsgit-config
- Get and set repository optionsgit-diff
- Show changes between commits, commit and working tree, etcgit-blame
- Show what revision and author last modified each line of a file
All commands work within the context of your local Playwright project, providing intelligent automation while maintaining full control over your development environment.
This project is open source and available under the MIT License.
Made with β€οΈ for local Playwright project control