MCP for Laravel
@settledco
About MCP for Laravel
Overview
What is MCP for Laravel?
MCP for Laravel is a PHP package for Laravel 11 that provides a framework for building intelligent AI agents using the Model Context Protocol (MCP). It is designed for developers who want to integrate LLM-powered agents with tool calling, memory, and RAG capabilities into Laravel applications.
How to use MCP for Laravel?
Install the package via Composer with composer require settled/mcp-laravel. Then create an agent by extending the Settled\MCP\Agent class, configure an LLM provider (e.g., Anthropic, Ollama, OpenAI, Mistral, Deepseek), and define instructions using the SystemPrompt class. Send prompts to the agent with $agent->run(new UserMessage(...)). Connect MCP servers by using the McpConnector component inside the agent’s tools array.
Key features of MCP for Laravel
- Pre-built Agent class with automatic memory and tool management
- MCP server connector to import external tools via McpConnector
- Support for multiple LLM providers (Anthropic, Ollama, OpenAI, Mistral, Deepseek)
- SystemPrompt helper for consistent instruction building
- RAG (Retrieval-Augmented Generation) support with vector stores and embeddings
Use cases of MCP for Laravel
- Creating a YouTube video summarizer agent with transcription tools
- Building an SEO analysis agent that uses MCP server tools
- Implementing a RAG chatbot that queries a vector database
FAQ from MCP for Laravel
What LLM providers does MCP for Laravel support?
It supports Anthropic, Ollama, OpenAI, Mistral, and Deepseek. Switching providers requires only a single line of code.
How do I connect an MCP server to my agent?
Use the McpConnector class inside the agent’s tools() method, providing the command and arguments for the MCP server (e.g., 'npx -y @modelcontextprotocol/server-everything'). The connector automatically exposes the server’s tools.
What are the system requirements for MCP for Laravel?
PHP ^8.0 and Laravel ^11.0 are required.
Does the agent have built-in memory?
Yes, the Agent class automatically retains conversation history, as shown in the sample where the agent remembers the user’s name from a previous message.
Can I build a RAG system with this package?
Yes, by extending the RAG class and attaching an embeddings provider (e.g., VoyageEmbeddingProvider) and a vector store (e.g., PineconeVectoreStore).
Basic information
Category
Other
Author
More Other MCP clients
Dify Connect MCP
difybasetinyagents
albertvillanovaTiny Agents: LLM + MCP Tools
mcp_ha_xiaozhi
shawn996小智官方服务器(虾哥)对接home assistant的mcp server
EasyMCP
mshojaei77A beginner-friendly client for the MCP (Model Context Protocol). Connect to SSE, NPX, and UV servers, and integrate with OpenAI for dynamic tool interactions. Perfect for exploring server connections and chat enhancements.
MCP 聊天应用
machaojin1917939763基于MCP(Model Context Protocol)的智能聊天应用,支持Web和桌面环境。集成OpenAI/Anthropic API,提供MCP服务器的所有工具能力。简洁现代的UI设计,支持跨平台部署。
Comments