Get the FREE Ultimate OpenClaw Setup Guide →

mcp

MCP Server for Behat BDD testing framework

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio behat-mcp-server php /path/to/your/project/vendor/bin/behat-mcp-server

How to use

This MCP server enables AI assistants and MCP-compatible clients to run Behat tests directly against your Behat project. It exposes a transport-based interface (stdio by default, with HTTP as an alternative) that allows clients to send test commands, fetch results, and manage Behat test runs from an external agent. The server is designed for local development and remote usage via HTTP, making it convenient to integrate automated agents, CLIs, or dashboards with your Behat test suite. Tools available include the run-behat-tests utility, which executes Behat scenarios from your project with configurable profiles, suites, and paths.

To use the server, install it in your PHP project and start the MCP server process. If you use stdio transport, the server communicates over standard input/output streams; with HTTP transport, you expose an HTTP API at a host/port you control. You can then configure a client to connect to the server and issue commands such as running Behat tests, selecting configuration files, profiles, suites, and specific feature paths. This enables AI agents to orchestrate Behat test runs as part of larger automation workflows or chat-based test assistance.

How to install

Prerequisites:

  • PHP installed on your system (Behat and the MCP server run on PHP)
  • Composer installed to manage PHP dependencies

Installation steps:

  1. Install the MCP server package via Composer:
composer require behat/mcp-server
  1. Ensure the vendor binaries are available in your project (the executable is typically vendor/bin/behat-mcp-server).

  2. Start the MCP server using the Behat MCP server command. By default, the server runs in stdio mode. Example:

vendor/bin/behat-mcp-server
  1. (Optional) Start with HTTP transport by providing the --transport=http option and configuring host/port as needed:
vendor/bin/behat-mcp-server --transport=http --host=127.0.0.1 --port=8080
  1. If you are integrating via the MCP config, add an mcpServers entry pointing to the PHP command and the path to the behat-mcp-server script, for example in your client configuration:
{
  "mcpServers": {
    "behat": {
      "command": "php",
      "args": ["/path/to/your/project/vendor/bin/behat-mcp-server"]
    }
  }
}

Prerequisites recap: ensure composer install has been run in your project and that PHP CLI can execute vendor/bin/behat-mcp-server from the path specified.

Additional notes

Notes and tips:

  • Windows users: Behat MCP Server may not run due to PHP non-blocking pipe limitations on Windows. Prefer running on Unix-like environments or via HTTP transport in a compatible container.
  • HTTP transport is useful for remote or containerized deployments (e.g., Docker). Ensure network accessibility and proper host/port configuration.
  • If you run the server via stdio, your client tooling should support stdin/stdout IPC. For HTTP, your client should issue proper REST-like requests to the /mcp endpoint exposed by the server.
  • The Behat MCP server requires a Behat project context. Ensure your Behat installation and vendor/bin/behat-mcp-server script are present in your project before starting.
  • When configuring the client, you can specify the Behat configuration file path (config), profile, suite, and paths to features or scenarios, along with additional Behat command-line options as needed.
  • If you encounter permissions or path resolution issues, verify that the PHP CLI user has execute permissions on vendor/bin/behat-mcp-server and that the path to the script is correct in your environment.

Related MCP Servers

Sponsor this space

Reach thousands of developers