VOOZH about

URL: https://deepwiki.com/invokable/laravel-boost-phpstorm-copilot/4.3-mcp-configuration-generation

⇱ MCP Configuration Generation | invokable/laravel-boost-phpstorm-copilot | DeepWiki


Loading...
Last indexed: 28 February 2026 (57ef88)
Menu

MCP Configuration Generation

This page documents the installFileMcp() method and related processes that generate the system-wide mcp.json configuration file. This configuration file enables PhpStorm's GitHub Copilot plugin to communicate with the boost:mcp MCP server.

For platform-specific file writing mechanisms (WSL, PowerShell), see page 5 (Platform-Specific Implementations). For method signatures, see page 8.1 (PhpStormCopilot Class API).


Overview of Configuration Generation

The installFileMcp() method in the PhpStormCopilot class src/PhpStormCopilot.php119-132 orchestrates MCP configuration generation. This method is invoked by the parent Agent class's installation workflow when a user runs php artisan boost:install and selects MCP configuration.

The method performs environment detection, command transformation, and delegates to platform-specific writers.

installFileMcp() Method Flow


Sources: src/PhpStormCopilot.php119-132


Path Resolution Strategy

The useAbsolutePathForMcp() method src/PhpStormCopilot.php29-32 returns true, instructing the parent Agent class to use absolute paths for the PHP binary and artisan script in the generated configuration.

Path Methods

MethodReturn TypeSource
useAbsolutePathForMcp()boolsrc/PhpStormCopilot.php29-32
getPhpPath()stringInherited from Laravel\Boost\Install\Agents\Agent
getArtisanPath()stringInherited from Laravel\Boost\Install\Agents\Agent
base_path()stringLaravel helper function

Path Resolution in Configuration Generation


Sources: src/PhpStormCopilot.php29-32


Configuration Structure

The mcpConfigKey() method src/PhpStormCopilot.php99-102 returns "servers", defining the top-level key in the mcp.json structure.

JSON Structure Generated by installFileMcp()


Standard Configuration Output

For a typical macOS/Linux environment without Sail:


Sources: .github/copilot-instructions.md102-116 src/PhpStormCopilot.php99-102


Command Transformation

The transformSailCommand() method src/PhpStormCopilot.php141-162 handles Laravel Sail command wrapping, while transformMcpCommandForWsl() src/Concerns/WithWSL.php85-128 handles WSL command transformation.

transformSailCommand() Method

Sail Command Detection and Transformation


Transformation Cases

Input CommandInput ArgsMethod CalledOutput CommandOutput Args
/usr/bin/php["artisan", "boost:mcp"]transformSailCommand()/usr/bin/php["artisan", "boost:mcp"]
./vendor/bin/sail["artisan", "boost:mcp"]transformSailCommand()bash["-c", "cd /path && ./vendor/bin/sail artisan boost:mcp"]
./vendor/bin/sail (WSL)["artisan", "boost:mcp"]transformMcpCommandForWsl()wsl.exe["--cd", "/path", "./vendor/bin/sail", "artisan", "boost:mcp"]
/usr/bin/php (WSL)["artisan", "boost:mcp"]transformMcpCommandForWsl()wsl.exe["--cd", "/path", "/usr/bin/php", "artisan", "boost:mcp"]

Sources: src/PhpStormCopilot.php141-162

Sail Configuration Example


Sources: .github/copilot-instructions.md156-170

transformMcpCommandForWsl() Method

The transformMcpCommandForWsl() method src/Concerns/WithWSL.php85-128 wraps commands with wsl.exe for Windows-to-WSL execution.

WSL Command Transformation Logic


Example WSL Configurations

Non-Sail WSL:


Sail WSL:


Sources: src/Concerns/WithWSL.php85-128 .github/copilot-instructions.md120-154


removeEmptyArrays() Method

The removeEmptyArrays() method src/PhpStormCopilot.php168-181 recursively removes empty arrays from the configuration. This prevents compatibility issues with MCP clients that fail when encountering empty array fields.

Recursive Empty Array Removal Algorithm


Example Transformation

Input:


Output after removeEmptyArrays():


Sources: src/PhpStormCopilot.php168-181 .github/copilot-instructions.md117-118


mcpConfigPath() Method

The mcpConfigPath() method src/PhpStormCopilot.php104-114 returns the system-wide path where PhpStorm's GitHub Copilot plugin reads its MCP configuration.

Platform-Specific Path Resolution
































PlatformPath TemplateExample Output
Platform::Darwin$HOME/.config/github-copilot/intellij/mcp.json/Users/dev/.config/github-copilot/intellij/mcp.json
Platform::Linux$HOME/.config/github-copilot/intellij/mcp.json/home/user/.config/github-copilot/intellij/mcp.json
Platform::Windows%LOCALAPPDATA%\github-copilot\intellij\mcp.jsonC:\Users\User\AppData\Local\github-copilot\intellij\mcp.json
WSL (via installMcpViaWsl())wslvar LOCALAPPDATA resultWindows path accessed from WSL

Sources: src/PhpStormCopilot.php104-114 .github/copilot-instructions.md63-66


Complete Generation Flow

The complete flow from php artisan boost:install invocation to mcp.json file creation.

End-to-End Configuration Generation Sequence


Sources: src/PhpStormCopilot.php119-132 src/PhpStormCopilot.php141-162 src/Concerns/WithWSL.php16-76


Method Reference

Key methods involved in MCP configuration generation:

MethodFileLinesReturn TypeDescription
installFileMcp()PhpStormCopilot.php119-132boolMain orchestrator; checks environment, delegates to WSL or standard path
useAbsolutePathForMcp()PhpStormCopilot.php29-32boolReturns true to instruct parent class to use absolute paths
mcpConfigKey()PhpStormCopilot.php99-102stringReturns "servers" as top-level JSON key
mcpConfigPath()PhpStormCopilot.php104-114stringReturns platform-specific system-wide path
transformSailCommand()PhpStormCopilot.php141-162arrayWraps Sail commands in bash -c for proper working directory
removeEmptyArrays()PhpStormCopilot.php168-181arrayRecursively removes empty arrays from config
isRunningInTestbench()PhpStormCopilot.php183-186boolDetects Orchestra Testbench by checking TESTBENCH_CORE constant
isWSL()WithWSL.php11-14boolDetects WSL by checking WSL_DISTRO_NAME environment variable
installMcpViaWsl()WithWSL.php16-76boolWSL-specific installation via PowerShell and wslvar
transformMcpCommandForWsl()WithWSL.php85-128arrayWraps commands with wsl.exe for Windows-to-WSL execution

Sources: src/PhpStormCopilot.php1-187 src/Concerns/WithWSL.php1-130


Testbench Restriction

The installFileMcp() method explicitly rejects execution in Orchestra Testbench environments by checking isRunningInTestbench(), which tests for the TESTBENCH_CORE constant. This restriction exists because Testbench environments lack a proper home directory structure for system-wide MCP configuration.


Sources: src/PhpStormCopilot.php121-123 src/PhpStormCopilot.php183-186 README.md86-88