-
Notifications
You must be signed in to change notification settings - Fork 190
[1.x] Sail Support for Boost #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.x] Sail Support for Boost #303
Conversation
This commit adds automatic detection of Laravel Sail environments and configures the MCP server to use Sail when detected, ensuring the server runs inside the Docker container with the correct PHP version and environment. Changes: - Add isSailProject() method to detect Sail by checking for vendor/bin/sail and docker-compose.yml - Modify getPhpPath() to return './vendor/bin/sail' when Sail is detected - Modify getArtisanPath() to return 'artisan' when Sail is detected - Add fileExists() helper method for testability - Add 5 unit tests for Sail detection logic - Add 4 integration tests for real-world scenarios The detection is automatic and transparent - projects without Sail continue to work exactly as before using 'php artisan boost:mcp'. Fixes automatic configuration for Sail users running boost:install and boost:update commands.
Add comprehensive documentation for automatic Sail detection: - Add installation note for Sail users - Add dedicated 'Laravel Sail Support' section - Document automatic detection criteria - Provide configuration examples - Explain benefits of running MCP server inside Docker container
Following code review feedback from @pushpak1300, removed the unnecessary fileExists() wrapper method and use file_exists() directly in isSailProject(). Also removed 3 unit tests that were specifically testing the fileExists() wrapper - the Sail detection is already covered by the integration tests in SailDetectionTest.php. Changes: - Remove fileExists() wrapper method - Use file_exists() directly in isSailProject() - Remove 3 redundant unit tests for fileExists() mocking - Integration tests still passing (6 tests, 10 assertions)
|
Hi @MltStephane! The MCP server needs to be configured with relative paths, not absolute paths. Instead of: Use: The MCP server runs from your project root, so relative paths work correctly. |
I tried both, but the relative path still throws an error.
|
PhpStorm doesn't support symlinks in MCP configuration paths. When useAbsolutePathForMcp is true (PhpStorm), use the real Sail executable path instead of the symlink. Changes: - Detect when absolute paths are needed (PhpStorm/forceAbsolutePath) - Use 'vendor/laravel/sail/bin/sail' for PhpStorm - Keep './vendor/bin/sail' for other IDEs (Claude Code, Cursor, VS Code) This fixes the MCP server startup issue reported by @MltStephane
This file was only needed locally for creating the PR. Not required in the repository.
Hi @MltStephane! I've fixed the PhpStorm symlink issue in cc1f068. PhpStorm now uses the real Sail executable path ( Can you pull the latest changes and try again? It should work now. Thanks for testing! |
The problem is PhpStorm needs to know which folder to run from. Try adding {
"mcpServers": {
"Laravel-boost": {
"command": "/home/stephane/Projets/my-app/vendor/laravel/sail/bin/sail",
"args": ["artisan", "boost:mcp"],
"cwd": "/home/stephane/Projets/my-app"
}
}
}Just replace /home/stephane/Projets/my-app with your actual project path on your computer (not the Docker path /var/www/html). Let me know if that works! |
|
Still not working... No error, but the message "Not started" is displayed in Php Storm. |
|
I made it work with the configuration from here : #36 (comment) {
"mcpServers": {
"laravel-boost": {
"command": "docker",
"args": [
"exec",
"-i",
"<container_name>",
"php",
"/var/www/html/artisan",
"boost:mcp"
]
}
}
}Edit: I'm now using this configuration, which tries to use the laravel.test container without specifying the name. {
"mcpServers": {
"laravel-boost": {
"command": "bash",
"args": [
"-lc",
"docker exec -i \"$(docker ps -q --filter label=com.docker.compose.service=laravel.test | head -n1)\" php /var/www/html/artisan boost:mcp"
]
}
}
} |
…ection
This commit enhances Laravel Sail support for PhpStorm and adds compatibility
with the modern compose.yaml format.
## Changes
### PhpStorm Docker Exec Integration
- PhpStorm now uses `docker exec` instead of `./vendor/bin/sail` for better compatibility
- Generates bash command that finds the running Sail container dynamically
- Ensures MCP server runs inside the correct Docker container
### Compose.yaml Support
- Updated Sail detection to support both `docker-compose.yml` (legacy) and `compose.yaml` (current)
- Full compatibility with Laravel Sail's latest versions
- Maintains backward compatibility with older Sail installations
### MCP Server Preservation
- Added test to verify existing custom MCP servers are preserved
- FileWriter correctly merges new laravel-boost server with user's existing configuration
- Documentation updated to show preservation behavior
### Documentation
- Added PhpStorm-specific configuration example
- Documented difference between PhpStorm and other IDEs
- Added examples showing custom MCP server preservation
- Clear explanation of automatic vs manual configuration
### Tests
- 8/8 Sail detection tests passing
- 45/45 FileWriter tests passing (including new preservation test)
- 313/315 total tests passing (2 PDO failures unrelated to changes)
## Generated Configuration
**PhpStorm with Sail:**
```json
{
"command": "bash",
"args": ["-lc", "docker exec -i \"$(docker ps -q ...)\" php .../artisan boost:mcp"]
}
```
**Other IDEs with Sail:**
```json
{
"command": "./vendor/bin/sail",
"args": ["artisan", "boost:mcp"]
}
```
|
@MltStephane Already updated the PR with that solution. Now it automatically detects Sail and generates the config with docker exec for PhpStorm (and also supports compose.yaml in addition to docker-compose.yml). |
|
I tried this config on PHPStrom with Junie and ai-assitant and it worked. @MltStephane is it not working for you ? Update: |
|
None of these configurations are working for me (Ubuntu 25.04 / PhpStorm 2025.2.3 / Laravel Sail 1.46.0). Are you on Ubuntu ? |
Sadly, not. Very tricky situation to be in. Let me see if I can test on ubuntu any way. |
|
Feel free to reach out if you need any additional tests or data from me. |
|
@MltStephane I just verefied this with the I think we will go and implement with this config only and no docker exec is needed. @NIAN97 |
Did you try on 24 or 25? I just tested on a third laptop running Ubuntu 24, and it works. The others are on 25 and still don’t work. I’d really like to understand the root cause to avoid issues for future users. Should we continue this in an issue? |
|
Yes I tried with ubuntu 24 + PhpStorm 2025.2.4 |
|
Ok, so probably the issue is due to an incompatibility of a tool (which one ?) on Ubuntu 25 |
Two of us recently faced quite a few bugs and issues with Ubuntu 25 (not related to this), but the point is as Ubutnu 25 is not an LTS, there is a high probabilty of compatibility issues. Would recommend to try with 24.04 LTS |
|
@pushpak1300 so should I keep this configuration? {
"mcpServers": {
"laravel-boost": {
"command": "./vendor/bin/sail",
"args": [
"artisan",
"boost:mcp"
]
}
}
} |
Signed-off-by: Pushpak Chhajed <[email protected]>
Signed-off-by: Pushpak Chhajed <[email protected]>
Signed-off-by: Pushpak Chhajed <[email protected]>
|
I made a few adjustments here.
For now, I am keeping the configuration as it is until we run into more constraints: {
"mcpServers": {
"laravel-boost": {
"command": "./vendor/bin/sail",
"args": [
"artisan",
"boost:mcp"
]
}
}
}Demo: https://www.loom.com/share/76618c48aad54259a834fcee381cf092 |
|
@pushpak1300 issue in |
The filter() method passes both value and key to the callback, but is_dir() only accepts one argument. This was causing an ArgumentCountError when running boost:install. Changed from is_dir(...) to explicit closure: fn (string $path): bool => is_dir($path)
Signed-off-by: Pushpak Chhajed <[email protected]>
Signed-off-by: Pushpak Chhajed <[email protected]>
Signed-off-by: Pushpak Chhajed <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some formatting and method name adjustments.






Add Automatic Laravel Sail Detection for MCP Server Configuration
Summary
This PR adds automatic detection of Laravel Sail environments and configures the MCP server to use Sail when detected. This ensures the MCP server runs inside the Docker container with the correct PHP version and environment, rather than using the host machine's PHP installation.
Motivation
Currently, users running Laravel Boost in Sail projects must manually configure the MCP server to use
./vendor/bin/sailinstead ofphp. This PR makes the detection automatic, improving the developer experience for Sail users.Problem
When Sail users run
php artisan boost:installorphp artisan boost:update, the generated MCP configuration uses:{ "mcpServers": { "laravel-boost": { "command": "php", "args": ["artisan", "boost:mcp"] } } }This runs the MCP server on the host machine, which may have:
Solution
With this PR, Sail projects automatically get:
{ "mcpServers": { "laravel-boost": { "command": "./vendor/bin/sail", "args": ["artisan", "boost:mcp"] } } }EDIT
Updated Changes #303 (comment)