Laravel Boost Documentation

repository·main·Indexed 25 days ago

https://github.com/laravel/boost

A development tool designed to enhance AI-assisted coding by providing structured context optimized for the Laravel framework. It includes an MCP (Model Context Protocol) server with tools for database interaction, log analysis, and PHP code execution via Tinker, as well as utilities for managing AI guidelines, agent skills, and project rules.

Tokens
2.7K
Snippets
4
Records
26
Agent score
86%

What's inside Laravel Boost

  1. Introduction to Laravel Boost

    main
    Laravel Boost is a tool designed to accelerate AI-assisted development. It provides the necessary context and structure required for AI agents to generate high-quality, Laravel-specific code effectively.
  2. Migrate Custom Agents to Boost 2.x

    main

    Boost 2.x introduces significant terminology and namespace changes for custom agents. CodeEnvironment has been replaced with Agent.

    Terminology Mapping

    Old TermNew Term
    CodeEnvironmentAgent
    CodeEnvironmentsDetectorAgentsDetector
    src/Install/CodeEnvironment/src/Install/Agents/
    Laravel\Boost\Install\CodeEnvironmentLaravel\Boost\Install\Agents
    registerCodeEnvironment()registerAgent()
    getCodeEnvironments()getAgents()

    Contract Renames

    Old ContractNew Contract
    Laravel\Boost\Contracts\AgentLaravel\Boost\Contracts\SupportsGuidelines
    Laravel\Boost\Contracts\McpClientLaravel\Boost\Contracts\SupportsMcp
    Laravel\Boost\Contracts\SupportSkillsLaravel\Boost\Contracts\SupportsSkills

    Implementation Example

    Update your custom agent class to extend the new Agent class and implement the appropriate contracts.

    <?php
    
    namespace Appoost;
    
    use Laravel\Boost\Contracts\SupportsGuidelines;
    use Laravel\Boost\Install\Agents\Agent;
    
    class MyCustomAgent extends Agent implements SupportsGuidelines
    {
        // ...
    }
    
    // If supporting MCP or skills:
    use Laravel\Boost\Contracts\SupportsMcp;
    use Laravel\Boost\Contracts\SupportsSkills;
    
    class MyCustomAgent extends Agent implements SupportsGuidelines, SupportsMcp, SupportsSkills
    {
        // ...
    }
  3. Upgrade Boost from 1.x to 2.x

    main

    If you are not using custom agents or overriding Boost, upgrading to 2.x is straightforward. After upgrading the package, run the installation command to handle migrations automatically.

    Requirements for Boost 2.x:

    • PHP: 8.2 or higher
    • Laravel: 11.x or higher

    If you use external packages that add custom agents, ensure they are updated to versions compatible with Boost 2.x.

    php artisan boost:install
  4. Update Boost Configuration Keys

    main

    If you have overridden configuration options in config/boost.php, you must update the top-level key from code_environment to agents to maintain compatibility with Boost 2.x.

    - config('boost.code_environment.junie.guidelines_path')
    + config('boost.agents.junie.guidelines_path')
  5. Configure MCP tool inclusion and exclusion

    main

    The ToolRegistry manages which Model Context Protocol (MCP) tools are available to the Boost server. You can control tool availability using the boost.mcp.tools configuration keys:

    • boost.mcp.tools.exclude: An array of fully qualified class names (FQCN) to prevent from being discovered in the default Laravel\Boost\Mcp\Tools directory.
    • boost.mcp.tools.include: An array of FQCNs for additional tools located outside the default directory that you want to register.
  6. Configure Laravel Boost MCP Tool inclusion and exclusion

    main

    You can control which MCP tools, resources, or prompts are exposed to the AI client by modifying the boost.mcp configuration. This is useful for enabling or disabling specific capabilities based on your environment or security requirements.

    Use the following configuration keys:

    • boost.mcp.tools.exclude: A list of class names to prevent from being registered as tools.
    • boost.mcp.tools.include: A list of class names to explicitly include as tools.
    • boost.mcp.resources.exclude: A list of class names to prevent from being registered as resources.
    • boost.mcp.resources.include: A list of class names to explicitly include as resources.
    • boost.mcp.prompts.exclude: A list of class names to prevent from being registered as prompts.
    • boost.mcp.prompts.include: A list of class names to explicitly include as prompts.
  7. Use the updated boost:install command flags

    main

    The boost:install command flags in Boost 2.x have changed from negative opt-out flags to positive opt-in flags. Use the following flags to include specific features during installation:

    php artisan boost:install {--guidelines} {--skills} {--mcp}
  8. Validate or reset the boost.json configuration file

    main

    The Config class provides utility methods to maintain the integrity of the boost.json file:

    • isValid(): Returns true if the boost.json file exists in the base path and contains valid JSON.
    • flush(): Deletes the boost.json file from the application base path.
  9. Access application information via MCP resource

    main

    The Model Context Protocol (MCP) server provides a resource that contains comprehensive application metadata. This resource can be requested to retrieve details such as the PHP version, Laravel version, database engine, and a list of all installed packages with their respective versions.

    • URI: file://instructions/application-info.md
    • MIME Type: text/markdown
    • Content Format: JSON (containing the parsed application metadata)
  10. Manage Boost configuration via the Config class

    main
    The Laravel\Boost\Support\Config class manages project settings stored in a boost.json file located at the application's base path. You can use this class to programmatically get and set various configuration flags and arrays related to guidelines, skills, MCP, and environment tools like Sail or Cloud.