PHPackages                             yoosuf/laravel-mcp-server - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. yoosuf/laravel-mcp-server

ActiveLibrary[API Development](/categories/api)

yoosuf/laravel-mcp-server
=========================

Laravel-native Model Context Protocol server framework for exposing tools, resources, and business operations to AI agents.

v1.0.0(1mo ago)10MITPHPPHP ^8.2CI failing

Since Jul 16Pushed 1mo agoCompare

[ Source](https://github.com/yoosuf/laravel-mcp-server)[ Packagist](https://packagist.org/packages/yoosuf/laravel-mcp-server)[ RSS](/packages/yoosuf-laravel-mcp-server/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (12)Versions (3)Used By (0)

laravel-mcp-server
==================

[](#laravel-mcp-server)

Laravel MCP Framework: expose Laravel tools, resources, and business workflows to AI agents using a Laravel-native developer experience.

> Turn any Laravel application into an AI-native application in minutes.

Features
--------

[](#features)

- MCP runtime manager with discovery and execution APIs.
- HTTP transport with JSON and streaming endpoint support.
- Built-in Eloquent integration to expose models as MCP resources.
- Tool and resource abstractions with JSON schema generation.
- FormRequest and Validator integration for argument validation.
- Laravel authorization integration for per-tool and per-resource checks.
- Tenant context resolver for multi-tenant SaaS workloads.
- Queue-backed async tool execution.
- Security module with API keys, rate limiting, and execution audit logs.
- Operational endpoints for dashboard, agent monitoring, and analytics.
- Artisan generators and operational diagnostics.
- Extension architecture for marketplace-ready MCP packages.

Documentation
-------------

[](#documentation)

- Architecture: docs/architecture.md
- API reference: docs/api-reference.md
- Tools guide: docs/tools.md
- Resources guide: docs/resources.md
- Security guide: docs/security.md
- Testing guide: docs/testing.md
- Use cases: docs/use-cases.md
- End-to-end use cases: docs/use-cases-e2e.md
- Product roadmap: docs/roadmap.md
- Contribution guide: docs/contributing.md

Product Positioning
-------------------

[](#product-positioning)

laravel-mcp-server is positioned as the Laravel MCP Framework for teams that want to make existing Laravel applications AI-native without rewriting core domain logic.

It maps naturally to Laravel patterns:

- Laravel routes -&gt; MCP endpoints
- Laravel controllers/services -&gt; MCP tools
- Laravel resources/models -&gt; MCP resources
- Laravel jobs -&gt; async MCP execution

This lets teams keep business logic in familiar Laravel structures while exposing capabilities to AI agents through MCP.

Roadmap
-------

[](#roadmap)

Phase 1: Foundation
-------------------

[](#phase-1-foundation)

- MCP protocol implementation
- Tools
- Resources
- Authentication

Status:

- Implemented in current release.

Phase 2: Laravel-native Intelligence
------------------------------------

[](#phase-2-laravel-native-intelligence)

- Eloquent auto discovery
- Policies integration
- Events

Status:

- Implemented baseline support with auto-discovery service, policy-aware Eloquent authorization, and extended runtime events.
- Additional auto-discovery depth can continue in minor releases.

Phase 3: Operational Platform
-----------------------------

[](#phase-3-operational-platform)

- Filament dashboard
- Agent monitoring
- Analytics

Status:

- Implemented baseline with MCP operational dashboard, execution monitoring, and analytics endpoints.
- Optional Filament integration endpoint is included and activates when Filament is installed.

Phase 4: Publish-ready maturity
-------------------------------

[](#phase-4-publish-ready-maturity)

- Laravel 11/12/13 support
- Pest tests
- GitHub Actions
- PHPStan level 9
- Documentation website
- Demo application
- Docker environment
- Packagist release

Status:

- In progress.
- Current release includes Laravel 11/12 support, Pest tests, GitHub Actions, and Packagist publication path.
- Laravel 13, PHPStan level 9, documentation website, demo app, and Docker environment are planned upgrades.

Package Design Philosophy
-------------------------

[](#package-design-philosophy)

This package follows Laravel package development guidance:

- clear service provider bootstrapping
- publishable config and migrations
- framework-aligned testing setup
- clean package structure with contracts and abstractions

Building it as a standalone package from the beginning ensures maintainability, upgrade safety, and reusable adoption across multiple Laravel applications.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11.x or 12.x

Installation
------------

[](#installation)

```
composer require yoosuf/laravel-mcp-server
```

Publish config and migrations:

```
php artisan vendor:publish --tag=mcp-config
php artisan vendor:publish --tag=mcp-migrations
php artisan migrate
```

Quick Start
-----------

[](#quick-start)

Register classes in a service provider:

```
use Yoosuf\LaravelMcpServer\Facades\MCP;

MCP::resource(\App\MCP\Resources\CustomerResource::class);
MCP::tool(\App\MCP\Tools\CreateInvoiceTool::class);
MCP::async(\App\MCP\Tools\GenerateReportTool::class);

MCP::tenantResolver(fn () => tenant());
```

Discover MCP metadata:

- GET /.well-known/mcp/discovery

Execute over HTTP:

- POST /.well-known/mcp/execute
- POST /.well-known/mcp/stream

Creating a Tool
---------------

[](#creating-a-tool)

```
php artisan make:mcp-tool CreateInvoiceTool
```

```
class CreateInvoiceTool extends MCPTool
{
    public function name(): string { return 'create_invoice'; }

    public function description(): string { return 'Creates customer invoice'; }

    public function schema(): array
    {
        return [
            'customer_id' => 'integer',
            'items' => 'array',
        ];
    }

    public function rules(): array
    {
        return [
            'customer_id' => ['required', 'integer'],
            'items' => ['required', 'array'],
        ];
    }

    public function authorize(McpContext $context, array $arguments): bool
    {
        return $context->user?->can('create', \App\Models\Invoice::class) ?? false;
    }

    public function execute(array $arguments, McpContext $context): mixed
    {
        // Implement domain operation
    }
}
```

Creating a Resource
-------------------

[](#creating-a-resource)

```
php artisan make:mcp-resource CustomerResource
```

```
class CustomerResource extends MCPResource
{
    public function name(): string { return 'customers'; }

    public function schema(): array
    {
        return [
            'id' => 'integer',
            'name' => 'string',
            'email' => 'string',
        ];
    }

    public function actions(): array
    {
        return ['list', 'find'];
    }
}
```

Security
--------

[](#security)

- Laravel guards (Sanctum, Passport-compatible architecture).
- API key auth via mcp\_api\_keys table and X-MCP-Key header.
- Rate limiting for MCP execution endpoints.
- Per-execution audit logs in mcp\_executions and mcp\_logs.

Multi Tenancy
-------------

[](#multi-tenancy)

Set a global tenant resolver:

```
MCP::tenantResolver(function () {
    return tenant();
});
```

Every execution context includes user\_id, tenant\_id, permissions, and roles.

Artisan Commands
----------------

[](#artisan-commands)

- php artisan make:mcp-tool
- php artisan make:mcp-resource
- php artisan make:mcp-server
- php artisan mcp:list
- php artisan mcp:test
- php artisan mcp:cli
- php artisan mcp:stdio

Eloquent Integration
--------------------

[](#eloquent-integration)

Use the built-in trait on your model:

```
use Yoosuf\LaravelMcpServer\Eloquent\Support\HasMcpExposure;

class Customer extends Model
{
    use HasMcpExposure;
}

Customer::mcp()->allow(['list', 'search', 'find']);
```

Use Cases
---------

[](#use-cases)

- CRM assistants that read customer data and trigger workflows.
- Invoice automation with async report generation.
- Tenant-safe SaaS operations for subscriptions and billing.
- Support desk actions with policy-controlled write operations.
- Internal compliance workflows with audit-friendly execution logs.

See detailed implementation patterns in docs/use-cases.md. For complete operational walkthroughs, see docs/use-cases-e2e.md.

Testing and Quality
-------------------

[](#testing-and-quality)

```
composer lint
composer analyse
composer test
composer coverage
```

Versioning
----------

[](#versioning)

This package follows semantic versioning. Current stable line: 1.x.

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/64164?v=4)[Yoosuf Mo](/maintainers/yoosuf)[@yoosuf](https://github.com/yoosuf)

---

Top Contributors

[![yoosuf](https://avatars.githubusercontent.com/u/64164?v=4)](https://github.com/yoosuf "yoosuf (4 commits)")

---

Tags

ai-agentsapilaravellaravel-packagemcpmodel-context-protocolphpssestdiotool-callinglaravelmcpaiAgenttoolsresources

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yoosuf-laravel-mcp-server/health.svg)

```
[![Health](https://phpackages.com/badges/yoosuf-laravel-mcp-server/health.svg)](https://phpackages.com/packages/yoosuf-laravel-mcp-server)
```

###  Alternatives

[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

80732.6M270](/packages/laravel-mcp)[psalm/plugin-laravel

Psalm plugin for Laravel

3365.5M359](/packages/psalm-plugin-laravel)[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k118.2M1.0k](/packages/laravel-socialite)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k12.6M131](/packages/nuwave-lighthouse)[propaganistas/laravel-disposable-email

Disposable email validator

6093.4M9](/packages/propaganistas-laravel-disposable-email)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
