GitShow/modelcontextprotocol/php-sdk
modelcontextprotocol

php-sdk

The official PHP SDK for Model Context Protocol servers and clients. Maintained in collaboration with The PHP Foundation.

by modelcontextprotocol
mcpmcp-clientmcp-serverphp
Star on GitHubForkWebsite

PHP

1.6k stars167 forks49 contributorsActive · 2h agoSince 2025v0.7.1

Meet the team

See all 49 on GitHub →
chr-hertel
chr-hertel118 contributions
CodeWithKyrian
CodeWithKyrian22 contributions
Nyholm
Nyholm20 contributions
soyuka
soyuka14 contributions
OskarStark
OskarStark11 contributions
bigdevlarry
bigdevlarry8 contributions
dependabot[bot]Bot
dependabot[bot]8 contributions
luoyue712
luoyue7127 contributions

Languages

View on GitHub →
PHP99.8%
Makefile0.2%
Twig0.1%

Commit activity

Last 12 weeks · 80 commits

Full graph →

Community health

5 of 6 standards met

Community profile →
87
✓README✓License✓Contributing✓Code of Conduct○Issue Template✓PR Template

Recent PRs & issues

Active · Last activity 2h ago
See all on GitHub →
omouren
[Server] Add outgoing (elicitation, sampling) request and client response eventsOpenPR

Introduce and to provide full observability over the server's interaction with the client. This includes requests sent by the server (e.g., elicitation, sampling) and the client's replies to those requests. Additionally, update and to be dispatched when a suspended Fiber completes. This ensures that deferred responses from long-running, asynchronous operations are also observable via the existing event mechanisms. Motivation and Context We wanted to be able to log every step of our MCP usage, including elicitation. How Has This Been Tested? Tested manualy Breaking Changes No breaking changes Types of changes [ ] Bug fix (non-breaking change which fixes an issue) [x] New feature (non-breaking change which adds functionality) [ ] Breaking change (fix or feature that would cause existing functionality to change) [x] Documentation update Checklist [x] I have read the MCP Documentation [x] My code follows the repository's style guidelines [x] New and existing tests pass locally [x] I have added appropriate error handling [x] I have added or updated documentation as needed

omouren · 2h ago
simonyang08
fix: specify closure handler signatureOpenPR

Summary give the registry handler alias an explicit variadic signature allow strict PHPStan users to decorate without a missing callable signature error Root cause The PHPStan alias used a bare , so consumers inheriting the alias received under strict analysis. Current validation status consumer-only minimal PHPStan reproducer: fails before and passes with the proposed alias : 4 tests, 9 assertions pass : passes Upstream CI exposed a variance conflict that the isolated reproducer missed: the proposed type rejects the repository's valid handlers with narrower required parameter lists. The full PHPStan job reports 29 errors introduced by this alias. The PR is therefore intentionally Draft while the correct way to represent an arbitrary Closure signature is discussed; the current commit should not be merged as-is. Fixes #468

simonyang08 · 2h ago

Recent fixes

View closed PRs →
chr-hertel
[Server][Client][Protocol] SEP-414: W3C Trace Context propagation via _metaClosedIssue

Implements SEP-414 for the MCP Spec 2026-07-28 release. Tracked by umbrella #336. Additive, non-breaking. Spec summary Standardizes how W3C Trace Context (, , ) is conveyed in JSON-RPC for non-HTTP transports, and how it interplays with HTTP headers. Lets servers and clients propagate spans across MCP boundaries. PHP SDK changes and request DTOs — recognize/preserve and round-trip. — propagate trace context through (no HTTP headers available). and — bridge HTTP / headers ↔ JSON-RPC per the spec rules. — make trace context available on so tool handlers can use it (PSR-3 logger correlation, OTel instrumentation packages). Optional helper for parsing/serializing . No new dependencies required — keep OTel integration opt-in via consumer code. Related Umbrella #336

chr-hertel · 2h ago
chr-hertel
[Server][Client] Bridge W3C trace context between HTTP headers and _meta (SEP-414)MergedPR

Summary based trace context propagation already existed ( parses // from JSON-RPC ), but nothing bridged it to/from native HTTP headers — so a caller propagating trace context via HTTP headers only, with no , got no trace context at all, and vice versa. : now falls back to the matching HTTP header when doesn't set a trace key. wins on conflict, since it's more specific to the call. : threads the request's headers through to . : mirrors any trace context onto outbound // HTTP headers. Closes #355. Test plan [x] New unit tests covering: HTTP header present + no → populated; both present ( wins); stdio transport (no HTTP headers) still works via alone [x] Full suite passes (1708 tests) [x] — no errors

chr-hertel · 2h ago
chr-hertel
[Docs] Deprecation policy, SDK tier target, and CONTRIBUTING.mdMergedPR

Summary Adds (SEP-2596): the Active → Deprecated → Removed lifecycle, the twelve-month window, and the tag convention already in use since SEP-2577 (#427). Closes #366. Adds (SEP-1730): gap analysis against the Tier 2 bar. Server conformance is ~99%/98%; client conformance is only 20%/5% — flagged as the real gap, not a docs one. Closes #368. Wires both into 's nav under a new Project section, and links them from 's "Where to go next". Fixes two links in that pointed at repo-root files via a path escaping — dead under Zensical's build (#414); pointed them at GitHub URLs instead, matching the existing convention. Adds at the repo root — dev setup, the checks to run before a PR, coding standards, testing expectations, the docs-guide link-resolution rule Zensical enforces, and licensing terms. Linked from README's Contributing section. Test plan [x] (Zensical build) — no issues found [x] — no errors [x] — 0 files need fixing

chr-hertel · 2h ago
Structured data for AI agents

Repository: modelcontextprotocol/php-sdk. Description: The official PHP SDK for Model Context Protocol servers and clients. Maintained in collaboration with The PHP Foundation. Stars: 1587, Forks: 167. Primary language: PHP. Languages: PHP (99.8%), Makefile (0.2%), Twig (0.1%). Homepage: https://php.sdk.modelcontextprotocol.io Topics: mcp, mcp-client, mcp-server, php. Latest release: v0.7.1 (1w ago). Open PRs: 14, open issues: 56. Last activity: 2h ago. Community health: 87%. Top contributors: chr-hertel, CodeWithKyrian, Nyholm, soyuka, OskarStark, bigdevlarry, dependabot[bot], luoyue712, bb-c24, e0ipso and others.

·@ofershap

Replace github.com with gitshow.dev