MCP.so
Sign In
Servers

Laravel MCP Server by OP.GG

@opgginc

A Laravel package for implementing secure Model Context Protocol servers using Streamable HTTP and SSE transport, providing real-time communication and a scalable tool system for enterprise environments.

Overview

What is Laravel MCP Server by OP.GG?

Laravel MCP Server by OP.GG is a package that provides route-based MCP endpoint registration for Laravel and Lumen. It allows developers to build MCP (Model Context Protocol) servers using familiar Laravel routing, with support for tools, resources, resource templates, and prompts over a Streamable HTTP transport.

How to use Laravel MCP Server by OP.GG?

Install via Composer: composer require opgginc/laravel-mcp-server. Register an MCP endpoint using Route::mcp('/mcp') in Laravel or McpRoute::register('/mcp') in Lumen, then chain setServerInfo, tools, and optional methods like enabledApi or dynamicTools. Verify with php artisan route:list | grep mcp and test with php artisan mcp:test-tool --list --endpoint=/mcp or curl.

Key features of Laravel MCP Server by OP.GG

  • Streamable HTTP as the sole transport protocol.
  • Route-first configuration with Route::mcp(...) / McpRoute::register(...).
  • Register tools, resources, resource templates, and prompts per endpoint.
  • Dynamic tool filtering based on query string parameters.
  • Generate MCP tools/resources from Swagger/OpenAPI specs (make:swagger-mcp-tool).
  • Export registered MCP tools to OpenAPI JSON (mcp:export-openapi).
  • Route cache compatible endpoint metadata.

Use cases of Laravel MCP Server by OP.GG

  • Expose a curated set of tools and resources to AI clients via a Laravel-based MCP server.
  • Dynamically adjust available tools based on client-provided query parameters (e.g., game phase).
  • Generate MCP tool classes from existing OpenAPI specs, saving development time.
  • Export MCP tool definitions as OpenAPI documents for external consumption.
  • Build a secure, middleware-protected MCP endpoint (e.g., with auth:sanctum).

FAQ from Laravel MCP Server by OP.GG

What are the runtime requirements?

PHP >= 8.2, Laravel (Illuminate) >= 9.x, or Lumen >= 9.x.

What transport protocol does the server use?

Streamable HTTP is the only supported transport (SSE/legacy transports were removed in v2.0.0).

How can I secure my MCP endpoint?

Apply standard Laravel middleware (e.g., auth:sanctum, throttle:100,1) to the route group containing your Route::mcp(...) call.

How do I migrate from v1.0.0 to v2.0.0?

Configuration moved from config files to route registration, setServerInfo(...) replaces multiple mutators, and transport is now Streamable HTTP only. Run php artisan mcp:migrate-tools and see the migration guide at docs/migrations/v2.0.0-migration.md.

Can I filter which tools a client sees based on URL parameters?

Yes, implement a DynamicToolResolverInterface and attach it to your route with ->dynamicTools(YourResolver::class). The resolver controls both the declared tool catalog and the per-request visible subset.

Tags

More from Other