# MCP Client for Laravel

A Laravel package that speaks the Model Context Protocol over both Streamable HTTP and STDIO, exposing a single facade for listing and calling MCP tools and reading resources, used by the LarAgent framework and other Laravel AI packages.

MCP Client for Laravel is a native Laravel client for the Model Context Protocol, installed through Composer and configured through a published config file mapping named MCP servers to their connection details. It speaks JSON-RPC 2.0 over both Streamable HTTP for remote servers and STDIO for local subprocesses, and its HTTP transport content-negotiates with the server on every request so callers get back a final result whether the server responds with a single JSON object or a stream of server-sent events.

The HTTP transport handles the MCP initialize handshake automatically, tracks the mcp-session-id header, and re-handshakes and retries once if the server reports the session expired with a 404. The STDIO transport launches the configured command as a subprocess lazily on first use and reuses it for later calls, with configurable working directory, environment variables and whether the parent environment is inherited.

It is built by Redberry, a Laravel partner agency, and is used as the underlying MCP client by the LarAgent framework and other Laravel AI packages.

Website: https://github.com/RedberryProducts/mcp-client-laravel
