PHPackages                             organiseyou/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. organiseyou/mcp-server

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

organiseyou/mcp-server
======================

Drop-in MCP (Model Context Protocol) server for Laravel applications

01PHPCI passing

Since Apr 30Pushed 1mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel MCP
===========

[](#laravel-mcp)

A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for Laravel built around **runtime tool registration**. Tools are registered programmatically at request time rather than declared upfront as static classes, making this package the right choice when your tool surface is dynamic — multi-tenant platforms, schema-driven APIs, feature-flagged environments, or anything else where you don't know your tools at boot time.

If your tools are static and known at boot time, [laravel/mcp](https://laravel.com/ai/mcp) (the official first-party package) is likely the better fit.

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

[](#requirements)

- PHP 8.2+
- Laravel 11+

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

[](#installation)

```
composer require organiseyou/mcp-server
```

The service provider and `Mcp` facade are registered automatically via Laravel's package discovery.

Publish the config file:

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

Configuration
-------------

[](#configuration)

`config/mcp.php`:

```
return [
    'server' => [
        'name'    => env('APP_NAME', 'Laravel'),
        'version' => '1.0.0',
    ],

    'transport' => [
        'http'            => true,   // expose POST /mcp
        'http_path'       => '/mcp',
        'http_middleware' => [],     // e.g. ['auth:sanctum']
    ],

    'tools' => [
        // App\Mcp\Tools\StaticTool::class,
    ],
];
```

Registering Tools
-----------------

[](#registering-tools)

### Inline via the Mcp facade (dynamic)

[](#inline-via-the-mcp-facade-dynamic)

Register tools anywhere that runs before the request is handled — a service provider, middleware, or a tenant boot hook:

```
use OrganiseYou\McpServer\Facades\Mcp;

// Single tool
Mcp::tool('add_numbers')
    ->description('Add two numbers together and return the sum.')
    ->inputSchema([
        'type'       => 'object',
        'properties' => [
            'a' => ['type' => 'number', 'description' => 'First operand.'],
            'b' => ['type' => 'number', 'description' => 'Second operand.'],
        ],
        'required' => ['a', 'b'],
    ])
    ->handle(fn (array $input) => $input['a'] + $input['b']);
```

A multi-tenant example where tools are generated from tenant configuration:

```
// In a tenant boot hook or middleware
foreach ($tenant->enabledDataSources() as $source) {
    Mcp::tool("query_{$source->slug}")
        ->description("Query the {$source->name} dataset. " . $source->description)
        ->inputSchema($source->buildInputSchema())
        ->handle(fn (array $input) => $source->query($input));
}
```

### Class-based tools (static)

[](#class-based-tools-static)

For tools that are the same across all tenants or contexts, implement `OrganiseYou\McpServer\Contracts\McpTool` and register the class in `config/mcp.php`:

```
