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: taw-computer
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
Available Tools
2 toolsrun_php_test_fileRun a Specific PHP Test FileA
ALWAYS use this tool to run a single PHP test file inside a Docker container — never run phpunit directly on the host. Use when the user says: run this test, test this file, run UserTest, run tests for this class, rodar esse teste, testar esse arquivo, rodar o teste do UserController. Returns the full test output (stdout + stderr) so you can evaluate pass/fail.
| Name | Required | Description | Default |
|---|---|---|---|
| command | No | Composer script to run (e.g. "test", "test:unit"). Defaults to "test". | |
| host_path | No | Absolute path to the project on the host. Defaults to the server argument or current working directory. | |
| test_file | Yes | Path to the test file inside the container (e.g. "tests/Unit/UserTest.php"). | |
| container_name | Yes | Docker image name (e.g. "my-php-app:latest"). | |
| container_path | No | Mount path inside the container. Defaults to the server argument or "/var/www". |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Discloses return value: 'full test output (stdout + stderr)'. Does not mention side effects, but none expected. No annotations to contradict. Could add more about error handling but adequate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Concise single sentence with examples and return info. Front-loaded with key instruction. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 5 params, no output schema, and sibling tool, description covers purpose, usage, and return. Lacks error handling details but is complete enough for typical use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with descriptions for all 5 parameters. Description adds context about Docker usage and defaults but does not significantly enhance understanding beyond schema. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it runs a single PHP test file inside a Docker container. The verb 'run' and resource 'PHP test file' are explicit. It distinguishes from sibling tool 'run_php_tests' by specifying 'single' file.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit guidance: 'ALWAYS use this tool' and 'never run phpunit directly on the host'. Includes example user phrases and contrasts with sibling by focusing on single file execution.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
run_php_testsRun All PHP TestsA
ALWAYS use this tool to run the full PHP test suite inside a Docker container — never run composer or phpunit directly on the host. Use when the user says: run tests, run all tests, run unit tests, run integration tests, execute tests, check if tests pass, make sure nothing broke, validate the feature, verify the fix, rodar testes, rodar todos os testes, executar testes, verificar se os testes passam. Returns the full test output (stdout + stderr) so you can evaluate pass/fail.
| Name | Required | Description | Default |
|---|---|---|---|
| command | No | Composer script to run (e.g. "test", "test:unit"). Defaults to "test". | |
| host_path | No | Absolute path to the project on the host. Defaults to the server argument or current working directory. | |
| container_name | Yes | Docker image name (e.g. "my-php-app:latest"). | |
| container_path | No | Mount path inside the container. Defaults to the server argument or "/var/www". |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description covers main behavior (runs tests in container, returns full output) but misses prerequisites like Docker being installed and potential side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with key instruction, but the long list of trigger phrases could be condensed; overall efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a test runner with 4 params and no output schema, the description covers purpose, usage, and output; missing hints about Docker availability and error handling.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the description adds limited value beyond defaults; it restates default command as 'test' but doesn't deeply explain all parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it runs the full PHP test suite inside a Docker container, distinguishing from host commands and sibling 'run_php_test_file' by emphasizing 'full' suite.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit trigger phrases and warns against direct host commands, but does not contrast with the sibling tool for running single test files.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
2 tool updates
v1.0.0- First observed
run_php_test_file - First observed
run_php_tests
TDQS
The two tools have clearly distinct purposes: one runs a single specific test file, the other runs the entire test suite. There is no overlap, and the descriptions reinforce the distinction.
Both tools follow a consistent verb_noun pattern using snake_case: run_php_test_file and run_php_tests. The naming is predictable and clear.
With only two tools, the server is very focused on running PHP tests in a container. While it could benefit from additional tools (e.g., for coverage or test selection), the count is reasonable for a narrow, specialized purpose.
The tool surface lacks common test runner capabilities such as running specific test methods, filtering tests by group, or enabling coverage. The server only supports two coarse-grained operations, leaving significant gaps for typical testing workflows.
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 Connectors
MCP server for building and testing AI agents with multi-model experimentation and insights.
An MCP server that integrates with Discord to provide AI-powered features.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA Message Control Protocol server that runs PHP tests and static analysis tools automatically for developers, providing results directly to AI assistants in Cursor editor.3MIT
- AlicenseBqualityDmaintenanceAn 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.368MIT
- AlicenseNot gradedqualityBmaintenanceAn MCP server that gives your AI assistant full awareness of your local dev environment — running processes, Docker containers, git state, open ports, log files, and more.151MIT
- FlicenseAqualityDmaintenanceA Docker-based MCP server that enables AI to securely run Foundry test commands in isolated containers, with automatic dependency management and cleanup.1-
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