Laravel MCP(模型上下文协议) logo

Laravel MCP(模型上下文协议)

Organization
InnoGE

A package for developing MCP Servers with Laravel.

PublisherInnoGE
Repositorylaravel-mcp
LanguagePHP
Forks
2
Stars
17
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Laravel MCP(模型上下文协议) exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    17 stars and 2 forks from the linked repository.

Laravel MCP (Model Context Protocol)

[!WARNING] This package is no longer maintained.

It was a proof of concept and is not developed further. It is now 100% replaced by the official laravel/mcp package. Please use that instead.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel package that implements the Model Context Protocol (MCP), enabling seamless communication between your Laravel application and AI assistants or other systems through a standardized API. Please note that this package is still in development and not yet ready for production use.

Installation

You can install the package via composer:

bash
composer require innoge/laravel-mcp

Basic Usage

Setting Up an MCP Server

This package currently only supports creating MCP servers via the STDIO transport. HTTP transport is not supported yet but will be added in the future.

Create a command to serve your MCP server:

php
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use InnoGE\LaravelMcp\Commands\ServesMcpServer;

class McpServerCommand extends Command
{
    use ServesMcpServer;

    protected $signature = 'mcp:serve';
    protected $description = 'Start an MCP server';

    public function handle(): int
    {
        return $this->serveMcp('your-app-name', '1.0.0');
    }

    private function getTools(): array
    {
        return [
            // List your tool classes here
        ];
    }

    private function getResources(): array
    {
        return [
            // List your resource providers here
        ];
    }
}

Resources

Resources allow you to expose your application's data models through the MCP protocol. The package provides two types of resource providers:

  1. EloquentResourceProvider: Expose Eloquent models
php
use InnoGE\LaravelMcp\Resources\EloquentResourceProvider;
use App\Models\User;

// In your getResources() method:
return [
    new EloquentResourceProvider(User::query(), 'users', 'A User of the Application')
];
  1. InMemoryResourceProvider: Expose custom data structures or non-Eloquent data
php
use InnoGE\LaravelMcp\Resources\InMemoryResourceProvider;
use InnoGE\LaravelMcp\Types\Resources\ResourceContent;
use InnoGE\LaravelMcp\Types\Resources\ResourceItem;

// Create a resource provider
$resourceProvider = new InMemoryResourceProvider();

// Add example documents as resources
$resourceProvider->addResource(
    new ResourceItem('doc://example/document1', 'Example Document 1', 'This is an example document', 'text/plain', 1024),
    new ResourceContent('doc://example/document1', 'text/plain', 'This is the content of the document')
);

$resourceProvider->addResource(
    new ResourceItem('doc://example/document2', 'Example Document 2', 'This is an example document 2', 'text/plain', 1024),
    new ResourceContent('doc://example/document2', 'text/plain', 'This is the content of the document 2')
);

// In your getResources() method:
return [
    $resourceProvider
];

Tools

Tools define actions that can be performed through the MCP protocol:

  • Built-in Example Tools:

    • HelloTool: A simple hello world example
    • ClockTool: Returns the current time
  • Custom Tools: Create your own by implementing the ToolInterface

php
use InnoGE\LaravelMcp\Tools\Examples\HelloTool;
use InnoGE\LaravelMcp\Tools\Examples\ClockTool;
use App\MCP\Tools\YourCustomTool;

// In your getTools() method:
return [
    HelloTool::class,
    ClockTool::class,
    YourCustomTool::class,
];

Creating a Tool

Tools are the core functionality of MCP, allowing AI assistants to interact with your Laravel application. They provide a way to execute specific actions in your application through a well-defined interface.

Real-world examples of MCP tools include:

  • Database Operations: Create, read, update, or delete records
  • External API Integration: Make API calls to third-party services
  • File Management: Upload, download, or process files
  • Authentication: Verify user credentials or generate tokens
  • Reporting: Generate reports or export data
  • Email/Notification: Send messages to users

Example Tool:

php
<?php

namespace App\MCP\Tools;

use Illuminate\Support\Facades\Artisan;
use InnoGE\LaravelMcp\Tools\Tool;
use Symfony\Component\Console\Output\BufferedOutput;

class CallArtisanCommandTool implements Tool
{
    /**
     * Get the tool name
     */
    public function getName(): string
    {
        return 'call-artisan-command';
    }

    /**
     * Get the tool description
     */
    public function getDescription(): string
    {
        return 'Call a Laravel Artisan command';
    }

    /**
     * Get the input schema for the tool
     */
    public function getInputSchema(): array
    {
        return [
            'type' => 'object',
            'properties' => [
                'command' => [
                    'type' => 'string',
                    'description' => 'The Artisan command to call (e.g. "migrate")',
                ],
            ],
            'required' => ['command'],
        ];
    }

    /**
     * Execute the tool with the provided arguments
     */
    public function execute(array $arguments): string
    {
        $command = $arguments['command'];

        $outputBuffer = new BufferedOutput;

        Artisan::call($command, [], $outputBuffer);

        return $outputBuffer->fetch();
    }
}

Testing your MCP Server

Use Modelcontext Protocol Inspector to test the MCP server:

bash
npx @modelcontextprotocol/inspector php /path/to/your/app/artisan mcp:serve

Adding your MCP Server to Claude Desktop

Edit your Claude Desktop config file:

~/Library/Application Support/Claude/claude_desktop_config.json

Add your MCP server to the config file:

json
{
  "mcpServers": {
    "laravel-mcp": {
      "command": "php",
      "args": [
        "/path/to/your/app/artisan",
        "mcp:serve"
      ]
    }
  }
}

Now you can use your MCP server in Claude Desktop. Please note that Claude currently does not use MCP resources. If you want to access data of your application you can use tool calls.

Testing

bash
composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "innoge-laravel-mcp": {
      "command": "",
      "args": []
    }
  }
}

Use Laravel MCP(模型上下文协议) MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Laravel MCP(模型上下文协议) is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Laravel MCP(模型上下文协议) as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Laravel MCP(模型上下文协议) MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "innoge-laravel-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "laravel-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Laravel MCP(模型上下文协议) MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Laravel MCP(模型上下文协议) MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Laravel MCP(模型上下文协议) to help me with this task?
Laravel MCP(模型上下文协议)
Sure. I read it.
Here is what I found using Laravel MCP(模型上下文协议).

Frequently asked questions

What is the Laravel MCP(模型上下文协议) MCP server used for?

Laravel MCP(模型上下文协议) is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Laravel MCP(模型上下文协议) MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Laravel MCP(模型上下文协议) with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Laravel MCP(模型上下文协议) MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Laravel MCP(模型上下文协议) connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Laravel MCP(模型上下文协议) MCP to TypingMind?

Laravel MCP(模型上下文协议) runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Laravel MCP(模型上下文协议) MCP provide in TypingMind?

Laravel MCP(模型上下文协议) exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Laravel MCP(模型上下文协议) MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Laravel MCP(模型上下文协议) requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇