| Filename | Latest commit message | Latest commit date |
|---|---|---|
* [Client] Speak the 2026-07-28 lifecycle On that revision the client opens with server/discover instead of initialize, stamps each request's _meta with the protocol version, its own capabilities and client info, and sends the standard Mcp-Method / Mcp-Name / Mcp-Param-* headers an intermediary routes on. ToolCatalog is what knows, from the tool list, which arguments a call has to mirror. An input_required result is answered rather than surfaced: InputRequestResolver asks the host's elicitation, sampling and roots handlers and retries the same request carrying inputResponses and the requestState the server sent. McpHeader holds the header names and the =?base64?…?= sentinel, so the two sides no longer keep their own copies of the same rules. * Fix CI baseline drift and address Copilot review findings Drop stale expected-failure entries the new client fixture now passes. Copilot review: fix McpHeader round-trip for a wrapper-shaped literal, encode empty/numeric-keyed inputResponses as a JSON object, stop the incident example repeating side effects on MRTR retry, and reset ToolCatalog on reconnect instead of carrying the previous server's verdicts. * Skip DualEraExampleTestCase on PHP 8.1 PHP_CLI_SERVER_WORKERS does not reliably fork multiple php -S workers there (php/php-src#9400), reproducing the single-worker deadlock the extra workers exist to avoid. |
||
| .. | ||
| cached-discovery | ||
| client-communication | ||
| client-logging | ||
| combined-registration | ||
| complex-tool-schema | ||
| custom-dependencies | ||
| custom-method-handlers | ||
| discovery-calculator | ||
| discovery-userprofile | ||
| elicitation | ||
| env-variables | ||
| explicit-registration | ||
| mcp-apps | ||
| oauth-keycloak | ||
| oauth-microsoft | ||
| schema-showcase | ||
| bootstrap.php | ||
| README.md | ||
MCP SDK Examples
This directory contains various examples of how to use the PHP MCP SDK.
You can run the examples with the dependencies already installed in the root directory of the SDK. The bootstrapping of the example will choose the used transport based on the SAPI you use.
For running an example, you execute the server.php like this:
# For using the STDIO transport:
php examples/server/discovery-calculator/server.php
# For using the Streamable HTTP transport:
php -S localhost:8000 examples/server/discovery-userprofile/server.php
You will see debug outputs to help you understand what is happening.
Run with Inspector:
npx @modelcontextprotocol/inspector php examples/server/discovery-calculator/server.php
Debugging
You can enable debug output by setting the DEBUG environment variable to 1, and additionally log to a file by
setting the FILE_LOG environment variable to 1 as well. A dev.log file gets written within the example's
directory.
With the Inspector you can set the environment variables like this:
npx @modelcontextprotocol/inspector -e DEBUG=1 -e FILE_LOG=1 php examples/server/discovery-calculator/server.php