laravel-dusk-mcp
v1.0.0
Published
MCP server for Laravel Dusk browser testing
Maintainers
Readme
Laravel Dusk MCP Server
A Model Context Protocol (MCP) server that provides browser testing capabilities for Laravel applications through Laravel Dusk. This server allows AI assistants like Claude to run and manage browser tests in any Laravel project.
Features
- Run Laravel Dusk browser tests with various options
- List all available Dusk test files
- Check Dusk environment configuration
- Manage test artifacts (screenshots and logs)
- Install/update ChromeDriver
- Start Laravel development server for testing
- Automatic Laravel project detection and validation
- Support for multiple Laravel projects
Installation
Using npx (no installation required)
You can use the MCP server directly with npx without installing it:
{
"mcpServers": {
"laravel-dusk": {
"command": "npx",
"args": ["laravel-dusk-mcp"]
}
}
}Local Installation
- Clone this repository:
git clone https://github.com/bm2ilabs/laravel-dusk-mcp.git
cd laravel-dusk-mcp- Install dependencies:
npm install- Build the project:
npm run buildGlobal Installation
npm install -g laravel-dusk-mcpUsage
With Claude Desktop
Add the server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Using npx (recommended)
{
"mcpServers": {
"laravel-dusk": {
"command": "npx",
"args": ["laravel-dusk-mcp"],
"env": {
"LARAVEL_PATH": "/path/to/your/laravel/project"
}
}
}
}Using local installation
{
"mcpServers": {
"laravel-dusk": {
"command": "node",
"args": ["/path/to/laravel-dusk-mcp/dist/index.js"],
"env": {
"LARAVEL_PATH": "/path/to/your/laravel/project"
}
}
}
}The LARAVEL_PATH environment variable is optional. If not provided, the server will:
- Check if the current directory is a Laravel project
- Search common locations for Laravel projects
- Allow you to set the project path using the
set_laravel_projecttool
Minimal Configuration
For the simplest setup with npx:
{
"mcpServers": {
"laravel-dusk": {
"command": "npx",
"args": ["laravel-dusk-mcp"]
}
}
}Then use the set_laravel_project tool to specify your Laravel project.
Available Tools
Project Management
set_laravel_project: Set the Laravel project path to work with- Parameters:
path(required): Absolute path to the Laravel project
- Parameters:
list_laravel_projects: List all Laravel projects found on the system- Shows which projects have Dusk installed
Testing Tools
run_dusk_test: Run Laravel Dusk browser tests- Parameters:
test(optional): Specific test file or method to runfilter(optional): Filter tests by name patterngroup(optional): Run tests in a specific groupheadless(optional, default: true): Run tests in headless mode
- Parameters:
list_dusk_tests: List all available Dusk test filescheck_dusk_environment: Verify Dusk environment configuration- Checks for:
- Laravel Dusk installation
- .env.dusk.local file
- ChromeDriver installation
- Browser tests directory
- Checks for:
Maintenance Tools
clear_dusk_screenshots: Clear all Dusk screenshot filesinstall_chrome_driver: Install or update ChromeDriver- Parameters:
version(optional): Specific ChromeDriver version
- Parameters:
start_dev_server: Start Laravel development server for tests- Parameters:
port(optional, default: 8000): Port number
- Parameters:
Resources
The server provides access to test artifacts:
- Screenshots: Access test failure screenshots (image/png)
- Logs: Access Dusk test logs (text/plain)
Development
To run the server in development mode:
npm run devRequirements
- Node.js 16 or higher
- Laravel project with Dusk installed
- Chrome/Chromium browser
- ChromeDriver (can be installed via the server)
Laravel Dusk Setup
If Dusk is not installed in your Laravel project:
- Install Dusk:
composer require laravel/dusk --dev- Install Dusk in your Laravel application:
php artisan dusk:install- Configure your environment:
- Copy
.envto.env.dusk.localfor Dusk-specific settings - Set
APP_URLto match your test server URL
- Copy
Common Issues
ChromeDriver version mismatch: Use the
install_chrome_drivertool to update ChromeDriverTests failing with "Connection refused": Ensure the Laravel development server is running using the
start_dev_servertoolDusk not found: Install Dusk in your Laravel project using Composer
License
MIT
