Livewire MCP服务器
MCP服务器用于Livewire文档参考
这是一个基于TypeScript的MCP服务器,为Livewire文档提供参考信息。它实现了一个模型上下文协议(MCP)服务器,帮助AI助手直接从官方Livewire文档库访问Livewire文档和示例。
特性
工具
list_livewire_topics-获取所有可用Livewire文档主题的列表get_livewire_topic_details-获取特定主题的详细信息get_livewire_topic_examples-获取特定主题的使用示例search_livewire_docs-按关键字搜索Livewire文档中的主题list_livewire_categories-获取所有Livewire文档类别的列表
功能
此服务器从以下位置获取并缓存信息:
- 官方Livewire文档GitHub存储库(https://github.com/livewire/livewire/tree/main/docs)
- 为每个文档主题使用原始Markdown文件
- 按文档中定义的类别组织主题
- 在本地缓存文档文件以避免重复下载
它提供结构化数据,包括:
- 从Markdown文件中完成主题内容
- 分类文档结构
- 带有语言检测的提取代码示例
- 带有标题和锚点的章节内容
- 智能描述提取
- 常见主题的背景预加载
- 脱机使用的持久文件缓存
发展
安装依赖项:
npm install构建服务器:
npm run build对于自动重建的开发:
npm run watch使用Augment
使用Augment配置Livewire MCP服务器后,您可以使用它直接在VS Code环境中访问Livewire文档。以下是一些如何使用它的示例:
列出Livewire文档主题
您可以要求Augment列出所有可用的Livewire文档主题:
What Livewire documentation topics are available?或按类别列出主题:
What Livewire documentation topics are available in the "Directives" category?Show me all the topics in the "Advanced" category.获取主题详细信息
您可以询问有关特定Livewire主题的详细信息:
Show me the documentation for Livewire components.Explain Livewire properties in detail.I need help understanding Livewire's validation system.查找代码示例
您可以要求提供特定主题的代码示例:
Show me examples of Livewire wire:model directive.Give me code examples for Livewire forms.How do I implement events in Livewire? Show me some examples.搜索文档
您可以在Livewire文档中搜索特定概念:
Search Livewire documentation for "validation".Find information about Alpine.js integration in Livewire.What does Livewire documentation say about testing?结合编码任务
您可以将文档查询与编码任务结合起来:
I need to implement a contact form in my Livewire component. Show me the documentation and then help me implement it.Help me create a Livewire component for user registration based on Livewire documentation.I'm working on a Livewire app. Show me the documentation for wire:loading and help me implement loading states.探索 Livewire 功能
您可以按类别浏览Livewire功能:
What are the main directives available in Livewire?Tell me about Livewire's security features.What are the different ways to handle forms in Livewire?安装
增强配置
要在Visual Studio代码中与Augment一起使用,请执行以下操作:
- 如果还没有,请从VS Code市场安装Augment扩展。
- 如果您还没有MCP服务器,请为其创建一个新目录:
mkdir -p ~/.augment/mcp-servers- 将此存储库克隆到该目录中:
git clone https://github.com/your-username/laravel-mcp-server.git ~/.augment/mcp-servers/laravel-mcp-server- 安装依赖项并构建服务器:
cd ~/.augment/mcp-servers/laravel-mcp-server
npm install
npm run build- 通过将Augment添加到Augment配置中,配置Augment以使用此MCP服务器:
打开VS代码设置(Mac上的Cmd+或Windows/Linux上的Ctrl+),搜索“增强”,找到“增强:MCP服务器”设置。点击“在settings.json中编辑”,添加以下内容:
"augment.mcpServers": {
"laravel-server": {
"command": "node",
"args": ["~/.augment/mcp-servers/laravel-mcp-server/build/index.js"]
}
}或者,您可以使用服务器的绝对路径:
"augment.mcpServers": {
"laravel-server": {
"command": "node",
"args": ["/absolute/path/to/laravel-mcp-server/build/index.js"]
}
}- 重新启动VS Code以应用更改。
- 现在,您可以在Laravel项目中使用带有Augment的Laravel文档工具!
Claude桌面配置
要与Claude Desktop一起使用,请添加服务器配置:
在MacOS上: ~/Library/Application Support/Claude/claude_desktop_config.json 在Windows上: %APPDATA%/Claude/claude_desktop_config.json
选项1:使用本地构建
{
"mcpServers": {
"laravel-server": {
"command": "/path/to/laravel-mcp-server/build/index.js"
}
}
}选项2:使用npx命令
{
"mcpServers": {
"laravel-server": {
"command": "npx",
"args": ["-y", "laravel-mcp-server"]
}
}
}风帆配置
将此添加到您的 ./codeium/windsurf/model_config.json:
{
"mcpServers": {
"laravel-server": {
"command": "npx",
"args": ["-y", "laravel-mcp-server"]
}
}
}光标配置
将此添加到您的 .cursor/mcp.json:
{
"mcpServers": {
"laravel-server": {
"command": "npx",
"args": ["-y", "laravel-mcp-server"]
}
}
}调试
由于MCP服务器通过stdio进行通信,调试可能具有挑战性。我们建议使用 MCP检查员,可作为包脚本使用:
npm run inspector检查器将提供一个URL,用于访问浏览器中的调试工具。
故障排除
如果您遇到Laravel MCP服务器的问题,请尝试以下解决方案:
- 服务器没有响应:
- 确保服务器已正确安装和构建 - 检查配置中的路径是否正确 - 尝试重新启动VS代码 - 检查VS Code输出面板是否有任何错误消息(查看>输出,然后从下拉列表中选择“增强”)
- 服务器崩溃或超时:
- 服务器包含常见Laravel主题的回退数据,因此即使无法连接到GitHub,它也应该仍然可以工作 - 如果你在公司防火墙或代理之后,它可能会阻止GitHub API请求 - 尝试手动运行服务器以查看任何错误输出: node /path/to/laravel-mcp-server/build/index.js - 服务器在本地缓存文档文件,因此它应该在第一次成功运行后脱机工作
- 数据不正确或缺失:
- 服务器将数据缓存在内存中以获得更好的性能。如果需要新数据,请重新启动VS Code - 如果缺少特定主题,您可以手动将其添加到源代码中的回退数据中 - 要强制刷新缓存的文档文件,请删除 cache 目录并重新启动服务器
- Augment找不到服务器:
- 确保配置中的服务器名称完全匹配: laravel-server - 检查服务器的路径是否正确且可访问 - 尝试使用绝对路径,而不是 ~ 在您的配置中
- 缓存问题:
- 服务器将文档文件存储在 cache 构建目录旁边的目录 - 如果缓存文件出现问题,可以删除缓存目录以强制重新下载 - 确保运行服务器的进程对缓存目录具有写权限
贡献
欢迎为改进Laravel MCP服务器做出贡献!以下是您可以做出贡献的一些方式:
- 错误报告:如果你发现了一个bug,请创建一个问题,并提供详细的重现步骤。
- 功能请求:如果您对新功能或改进有想法,请创建一个问题来讨论它们。
- 文档:通过修复错误或添加示例来帮助改进文档。
- 代码贡献:提交bug修复或新功能的pull请求。
开发过程
- 分叉存储库
- 创建要素分支(
git checkout -b feature/amazing-feature) - 进行更改
- 提交您的更改(
git commit -m 'Add some amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
跟上Laravel文档
此MCP服务器旨在与Laravel 12.x文档配合使用。随着Laravel的发展,服务器可能需要更新以支持新版本或文档结构的更改。
许可证
麻省理工学院
