MCP.so
Sign In

PHP MCP Client

@swisnl

About PHP MCP Client

Model Context Protocol client implementation for PHP

Overview

What is PHP MCP Client?

A PHP client library for interacting with Model Context Protocol (MCP) servers. It runs on any PHP 8.2+ environment and is built on ReactPHP for asynchronous operations.

How to use PHP MCP Client?

Install via Composer (composer require swisnl/mcp-client), then create a client with a transport (SSE, Stdio, Process, or StreamableHttp), connect to the server, and call tools. For example, Client::withSse($endpoint) initiates an SSE connection, and $client->callTool('name', ['param' => 'value']) executes a tool.

Key features of PHP MCP Client

  • Multiple transport mechanisms: SSE, Stdio, Process, and StreamableHttp
  • Promise-based API with ReactPHP for async operations
  • PSR-3 Logger interface support
  • Tool annotation support (read‑only hint, title)
  • Custom transporter support via TransporterInterface
  • Integration with the SWIS Agents SDK

Use cases of PHP MCP Client

  • Connect PHP applications to any MCP‑compatible server (e.g., math tools, data retrievers)
  • Build AI agents by combining the client with the SWIS Agents SDK
  • Call remote or local MCP tools with structured input and output

FAQ from PHP MCP Client

What is the PHP MCP Client?

It’s a PHP library that implements the client side of the Model Context Protocol, allowing PHP applications to interact with MCP servers over multiple transports using async I/O.

What PHP version is required?

PHP 8.2 or higher, along with ReactPHP packages.

Which transports are supported?

Four transports: Server‑Sent Events (SSE), standard I/O (Stdio), external process communication (Process), and HTTP with session management (StreamableHttp).

Is the PHP MCP Client free?

Yes, it’s open‑source under the MIT license. The project is Treeware – if used in production, you are asked to buy a tree.

Can I use a custom transport?

Yes. Implement the TransporterInterface and pass your transporter to the Client constructor.

Comments

More Agent Frameworks MCP clients