php-container-test-mcp
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., "@php-container-test-mcpRun the tests for my-php-app:latest container."
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.
php-container-test-mcp
An MCP (Model Context Protocol) server that lets AI agents run PHP unit and integration tests inside Docker containers — no local PHP or Composer installation required on the host.
What it does
Exposes two MCP tools:
run_php_tests— runs the full test suiterun_php_test_file— runs a single test file
Both execute docker run --rm -v <host_path>:<container_path> -w <container_path> <image> composer <command> [-- <test_file>] and return the full stdout + stderr so the caller can evaluate pass/fail.
Related MCP server: Arthur
Prerequisites
Node.js ≥ 18
Docker installed and running on the host
A Docker image that includes PHP, Composer, and a Composer script for running tests (e.g.
phpunit,pest)
Example composer.json scripts section inside your PHP image
"scripts": {
"test": "vendor/bin/phpunit",
"test:unit": "vendor/bin/phpunit --testsuite unit",
"test:integration": "vendor/bin/phpunit --testsuite integration"
}Installation
Via npm (recommended)
npm install -g php-container-test-mcpFrom source
git clone https://github.com/your-user/php-container-test-mcp
cd php-container-test-mcp
npm installRegistering with Claude Code
Add the server to your project's .mcp.json for project-scoped access, or to ~/.claude/claude_desktop_config.json for global access.
The server accepts named arguments to configure defaults. All three can also be overridden per tool call.
Argument | Description | Default |
| Docker image name | (required) |
| Composer script name to execute |
|
| Host project path to mount | current working directory |
| Mount path inside the container |
|
Using the npm package (after npm install -g)
{
"mcpServers": {
"php-container-test": {
"command": "php-container-test-mcp",
"args": ["--container=my-php-app:latest", "--command=test", "--host-path=/home/user/my-project", "--container-path=/var/www"]
}
}
}Using npx (no install required)
{
"mcpServers": {
"php-container-test": {
"command": "npx",
"args": ["-y", "php-container-test-mcp", "--container=my-php-app:latest", "--command=test", "--host-path=/home/user/my-project", "--container-path=/var/www"]
}
}
}From source (local path)
{
"mcpServers": {
"php-container-test": {
"command": "node",
"args": ["/absolute/path/to/php-container-test-mcp/src/index.js", "--container=my-php-app:latest", "--command=test", "--host-path=/home/user/my-project", "--container-path=/var/www"]
}
}
}Then restart Claude Code. The run_php_tests and run_php_test_file tools will be available automatically.
Tool reference
run_php_tests — run the full test suite
Parameter | Type | Required | Default | Description |
| string | Yes | server arg | Docker image to run (e.g. |
| string | No |
| Composer script name to execute |
| string | No | server arg or cwd | Absolute path to the project on the host to mount into the container |
| string | No | server arg or | Path inside the container where the project will be mounted |
run_php_test_file — run a single test file
Parameter | Type | Required | Default | Description |
| string | Yes | server arg | Docker image to run (e.g. |
| string | Yes | — | Path to the test file inside the container (e.g. |
| string | No |
| Composer script name to execute |
| string | No | server arg or cwd | Absolute path to the project on the host to mount into the container |
| string | No | server arg or | Path inside the container where the project will be mounted |
Example prompts
Run all tests:
Run the tests for the my-php-app:latest container.Run only unit tests using a specific Composer script:
Run only the unit tests using the test:unit script for container my-php-app:latest.Run a single test file:
Run tests/Unit/UserTest.php in the my-php-app:latest container.Override mount paths:
Run the tests for my-php-app:latest, mounting /home/user/my-project on the host to /app inside the container.Example tool calls
run_php_tests — full suite with defaults:
{
"container_name": "my-php-app:latest"
}run_php_tests — specific Composer script:
{
"container_name": "my-php-app:latest",
"command": "test:unit"
}run_php_test_file — single test file:
{
"container_name": "my-php-app:latest",
"test_file": "tests/Unit/UserTest.php"
}run_php_tests — override mount paths:
{
"container_name": "my-php-app:latest",
"host_path": "/home/user/my-project",
"container_path": "/app"
}How it works
The server is launched by the MCP host (Claude Code) and communicates over stdin/stdout using the JSON-RPC 2.0 MCP protocol.
When a tool is called, the server executes:
docker run --rm -v <host_path>:<container_path> -w <container_path> <image> composer <command> [-- <test_file>]--rmensures the container is automatically removed after each run.The combined stdout + stderr is returned to the calling agent.
Troubleshooting
Problem | Solution |
| Ensure Docker is installed and in |
| Pull the image first: |
| Add a |
No output returned | The container may have exited immediately — check the image entrypoint |
Tests time out for large suites | The server uses a 10 MB output buffer; the process itself has no hard timeout — Docker will run until the suite finishes |
License
MIT
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 Servers
- Alicense-qualityFmaintenanceA Message Control Protocol server that runs PHP tests and static analysis tools automatically for developers, providing results directly to AI assistants in Cursor editor.Last updated3MIT
- -license-quality-maintenanceAn MCP server that enables developers to summon AI development team agents directly from their IDE to help with tasks like PR reviews, security evaluation, and CI/CD deployment setup.Last updated
- AlicenseBqualityCmaintenanceAn MCP server that provides AI agents with a full Ubuntu desktop environment inside Docker, enabling them to perform complex computer tasks like browsing, coding, testing, and GUI automation.Last updated368MIT
- AlicenseBqualityCmaintenanceEnables AI assistants to deeply interact with the PHP ecosystem, including runtime, static analysis, security scanning, testing, Composer, and frameworks like Laravel and Symfony. It exposes over 30 tools, 8 resources, and 7 prompts via MCP, allowing natural language commands to run PHP linting, static analysis, audits, tests, and project initialization.Last updated41MIT
Related MCP Connectors
An MCP server that integrates with Discord to provide AI-powered features.
An MCP server that gives your AI access to the source code and docs of all public github repos
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
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/GleisonOliveira/php-container-test-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server