laravel-mcp-server  by opgginc

Laravel package for secure Model Context Protocol servers

created 3 months ago
285 stars

Top 91.9% on SourcePulse

GitHubView on GitHub
Project Summary

This package provides a Laravel implementation for Model Context Protocol (MCP) servers, focusing on secure Streamable HTTP transport for real-time communication between LLM clients and enterprise applications. It offers a robust alternative to traditional STDIO transport, enhancing security and control over API exposure.

How It Works

The package leverages Streamable HTTP for communication, allowing LLM clients to interact with defined "tools" (PHP classes implementing ToolInterface). This approach contrasts with STDIO, offering better security by avoiding direct exposure of internal system details. Tools define their input schemas, descriptions, and execution logic, enabling structured and validated interactions. It also supports a legacy SSE provider for backward compatibility.

Quick Start & Requirements

  • Install via Composer: composer require opgginc/laravel-mcp-server
  • Publish config: php artisan vendor:publish --provider="OPGG\LaravelMcpServer\LaravelMcpServerServiceProvider"
  • Requirements: PHP >= 8.2, Laravel >= 10.x
  • For SSE or Inspector: Requires a production-grade server like Laravel Octane with FrankenPHP, Nginx, or Apache. php artisan serve is not supported.

Highlighted Details

  • Prioritizes Streamable HTTP transport over STDIO for enhanced enterprise security.
  • Includes Artisan commands for generating tools (make:mcp-tool), migrating tools (mcp:migrate-tools), and testing tools (mcp:test-tool).
  • Supports defining reusable prompts and exposing resources (data) via URIs.
  • Offers domain restriction for MCP server routes.
  • The ToolInterface has undergone significant changes, with messageType() deprecated in favor of isStreaming().

Maintenance & Community

The project is maintained by OP.GG. The README includes detailed migration guides for breaking changes and deprecations, indicating active development and version management.

Licensing & Compatibility

Distributed under the MIT license, allowing for commercial use and integration with closed-source applications.

Limitations & Caveats

The legacy SSE provider is not compatible with php artisan serve and requires specific server configurations. The messageType() method in ToolInterface is deprecated and will be removed in v2.0.0, necessitating updates to existing tools.

Health Check
Last commit

1 week ago

Responsiveness

1 week

Pull Requests (30d)
5
Issues (30d)
3
Star History
167 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.