Skip to content

Commit ef8b390

Browse files
CodeWithKyriangithub-actions[bot]
authored andcommitted
Update CHANGELOG
1 parent 5ed5e20 commit ef8b390

File tree

1 file changed

+83
-53
lines changed

1 file changed

+83
-53
lines changed

CHANGELOG.md

Lines changed: 83 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
All notable changes to `php-mcp/client` will be documented in this file.
44

5+
## v1.0.1 - 2025-05-06
6+
7+
This patch release introduces an API improvement to the `ClientBuilder` for a more streamlined configuration experience.
8+
9+
### ✨ Enhancements
10+
11+
* **Simplified Client Identity Configuration:** The `ClientBuilder` now features a new method `withClientInfo(string $name, string $version)`. This single method replaces the previous separate `withName(string $name)` and `withVersion(string $version)` methods for setting your client application's identity. This makes the builder API slightly more concise.
12+
13+
### ⚠️ Deprecations
14+
15+
* The methods `ClientBuilder::withName(string $name)` and `ClientBuilder::withVersion(string $version)` are now **deprecated**.
16+
* Please update your code to use the new `ClientBuilder::withClientInfo(string $name, string $version)` method.
17+
* The deprecated methods will be removed in a future `v2.0.0` release. They will continue to function as before in the `v1.x.x` series to maintain backward compatibility.
18+
19+
### 📝 Documentation
20+
21+
* The `README.md` and examples have been updated to reflect the new `withClientInfo()` method and the removal of the `ClientInfo` object from direct user configuration.
22+
523
## v1.0.0 - 2025-05-06
624

725
### v1.0.0 - Initial Release
@@ -15,81 +33,93 @@ It offers a robust, flexible, and developer-friendly solution designed specifica
1533
#### ✨ Key Features
1634

1735
* **Client-per-Server Architecture:** Aligns with the MCP specification's core model where each `Client` instance manages a dedicated, stateful connection to a single configured MCP server.
36+
1837
* **Fluent Configuration Builder:** Set up client instances easily using the `Client::make()->with...()->build()` pattern, configuring client identity, capabilities, and the specific server connection details (`ServerConfig`).
38+
1939
* **Dual API for Flexibility:**
20-
* **Synchronous Facade:** Interact with MCP servers using straightforward, blocking methods (e.g., `$client->initialize()`, `$client->listTools()`, `$client->callTool(...)`) for simple integration into traditional PHP scripts and frameworks. The underlying asynchronous complexity is handled internally.
21-
* **Asynchronous API:** Access Promise-based methods (e.g., `$client->initializeAsync()`, `$client->listToolsAsync()`, `$client->callToolAsync(...)`) for advanced use cases, concurrent operations using `React\Promise\all`, or integration into asynchronous PHP applications (ReactPHP, Amp, Swoole).
22-
40+
41+
* **Synchronous Facade:** Interact with MCP servers using straightforward, blocking methods (e.g., `$client->initialize()`, `$client->listTools()`, `$client->callTool(...)`) for simple integration into traditional PHP scripts and frameworks. The underlying asynchronous complexity is handled internally.
42+
* **Asynchronous API:** Access Promise-based methods (e.g., `$client->initializeAsync()`, `$client->listToolsAsync()`, `$client->callToolAsync(...)`) for advanced use cases, concurrent operations using `React\Promise\all`, or integration into asynchronous PHP applications (ReactPHP, Amp, Swoole).
43+
2344
* **Multiple Transport Support:**
24-
* **`stdio`:** Seamlessly connect to and manage local MCP server processes via standard input/output, ideal for command-line tools or embedded servers. Uses `react/child-process` internally.
25-
* **`http`:** Connect to remote or local MCP servers over HTTP, handling POST requests for client messages and Server-Sent Events (SSE) for server messages and notifications. Uses `react/http` internally.
26-
45+
46+
* **`stdio`:** Seamlessly connect to and manage local MCP server processes via standard input/output, ideal for command-line tools or embedded servers. Uses `react/child-process` internally.
47+
* **`http`:** Connect to remote or local MCP servers over HTTP, handling POST requests for client messages and Server-Sent Events (SSE) for server messages and notifications. Uses `react/http` internally.
48+
2749
* **Explicit Connection Lifecycle:** Clear methods (`initialize`/`initializeAsync`, `disconnect`/`disconnectAsync`) to manage the stateful connection and MCP handshake process.
50+
2851
* **Full MCP Core Feature Support:** Implements core MCP operations:
29-
* Capability Negotiation (`initialize`)
30-
* Listing Tools, Resources, Prompts, Resource Templates
31-
* Calling Tools (`tools/call`)
32-
* Reading Resources (`resources/read`)
33-
* Getting Prompts (`prompts/get`)
34-
* Resource Subscriptions (`resources/subscribe`, `resources/unsubscribe`) *(Requires server capability)*
35-
* Server Log Level Control (`logging/setLevel`) *(Requires server capability)*
36-
* Connectivity Check (`ping`)
37-
52+
53+
* Capability Negotiation (`initialize`)
54+
* Listing Tools, Resources, Prompts, Resource Templates
55+
* Calling Tools (`tools/call`)
56+
* Reading Resources (`resources/read`)
57+
* Getting Prompts (`prompts/get`)
58+
* Resource Subscriptions (`resources/subscribe`, `resources/unsubscribe`) *(Requires server capability)*
59+
* Server Log Level Control (`logging/setLevel`) *(Requires server capability)*
60+
* Connectivity Check (`ping`)
61+
3862
* **PSR Compliance:**
39-
* Integrates with `PSR-3 (LoggerInterface)` for flexible logging.
40-
* Supports optional `PSR-16 (SimpleCacheInterface)` for caching server definitions (tools, resources, etc.) via `DefinitionCache`.
41-
* Supports optional `PSR-14 (EventDispatcherInterface)` for handling server-sent notifications (e.g., `ResourceChanged`, `ToolsListChanged`) asynchronously.
42-
63+
64+
* Integrates with `PSR-3 (LoggerInterface)` for flexible logging.
65+
* Supports optional `PSR-16 (SimpleCacheInterface)` for caching server definitions (tools, resources, etc.) via `DefinitionCache`.
66+
* Supports optional `PSR-14 (EventDispatcherInterface)` for handling server-sent notifications (e.g., `ResourceChanged`, `ToolsListChanged`) asynchronously.
67+
4368
* **Robust Error Handling:** Provides a hierarchy of specific exceptions (`ConfigurationException`, `ConnectionException`, `HandshakeException`, `RequestException`, `TimeoutException`, `TransportException`, `UnsupportedCapabilityException`, etc.) for predictable error management.
69+
4470
* **Asynchronous Core:** Built on ReactPHP's event loop and promises for efficient, non-blocking I/O handling crucial for `stdio` and `http+sse` transports.
71+
4572

4673
#### 🚀 Getting Started
4774

4875
1. **Install:**
49-
76+
5077
```bash
5178
composer require php-mcp/client
52-
79+
80+
5381
```
5482
2. **Configure:** Define your server connection using `ServerConfig` and build a client instance.
55-
83+
5684
```php
5785
use PhpMcp\Client\Client;
58-
use PhpMcp\Client\Enum\TransportType;
59-
use PhpMcp\Client\Model\ClientInfo;
60-
use PhpMcp\Client\ServerConfig;
61-
62-
$serverConfig = new ServerConfig(
63-
name: 'my_stdio_server',
64-
transport: TransportType::Stdio,
65-
command: ['php', '/path/to/your/mcp_server.php'],
66-
timeout: 15
67-
);
68-
69-
$clientInfo = new ClientInfo('MyPHPApp', '1.0');
70-
71-
$client = Client::make()
72-
->withClientName($clientInfo->name) // Pass name/version directly
73-
->withClientVersion($clientInfo->version)
74-
->withServerConfig($serverConfig)
75-
// ->withLogger(new MyLogger()) // Optional
76-
->build();
77-
86+
use PhpMcp\Client\Enum\TransportType;
87+
use PhpMcp\Client\Model\ClientInfo;
88+
use PhpMcp\Client\ServerConfig;
89+
90+
$serverConfig = new ServerConfig(
91+
name: 'my_stdio_server',
92+
transport: TransportType::Stdio,
93+
command: ['php', '/path/to/your/mcp_server.php'],
94+
timeout: 15
95+
);
96+
97+
$clientInfo = new ClientInfo('MyPHPApp', '1.0');
98+
99+
$client = Client::make()
100+
->withClientName($clientInfo->name) // Pass name/version directly
101+
->withClientVersion($clientInfo->version)
102+
->withServerConfig($serverConfig)
103+
// ->withLogger(new MyLogger()) // Optional
104+
->build();
105+
106+
78107
```
79108
3. **Initialize & Interact (Sync Example):**
80-
109+
81110
```php
82111
try {
83-
$client->initialize(); // Connect & Handshake (blocks)
84-
$tools = $client->listTools(); // Make request (blocks)
85-
print_r($tools);
86-
// ... other interactions ...
87-
} catch (\Throwable $e) {
88-
echo "Error: " . $e->getMessage();
89-
} finally {
90-
$client->disconnect(); // Disconnect (blocks)
91-
}
92-
112+
$client->initialize(); // Connect & Handshake (blocks)
113+
$tools = $client->listTools(); // Make request (blocks)
114+
print_r($tools);
115+
// ... other interactions ...
116+
} catch (\Throwable $e) {
117+
echo "Error: " . $e->getMessage();
118+
} finally {
119+
$client->disconnect(); // Disconnect (blocks)
120+
}
121+
122+
93123
```
94124
95125
#### Documentation & Examples

0 commit comments

Comments
 (0)