Client
Client SDK for AI agents — automatically handles payment challenges from MCP servers
What is Client?
Client is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to client sdk for ai agents — automatically handles payment challenges from mcp servers
Client SDK for AI agents — automatically handles payment challenges from MCP servers
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Client SDK for AI agents — automatically handles payment cha
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx clientConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Client
The php-mcp/client library is a PHP SDK that gives PHP applications and AI agents a complete, idiomatic client for the Model Context Protocol, supporting both synchronous and async communication with MCP servers over Stdio and HTTP/SSE transports. It handles the full MCP lifecycle — initialization, tool listing, tool calling, resource reading, prompt retrieval, and resource subscriptions — through a fluent builder API and exposes both blocking and promise-based async variants of every operation. PHP developers building AI agent backends, automation pipelines, or Laravel/Symfony applications that need to connect to MCP servers will find this the most complete PHP-native MCP client available.
Prerequisites
- PHP 8.1 or later
- Composer package manager installed
- A running MCP server to connect to (Stdio or HTTP/SSE-based)
- Basic familiarity with PHP and PSR-compatible HTTP clients
Install via Composer
Add the php-mcp/client package to your PHP project using Composer.
composer require php-mcp/clientConfigure the server connection
Use the Client builder to define which MCP server to connect to. The example below uses a Stdio transport pointing to a local MCP server script.
use PhpMcp\Client\Client;
use PhpMcp\Client\ServerConfig;
use PhpMcp\Client\Transport\StdioTransport;
$client = Client::make()
->withClientInfo('my-app', '1.0.0')
->withServerConfig(
ServerConfig::forStdio(
command: 'node',
args: ['/path/to/mcp-server/index.js']
)
)
->build();Initialize the connection
Call initialize() to perform the MCP handshake and establish the session before making any tool or resource calls.
$client->initialize();List and call tools
Retrieve available tools from the connected MCP server, then call a specific tool with arguments.
$tools = $client->listTools();
foreach ($tools as $tool) {
echo "Tool: {$tool->name}\n";
}
$result = $client->callTool('search', ['query' => 'PHP MCP documentation']);
echo $result->content;Disconnect when done
Always disconnect cleanly after your operations are complete to release the MCP server process or connection.
$client->disconnect();Client Examples
Client configuration (Stdio transport)
Complete example of connecting to a local Stdio MCP server, listing tools, calling one, and disconnecting.
<?php
require 'vendor/autoload.php';
use PhpMcp\Client\Client;
use PhpMcp\Client\ServerConfig;
$client = Client::make()
->withClientInfo('my-agent', '1.0.0')
->withServerConfig(
ServerConfig::forStdio(
command: 'node',
args: ['/path/to/mcp-server/index.js'],
env: ['DEBUG' => 'mcp*']
)
)
->build();
$client->initialize();
$tools = $client->listTools();
foreach ($tools as $tool) {
echo "Available tool: {$tool->name}\n";
}
$client->disconnect();Prompts to try
This is a PHP library, not a chat-based MCP server. Use these code patterns to interact with any MCP server from a PHP application.
- Connect to an MCP server and list all available tools: $client->listTools()
- Call a specific tool with arguments: $client->callTool('tool_name', ['param' => 'value'])
- Read a resource from the server: $client->readResource('resource://path/to/item')
- Retrieve a named prompt: $client->getPrompt('prompt_name', ['variable' => 'value'])
- Health check the connection: $client->ping()Troubleshooting Client
Class not found errors after composer require
Run composer dump-autoload after installation. Ensure your PHP file includes require 'vendor/autoload.php' at the top before any use statements.
Connection times out or initialize() hangs
Verify the MCP server command and args in ServerConfig are correct and that the server binary is executable. Test the server independently in a terminal to confirm it starts and outputs valid MCP JSON-RPC on stdout.
callTool() throws a ToolNotFound exception
Call listTools() first to see which tools the connected server actually exposes. Tool names are case-sensitive and must exactly match the name returned by the server.
Frequently Asked Questions about Client
What is Client?
Client is a Model Context Protocol (MCP) server that client sdk for ai agents — automatically handles payment challenges from mcp servers It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Client?
Follow the installation instructions on the Client GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Client?
Client works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Client free to use?
Yes, Client is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Client Alternatives — Similar Developer Tools Servers
Looking for alternatives to Client? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Client in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Client?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.