Laravel开发工具包

Croft是一个专为Laravel开发者设计的MCP服务器,提供本地开发工具以提高生产力。

  • by usecroft
  • PHP
  • 本地部署
  • 87 星标
  • 更新于
在 GitHub 查看 ashleyhindle/croft

使用说明


克罗夫特现在 Laravel Boost!

克罗夫特是由 阿什利·辛德尔 合作 弹簧加载,并最终成为 Laravel Boost.Croft不再维护-查看 提升 相反!


Croft是Laravel开发者专门为Laravel开发人员设计的MCP服务器。我们想要一个即插即用的解决方案来提高生产力,所以我们构建了一个。这 php artisan croft 命令为您的MCP客户端提供工具,以帮助您的AI对程序员更好地工作。此软件包专门用于提供有用的工具 本地.

添加更多功能 usecroft.com» 托管服务器。

安装

通过composer安装软件包:

composer require usecroft/laravel --dev

使用以下内容发布配置文件:

php artisan vendor:publish --tag="croft-config"

添加到IDE:

php artisan croft:install

添加更多功能 usecroft.com» 托管服务器(即将推出)

用法

要使用Croft,您需要将其添加为您最喜欢的工具中的MCP服务器。

MCP客户端需要运行的命令是 ./artisan croft

光标 (文档)

我们建议您运送 mcp.json 将您的项目归档到 .cursor/mcp.json

{
  "mcpServers": {
    "croft": {
      "command": "./artisan",
      "args": ["croft"]
    }
  }
}

当前功能

  • 屏幕截图URL
  • 查询数据库(只读或读写)
  • 从相对路径获取绝对URL
  • 获取当前日期和时间
  • 读取最后X个日志条目
  • 读取和筛选数据库结构-表、列、索引、外键
  • 列出/筛选路线
  • 列出工匠命令
  • 以点符号列出可用的config()键(和可选值)
  • 列出可用的env()密钥(当然不会泄露机密)

额外功能

添加更多功能 usecroft.com» 远程MCP服务器(即将推出)。

添加您自己的工具

添加自己的工具很简单。

只需创建一个类来扩展我们的 Croft\Feature\Tool\AbstractTool 类,然后确保它在你的 croft.php 配置文件。

例子:

<?php

declare(strict_types=1);

namespace Croft\Tools;

use Croft\Feature\Tool\AbstractTool;
use Croft\Feature\Tool\ToolResponse;

class {{CLASSNAME}} extends AbstractTool
{
    public function __construct()
    {
        // Setup annotations according to MCP specification
        $this->setTitle('{{NAME}}')
            ->setReadOnly(true)        // Just listing commands, no modifications
            ->setDestructive(false)    // No destructive operations
            ->setIdempotent(true);     // Safe to retry
    }

    public function getName(): string
    {
        return '{{NAME}}';
    }

    public function getDescription(): string
    {
        return 'Must explain well what the tool can do so the MCP client can decide when to use it.';
    }

    /**
    * What params does the MCP client need to provide to use this tool?
    **/
    public function getInputSchema(): array
    {
        return [
            'type' => 'object',
            'properties' => (object) [
            ],
            'required' => [],
        ];
    }

    public function handle(array $arguments): ToolResponse
    {
        return ToolResponse::text("Howdy, this is the start of something great.");
    }
}

添加工具后,您需要重新启动服务器,或要求MCP客户端重新列出工具。

支持和积分

Croft是由 阿什利·辛德尔 在以下人士的支持下 弹簧加载。如果你喜欢它,请明星,分享它,让我们知道!

阿什利·辛德尔

  • https://bsky.app/profile/ashleyhindle.com
  • https://twitter.com/ashleyhindle
  • https://ashleyhindle.com

弹簧加载

  • https://bsky.app/profile/springloaded.co
  • https://twitter.com/ashleyhindle
  • https://springloaded.co