Download the PHP package laravelmcp/mcp without Composer
On this page you can find all versions of the php package laravelmcp/mcp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravelmcp/mcp
More information about laravelmcp/mcp
Files in laravelmcp/mcp
Package mcp
Short Description Laravel implementation of the Model Context Protocol (MCP) SDK
License MIT
Homepage https://github.com/laravelmcp/mcp
Informations about the package mcp
Laravel MCP
A Laravel package for implementing the Model Context Protocol (MCP) in Laravel applications. This protocol facilitates communication between AI models and Laravel applications through standardized interfaces.
Requirements
System Requirements
- PHP 8.1 or higher
- Laravel 10.x
- Composer 2.x
- OpenSSL PHP Extension
- PDO PHP Extension
- Mbstring PHP Extension
- XML PHP Extension
- Ctype PHP Extension
- JSON PHP Extension
- ReactPHP (for HTTP/WebSocket transport)
- ext-json (for JSON handling)
Optional Requirements
- Redis (for WebSocket scaling)
- Supervisor (for process management)
- ext-pcntl (for signal handling)
- ext-posix (for process management)
Features
-
Multiple Transport Options
- HTTP Transport (RESTful API)
- WebSocket Transport (Real-time)
- Stdio Transport (Command-line)
- Configurable host and port settings
-
Server Capabilities
- Tool registration and execution
- Resource management
- Prompt handling
- Progress tracking
- Logging system
- Model preferences configuration
-
Tool System
- Register custom tools with parameters
- Handle tool calls with arguments
- Return structured responses
- Error handling and validation
-
Resource Management
- URI-based resource access
- Resource templates
- Dynamic resource handling
- Content type support
-
Prompt System
- Template-based prompts
- Dynamic argument handling
- Context management
- Message history support
-
Progress Tracking
- Real-time progress updates
- Token-based tracking
- Total progress support
- Client notification system
- Logging System
- Multiple log levels
- Logger identification
- Structured logging
- Transport-agnostic logging
Documentation
The project includes comprehensive PHPDoc documentation for all classes and methods. The documentation is available directly in the source code and covers:
Core Components
-
Server Capabilities (
src/Capabilities/ServerCapabilities.php
)- Server feature management
- Experimental features configuration
- Logging configuration
- Component capabilities (prompts, resources, tools)
- Client Capabilities (
src/Capabilities/ClientCapabilities.php
)- Feature flag management
- Root directory configuration
- State serialization/deserialization
Component Capabilities
-
Tools Capability (
src/Capabilities/ToolsCapability.php
)- Tool list change tracking
- State management
- Change notification support
-
Resources Capability (
src/Capabilities/ResourcesCapability.php
)- Resource subscription management
- Change tracking
- State serialization
-
Prompts Capability (
src/Capabilities/PromptsCapability.php
)- Prompt list change tracking
- State management
- Change notifications
- Roots Capability (
src/Capabilities/RootsCapability.php
)- Root directory management
- Directory configuration
- Access control settings
Server Management
- MCP Server Command (
src/Commands/MCPServerCommand.php
)- Server startup configuration
- Transport selection
- Signal handling
- Graceful shutdown
Each component includes:
- Detailed class descriptions
- Feature lists and capabilities
- Configuration examples
- Usage examples
- Method documentation
- Parameter descriptions
- Return value documentation
To explore the documentation:
- Browse the source files in the
src/
directory - Use your IDE's PHPDoc integration
- Generate HTML documentation using phpDocumentor (optional)
To generate HTML documentation:
Installation
Install via Composer:
The package will automatically register its service provider and facade.
Configuration
-
Publish the configuration:
- Configure environment variables:
Basic Usage
Starting the Server
Server Setup
Using Different Transports
Registering Tools
Managing Resources
Handling Prompts
Progress and Logging
Model Preferences
Error Handling
Fun with LLMs: Building a Code Review Assistant
Here's a complete example of building a code review assistant that can analyze code, suggest improvements, and even fix bugs:
{$args['language']}\n{$args['code']}\n
This example demonstrates:
- Tool registration with complexity analysis
- Custom prompt templates with personality
- Resource management for review history
- Progress tracking with fun messages
- Error handling with humor
- Integration of multiple MCP features
- Real-world code improvement workflow
Testing
Run the test suite:
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
All versions of mcp with dependencies
cboden/ratchet Version ^0.4.4
guzzlehttp/guzzle Version ^7.0
illuminate/support Version ^10.0
react/http Version ^1.9
react/socket Version ^1.12