Download the PHP package php-mcp/laravel without Composer

On this page you can find all versions of the php package php-mcp/laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel

Laravel MCP Server SDK

Latest Version on Packagist Total Downloads

A comprehensive Laravel SDK for building Model Context Protocol (MCP) servers with enterprise-grade features and Laravel-native integrations.

This SDK provides a Laravel-optimized wrapper for the powerful php-mcp/server library, enabling you to expose your Laravel application's functionality as standardized MCP Tools, Resources, Prompts, and Resource Templates for AI assistants like Anthropic's Claude, Cursor IDE, OpenAI's ChatGPT, and others.

Key Features

This package supports the 2025-03-26 version of the Model Context Protocol.

Requirements

Installation

Install the package via Composer:

Publish the configuration file:

For database session storage, publish the migration:

Configuration

All MCP server settings are managed through config/mcp.php, which contains comprehensive documentation for each option. The configuration covers server identity, capabilities, discovery settings, session management, transport options, caching, and logging. All settings support environment variables for easy deployment management.

Key configuration areas include:

Review the published config/mcp.php file for detailed documentation of all available options and their environment variable overrides.

Defining MCP Elements

Laravel MCP provides two powerful approaches for defining MCP elements: Manual Registration (using the fluent Mcp facade) and Attribute-Based Discovery (using PHP 8 attributes). Both can be combined, with manual registrations taking precedence.

Element Types

1. Manual Registration

Define your MCP elements using the elegant Mcp facade in routes/mcp.php:

Available Fluent Methods:

For All Elements:

For Resources:

Handler Formats:

2. Attribute-Based Discovery

Alternatively, you can use PHP 8 attributes to mark your methods or classes as MCP elements, in which case, you don't have to register them in them routes/mcp.php:

Discovery Process:

Elements marked with attributes are automatically discovered when:

Element Precedence

Running the MCP Server

Laravel MCP offers three transport options, each optimized for different deployment scenarios:

1. STDIO Transport

Best for: Direct client execution, Cursor IDE, command-line tools

Client Configuration (Cursor IDE):

⚠️ Important: When using STDIO transport, never write to STDOUT in your handlers (use Laravel's logger or STDERR for debugging). STDOUT is reserved for JSON-RPC communication.

2. Integrated HTTP Transport

Best for: Development, applications with existing web servers, quick setup

The integrated transport serves MCP through your Laravel application's routes:

CSRF Protection Configuration:

Add the MCP routes to your CSRF exclusions:

Laravel 11+:

Laravel 10 and below:

Configuration Options:

Client Configuration:

Server Environment Considerations:

Standard synchronous servers struggle with persistent SSE connections, as each active connection ties up a worker process. This affects both development and production environments.

For Development:

For Production:

3. Dedicated HTTP Server (Recommended for Production)

Best for: Production environments, high-traffic applications, multiple concurrent clients

Launch a standalone ReactPHP-based HTTP server:

Configuration Options:

Transport Modes:

JSON Response Mode:

Production Deployment:

This creates a long-running process that should be managed with:

Example Supervisor configuration:

For comprehensive production deployment guides, see the php-mcp/server documentation.

Artisan Commands

Laravel MCP includes several Artisan commands for managing your MCP server:

Discovery Command

Discover and cache MCP elements from your codebase:

Output Example:

List Command

View registered MCP elements:

Output Example:

Serve Command

Start the MCP server with various transport options:

Command Options:

Dynamic Updates & Events

Laravel MCP integrates with Laravel's event system to provide real-time updates to connected clients:

List Change Events

Notify clients when your available elements change:

Resource Update Events

Notify clients when specific resource content changes:

Advanced Features

Schema Validation

The server automatically generates JSON schemas for tool parameters from PHP type hints and docblocks. You can enhance this with the #[Schema] attribute for advanced validation:

Schema Features:

For comprehensive schema documentation and advanced features, see the php-mcp/server Schema documentation.

Completion Providers

Provide auto-completion suggestions for resource template variables and prompt arguments to help users discover available options:

Completion Features:

For detailed completion provider documentation, see the php-mcp/server Completion documentation.

Dependency Injection

Your MCP handlers automatically benefit from Laravel's service container:

Exception Handling

Tool handlers can throw exceptions that are automatically converted to proper JSON-RPC error responses:

Logging and Debugging

Configure comprehensive logging for your MCP server:

Create a dedicated log channel in config/logging.php:

Migration Guide

From v2.x to v3.x

Configuration Changes:

Session Configuration:

Transport Updates:

Breaking Changes:

Examples & Use Cases

E-commerce Integration

Content Management

API Integration

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Development Setup

License

The MIT License (MIT). See LICENSE for details.

Acknowledgments


All versions of laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^9.46 || ^10.34 || ^11.29 || ^12.0
php-mcp/server Version ^3.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package php-mcp/laravel contains the following files

Loading the files please wait ....