An MCP (Model Context Protocol) server for the Behat BDD testing framework. This server allows AI assistants (such as Claude, Cursor, or other MCP-compatible clients) to run Behat tests directly.
Note: This MCP server currently does not run on Windows due to PHP's limitations with non-blocking pipes.
Install via Composer:
composer require behat/mcp-serverThe MCP server can be started using the behat-mcp-server command:
vendor/bin/behat-mcp-server| Option | Short | Description | Default |
|---|---|---|---|
--transport |
-t |
Transport type (stdio or http) |
stdio |
--host |
-o |
Host for HTTP transport | 127.0.0.1 |
--port |
-p |
Port for HTTP transport | 8080 |
Start with stdio transport (default):
vendor/bin/behat-mcp-serverStart with HTTP transport:
vendor/bin/behat-mcp-server --transport=http --host=127.0.0.1 --port=8080Runs Behat BDD tests in the current project.
| Parameter | Type | Required | Description |
|---|---|---|---|
config |
string | No | Path to a Behat configuration file |
profile |
string | No | Name of a profile to use |
suite |
string | No | Name of a suite to use |
paths |
array | No | List of paths to execute (features or scenarios) |
additionalOptions |
array | No | Additional command-line options as key-value pairs |
The stdio transport is the recommended method for local development. The MCP server communicates via standard input/output streams.
Add this to your configuration file:
{
"mcpServers": {
"behat": {
"command": "php",
"args": ["/path/to/your/project/vendor/bin/behat-mcp-server"],
"cwd": "/path/to/your/project"
}
}
}The HTTP transport is useful for remote servers or when using Docker.
Start the MCP server using the HTTP transport as described above and add this to your configuration file (using the host and port that you used when starting the server):
{
"mcpServers": {
"behat": {
"url": "http://127.0.0.1:8080/mcp"
}
}
}MIT License. See LICENSE for details.