Laravel 12 Docs MCP Server

by brianirish
Verified

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Automatically fetches and updates Laravel documentation from GitHub repository, supporting different Laravel versions and providing version control integration for documentation updates.

  • Provides access to Laravel documentation, enabling search and retrieval of Laravel docs across different versions. Includes tools for listing documentation files, searching documentation for specific terms, and automatically fetching and updating documentation from Laravel's GitHub repository.

Laravel Docs MCP 服务器

模型上下文协议 (MCP) 服务器,提供对 Laravel 文档的访问以及针对 AI 助手和语言模型的包推荐。

概述

该服务器使 AI 助手能够使用模型上下文协议 (MCP) 访问 Laravel 文档和软件包推荐。它允许 AI 工具:

  • 访问和搜索 Laravel 文档
  • 根据具体用例接收软件包推荐
  • 获取流行 Laravel 软件包的实施指南
  • 自动从 Laravel 的 GitHub 存储库更新文档

安装

通过 Smithery 快速安装

npx -y @smithery/cli install @brianirish/laravel-docs-mcp --client claude

手动安装

先决条件

  • Python 3.12+
  • uv包管理器(推荐)

步骤

  1. 克隆存储库:
    git clone https://github.com/yourusername/laravel-docs-mcp.git cd laravel-docs-mcp
  2. 设置环境并安装依赖项:
    # Create and activate virtual environment uv venv source .venv/bin/activate # Linux/macOS # or .venv\Scripts\activate # Windows # Install dependencies uv pip install .

用法

启动服务器

python laravel_docs_server.py

服务器在首次运行时会自动获取 Laravel 文档,可以使用 Ctrl+C 停止。

命令行选项

选项描述
--docs-path PATH文档目录路径(默认:./docs)
--server-name NAME服务器名称(默认:LaravelDocs)
--log-level LEVEL日志级别:DEBUG、INFO、WARNING、ERROR、CRITICAL(默认:INFO)
--transport TYPE传输方式:stdio、websocket、sse(默认:stdio)
--host HOST绑定到的主机(网络传输)
--port PORT监听端口(网络传输)
--version VERSIONLaravel 版本分支(默认:12.x)
--update-docs开始之前更新文档
--force-update强制文档更新

自定义选项的示例:

python laravel_docs_server.py --docs-path /path/to/docs --version 11.x --update-docs --transport websocket --host localhost --port 8000

文档更新程序

您可以单独更新文档:

# Update documentation python docs_updater.py --target-dir ./docs --version 12.x # Check if update is needed python docs_updater.py --check-only # Force update python docs_updater.py --force

API 参考

客户端示例

import asyncio from fastmcp import Client async def main(): client = Client("path/to/laravel_docs_server.py") async with client: # List documentation result = await client.call_tool("list_docs", {}) print(result) # Search documentation result = await client.call_tool("search_docs", {"query": "routing"}) print(result) # Get package recommendations result = await client.call_tool("get_package_recommendations", {"use_case": "implementing subscription billing"}) print(result) # Read documentation resource = await client.read_resource("laravel://routing.md") print(resource) if __name__ == "__main__": asyncio.run(main())

可用工具

文档工具

  • list_docs() - 列出所有文档文件
  • search_docs(query: str) - 搜索文档中的特定术语
  • update_docs(version: Optional[str], force: bool) - 更新文档
  • docs_info() - 获取文档版本信息

套餐推荐工具

  • get_package_recommendations(use_case: str) - 获取用例的包建议
  • get_package_info(package_name: str) - 获取有关特定包的详细信息
  • get_package_categories(category: str) - 列出特定类别中的包
  • get_features_for_package(package: str) - 获取包的可用功能

资源访问

可以使用以下方式将文档文件作为资源进行访问:

laravel://{path}

例子:

  • laravel://routing.md
  • laravel://authentication.md

功能和路线图

当前功能:

  • ✅ 来自 Laravel GitHub 存储库的动态文档更新
  • ✅ 优雅关机处理
  • ✅ 通过命令行选项实现版本灵活性
  • ✅ 根据用例进行软件包推荐
  • ✅ 常见 Laravel 软件包的实施指南
  • ✅ Docker 部署支持

计划的功能:

  • 多版本支持(同时访问多个 Laravel 版本的文档)
  • 通过用户项目分析提供定制化建议

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

贡献

欢迎贡献!请参阅 CONTRIBUTING.md 获取相关指南。

致谢

  • Laravel 的优秀文档
  • Laravel 软件包作者对生态系统的贡献
-
security - not tested
A
license - permissive license
-
quality - not tested

模型上下文协议服务器为 AI 助手和语言模型提供对 Laravel 12 文档的访问权限,允许他们列出、阅读和搜索文档文件。

  1. Overview
    1. Installation
      1. Quick Install via Smithery
      2. Manual Installation
    2. Usage
      1. Starting the Server
      2. Command Line Options
      3. Documentation Updater
    3. API Reference
      1. Client Example
      2. Available Tools
      3. Resource Access
    4. Features and Roadmap
      1. License
        1. Contributing
          1. Acknowledgements
            ID: rjwaqizfuh