Tag: Laravel-Boost

  • Mastering the MCP Toolkit: A Laravel Boost Deep Dive

    Mastering the MCP Toolkit: A Laravel Boost Deep Dive

    In our last post, we introduced Laravel Boost and got it installed. We saw how it solves the “context problem” by giving our AI coding assistant a direct line into our application’s environment. Now, it’s time to go deeper.

    The real power behind Boost is the Model Context Protocol (MCP) server and its toolkit. Think of these tools as a set of superpowers you’re giving your AI. Instead of just guessing, it can now inspect, query, and interact with your application in real-time. Understanding these tools is the key to crafting prompts that save you time and solve real-world problems.

    In this deep dive, we’ll explore the most valuable tools in the MCP toolkit by putting them to work in common development scenarios.

    Scenario 1: Debugging Without Leaving Your IDE

    We’ve all been there: you hit an endpoint, get a 500 error, and your next step is to tail the log file in your terminal. With Boost, you can stay right in your editor and let the AI do the detective work.

    Let’s say a user reports an error when trying to update their profile. Your first instinct is to check the logs.

    The Tools: last-error and read-log-entries

    Instead of switching contexts, open your AI chat panel and ask:

    Prompt: “What was the last error recorded in the laravel.log file?”

    The AI will use the last-error tool to fetch the most recent exception. It might show you a MassAssignmentException or a QueryException. From there, you can dig deeper.

    Prompt: “Okay, show me the last 15 entries from the application log to see the full context.”

    Now, the AI uses the read-log-entries tool. You can see the full stack trace and the requests leading up to the error, all within your IDE. This creates a tight, efficient feedback loop for debugging.

    Scenario 2: Database Exploration on the Fly

    Before you write a complex query or build a new feature, you often need to understand the existing data structure. The MCP toolkit turns your AI into a powerful database client.

    Imagine you’re tasked with adding a new “archived” status to a projects table, but you’re not sure of its exact schema.

    The Tools: db-schema and db-query

    Start by asking the AI to inspect the table.

    Prompt: “Show me the schema for the ‘projects’ table, including column types and indexes.”

    The AI uses db-schema to give you a perfect snapshot of the table structure. You see there’s already a status column, but it’s a string. To understand its current usage, you can ask the AI to query the data directly.

    Prompt: “Run a SQL query to show me all the distinct values and their counts from the ‘status’ column in the ‘projects’ table.”

    The AI uses db-query to execute the SQL and returns the result. You see that the existing statuses are ‘active’, ‘pending’, and ‘completed’. Now you have all the information you need to write your migration and update your Eloquent code, without ever leaving your editor to open a separate database client.

    Scenario 3: Finding the Right API, Every Time

    The Laravel framework is vast, and it’s impossible to remember the exact syntax for every feature, especially across different versions. The version-aware documentation search is one of Boost’s most powerful features.

    Let’s say you need to implement a custom rate limiter, but you can’t remember the exact syntax introduced in Laravel 11.

    The Tool: search-docs

    A generic search might give you outdated blog posts. Instead, ask your Boost-powered AI:

    Prompt: “Search the docs for how to create a named rate limiter using a closure in Laravel 12.”

    Because the search-docs tool is connected to the version-specific documentation API, it will retrieve the correct, up-to-date syntax and an official code example. This eliminates the frustrating experience of using deprecated code and ensures you’re always following the latest best practices.

    Scenario 4: Rapid Prototyping with Tinker

    Tinker is an indispensable tool for any Laravel developer. Boost integrates it directly into your AI workflow, making it perfect for testing ideas and creating seed data without writing formal seeders.

    You’re building a feature that relies on an event, PodcastProcessed, and you want to test the listener without going through the entire file upload process.

    The Tool: tinker

    You can simply ask the AI to fire the event for you.

    Prompt: “Using Tinker, create a new User with the name ‘Test User’ and email ‘test@example.com’. Then, dispatch the PodcastProcessed event with this new user.”

    The AI will execute this code within the context of your application. Your event listener will run, your jobs will be dispatched, and you can check the logs or your database to confirm everything worked as expected. It’s a frictionless way to test small, isolated parts of your system.

    Conclusion

    Mastering the MCP toolkit transforms Laravel Boost from a clever code-completion tool into a true development partner. By understanding how to prompt the logdatabasedocumentation, and tinker tools, you can create a more efficient, focused, and powerful workflow.

    Start incorporating these prompts into your daily routine. You’ll be amazed at how much time you save by staying in context and letting your supercharged AI handle the heavy lifting.

  • The Ultimate Guide to Getting Started with Laravel Boost

    The Ultimate Guide to Getting Started with Laravel Boost

    If you’re a developer working with Laravel, you’ve likely felt the thrill of using an AI coding assistant like GitHub Copilot or ChatGPT. You’ve also probably felt the frustration when it generates code that’s almost right. It might use an old, deprecated function, invent a class that doesn’t exist, or completely miss the unique structure of your project. We’ve all been there, trying to prompt our way out of a syntactical dead end.

    This is the “context problem.” General-purpose AI is powerful, but it’s like a brilliant developer who has never seen your codebase. It doesn’t know your specific Laravel version, your database schema, or the exact dependencies you have installed.

    Enter Laravel Boost, the official AI coding starter kit designed to solve this exact issue. It doesn’t aim to replace your favorite AI assistant; it makes it exponentially better. Boost acts as a “context bridge,” giving your AI a real-time, structured understanding of your application, turning it from a generic code generator into an expert assistant with intimate knowledge of your project.


    What is Laravel Boost?

    Announced at Laracon US, Laravel Boost is built on three core pillars that work together to provide comprehensive, real-time context to your AI agent. It’s a free, open-source package that enhances the tools you already use, like those in VS Code, PhpStorm (Junie), and Cursor.

    Let’s break down how it works.

    The Three Pillars of Laravel Boost

    1. The Laravel-Specific MCP Server: At its core, Boost runs a server inside your project that uses the Model Context Protocol (MCP), an open standard for AI-to-tool communication. This server gives the AI over 15 specialized tools to programmatically inspect and interact with your live application. It can check your database schema, list your routes, or even execute code via Tinker to understand the real state of your app.
    2. The Vectorized, Version-Specific Documentation API: Boost connects your AI to a massive knowledge base of over 17,000 documentation entries from the entire Laravel ecosystem (including Livewire, Inertia, Filament, and more). The crucial part is that it’s version-specific. The AI can retrieve documentation that matches the exact versions of the packages in your composer.json file, dramatically reducing errors from outdated or hallucinated code.
    3. The Curated, Laravel-Maintained AI Guidelines: Boost installs a set of instruction files into your project that guide the AI on how to behave. Curated by the Laravel team, these guidelines enforce framework conventions and best practices. They can also prompt the AI to perform value-added tasks it might otherwise skip, like writing a feature test for the code it just generated, which is a massive win for code quality.

    Here’s how these pillars work together to elevate your AI-assisted development experience:

    FeaturePurposePrimary Benefit
    Laravel-Specific MCP ServerTo give AI agents programmatic tools to inspect and interact with the live application state.AI can base its actions on reality (your actual DB schema, routes, config) instead of guessing.
    Vectorized Documentation APITo provide the AI with a searchable knowledge base of version-specific Laravel ecosystem documentation.AI generates code using the correct, up-to-date APIs for your project’s dependencies, reducing errors and hallucinations.
    Curated AI GuidelinesTo instruct the AI on how to behave, enforcing Laravel conventions and best practices.AI-generated code is more idiomatic, follows project style, and includes crucial steps like writing tests, improving overall quality.

    Installation and Configuration

    Getting started with Boost is incredibly simple. It’s a development dependency you can pull in with Composer.

    First, open your terminal in a Laravel project and run the following command:

    composer require laravel/boost --dev

    Next, run the boost:install Artisan command:

    php artisan boost:install

    You’ll be greeted by a smart, interactive installer.

    This installer asks which AI client you use (like Cursor, PhpStorm, etc.) and what guidelines you want to install. This gives you complete control over the setup—it’s not “magic,” it’s smart, transparent configuration.

    You can use the space-bar to select which IDE’s / AI Clients you want to configure and press enter, then it will ask you which AI agents to add the AI guidelines to:

    You are now ready to use Laravel Boost:


    Getting Started: Your First Prompts

    Once Boost is installed, it works seamlessly in the background. Open your IDE’s AI chat panel and start asking questions. The key is to talk to your application through the AI. Instead of asking “How do you create a route in Laravel?”, you can now ask “What routes does this application have?”.

    Here are a few prompts to get you started.

    1. Inspect Your Application’s State

    Try asking the AI for information about your project’s environment. This is a great first test to see if Boost is working.

    Example Prompt:

    “What version of Laravel is this project running and what Eloquent models are available?”

    The AI will use the application-info tool to read your project’s state and give you a precise answer, not a generic one from public training data.

    2. Explore Your Database

    Before writing a single line of code, you can explore your database schema. Assuming you have a users table, try this:

    Example Prompt:

    “Show me the schema for the ‘users’ table, including column types and indexes.”

    Boost’s db-schema tool will fetch and display the exact structure of your table.

    3. Search the Right Documentation

    Struggling to remember the syntax for a specific feature in your version of Laravel? Let the AI find it for you.

    Example Prompt:

    “Search the docs for how to create a custom validation rule in Laravel 12.”

    The AI will use the

    search-docs tool, which is connected to the version-specific documentation API, to provide a relevant and accurate code example.

    When searching the docs for the first time, you AI Agent might ask you for confirmation:

    Upon confirmation it will search the docs:

    4. Debug an Error

    If you run into an error, you don’t have to leave your IDE. You can ask the AI to check the logs for you.

    Example Prompt:

    “What was the last error recorded in the laravel.log file?”

    This uses the last-error tool to pull the latest exception directly from your log file, allowing you to debug right from the chat panel.

    There are many more tools available that will make your AI Agent more context and allow you and your AI agent to be more productive when working in Laravel Projects.


    Deep Dive: The MCP Server Toolkit

    The engine that powers Boost’s interactive capabilities is the MCP server. Here is a comprehensive reference table of the tools it makes available to your AI assistant. Understanding these tools will help you craft even more powerful and precise prompts.

    Tool NameFunction DescriptionExample AI Prompt
    application-infoRead PHP & Laravel versions, packages, models.What version of Laravel is this project running and what Eloquent models are available?
    browser-logsRead logs and errors from the browser.Check the browser logs for any recent errors.
    db-connectionsInspect available database connections.What is the default database connection for this app?
    db-queryExecute a query against the database.Run a SQL query to count the number of users in the users table.
    db-schemaRead the database schema.Show me the schema for the tasks table, including column types and indexes.
    get-absolute-urlConvert relative path URIs to absolute URLs.Generate a full URL for the /dashboard path.
    get-configGet a value from configuration files.What is the value of app.timezone in the config?
    last-errorRead the last error from the application’s log files.What was the last error recorded in the laravel.log file?
    list-artisan-commandsInspect the available Artisan commands.List all available Artisan commands related to the queue.
    list-available-config-keysInspect available configuration keys.What configuration keys are available under the database.connections.mysql namespace?
    list-available-env-varsInspect available environment variable keys.List all the environment variables that start with VITE_.
    list-routesInspect the application’s routes.Show me all the POST routes defined in the application.
    read-log-entriesRead the last N log entries.Read the last 10 entries from the application log.
    report-feedbackShare feedback about Boost with the Laravel team.Give Boost feedback: The search-docs tool was incredibly helpful for finding the new Mail syntax.
    search-docsQuery the version-specific documentation API.Search the docs for how to create a custom validation rule in Laravel 12.
    tinkerExecute arbitrary code within the context of the application via Tinker.Use Tinker to create a new User with the email ‘test@example.com’ and password ‘password’.

    Conclusion and What’s Next

    Laravel Boost fundamentally changes our relationship with AI coding assistants. By solving the context problem, it leads to higher-quality code, fewer frustrating errors, and a dramatically improved developer workflow. Because it’s a free, open-source package, you can start benefiting from it today.

    To get started, check out the official repository on GitHub:

    This is just the beginning of what’s possible. Now that you have Boost installed, the next step is to start integrating it into your daily coding habits. Stay tuned for our next post, where we’ll walk through building a complete feature from start to finish.