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
y-cli 🚀
luohy15A Tiny Terminal Chat App for AI Models with MCP Client Support
Llama-Server MCP Proxy
extopicoSimple node proxy for llama-server that enables MCP use
MCPChatbot Example
keli-wenA chatbot implementation compatible with MCP (terminal / streamlit supported)
Dify Plugin Agent Mcp_sse
junjiemDify 1.0 Plugin Support MCP Tools Agent strategies
ThingsPanel MCP
thingspanelThis MCP server integrates ThingsPanel IoT platform with AI models like Claude, GPT, and others that support the Model Context Protocol.
Comments