Repository navigation
Prepare package slicing by strict namespace refactoring into Client, Schema, and Server - #493
Conversation
c8d14f9 to
d5c5cf5
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Numerous tests expect exceptions from the wrong slice, several examples reference invalid namespaces, and Deptrac is not enforced by CI.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Refactors the SDK into distinct Client, Schema, and Server namespaces in preparation for package slicing.
Changes:
- Moves facades, capabilities, events, exceptions, and shared protocol types into slice-specific namespaces.
- Updates tests, examples, documentation, and autoloading references.
- Adds Deptrac boundaries and inspector snapshots.
File summaries
| File group | Description |
|---|---|
src/Client/** |
Refactors client APIs and exceptions. |
src/Schema/** |
Consolidates shared protocol types and schema exceptions. |
src/Server/** |
Refactors server APIs, capabilities, events, and exceptions. |
tests/Unit/** |
Migrates unit tests and fixtures. |
tests/Integration/** |
Updates integration imports and fixtures. |
tests/Conformance/** |
Updates conformance entry points. |
tests/Inspector/** |
Adds structured-result snapshots. |
examples/** |
Migrates client and server examples. |
docs/**, README.md |
Updates public namespace guidance. |
composer.json, deptrac.yaml, phpstan.dist.neon, .gitignore |
Configures architecture tooling and relocated paths. |
Review details
Suppressed comments (1)
docs/client/errors.md:24
- Client requests throw
Mcp\Client\Exception\RequestException. Catching the server-slice sibling will not handle$client->callTool()failures.
- Files reviewed: 299/423 changed files
- Comments generated: 43
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fc18fd4 to
42859cd
Compare
|
For splitsh this is how we did on API Platform: https://github.com/api-platform/core/blob/main/.github/workflows/release.yml#L21-L50 Pretty straightforward, not sure how it works on Symfony but AFAIR it was a bit more complex :p. Note that testing may also be a bit of a headache if we allow wider version constraint on one of these packages... +1 to keep tests global to this repo (sometimes its interesting to have component specific tests especially that tests also get published along the source code though it makes things more complicated). |
42859cd to
42116a0
Compare
286038e to
a73fb33
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unchanged persistent cache keys can reuse discovery objects serialized under old namespaces, causing return-type failures after an upgrade instead of rediscovering capabilities.
1 open issue
43 resolved since last review
Changing this test namespace changes the::classvalues passed toHandlerResolver, but the…Toolnow raises the schema-slice exception, so expecting the unrelated server exception causes…ToolChoicenow throwsMcp\Schema\Exception\InvalidArgumentException; this sibling server… This result object throwsMcp\Schema\Exception\InvalidArgumentException; expecting the unrelated… This result object throwsMcp\Schema\Exception\InvalidArgumentException; expecting the unrelated… This result object throwsMcp\Schema\Exception\InvalidArgumentException; expecting the unrelated… This result object throwsMcp\Schema\Exception\InvalidArgumentException; expecting the unrelated…ResourceTemplatethrowsMcp\Schema\Exception\InvalidArgumentException; the sibling server…ResourceDefinitionthrowsMcp\Schema\Exception\InvalidArgumentException; the sibling server…CreateSamplingMessageRequestnow throws the schema-slice exception; expecting the server… The schema value object throws the schema-slice exception, so this server exception cannot satisfy…MessageFactorynow throwsMcp\Schema\Exception\InvalidArgumentException; expecting the server… The schema class now throwsMcp\Schema\Exception\InvalidArgumentException; expecting the…IconthrowsMcp\Schema\Exception\InvalidArgumentException; the server exception is unrelated…ExtensionIdentifierthrows the schema-slice exception; the server exception is unrelated and… The schema classes under test throwMcp\Schema\Exception\InvalidArgumentException; this server… This schema definition throws the schema-slice exception; the server exception is unrelated and… This schema definition throws the schema-slice exception; the server exception is unrelated and… This schema definition throws the schema-slice exception; the server exception is unrelated and… This schema definition throws the schema-slice exception; the server exception is unrelated and…
And 23 more resolved.
Review effort: Balanced
…Schema, and Server
Move ExtensionInterface::getRequestHandlers() to Mcp\Server\Extension\ServerExtensionInterface, so Mcp\Schema no longer references Mcp\Server, and move the header agreement tests that need both packages to the integration suite.
a73fb33 to
fa4ed5b
Compare


Prepares slicing
mcp/sdkinto separate packages, see #489Mcp\Client,Mcp\Schema, orMcp\ServerMcp\Exceptioninto component specific namespacesmake deptrac, part of theqajob):Schemadepends on nothing,ClientandServeronSchemaonlyBesides the namespaces there's one more BC break:
getRequestHandlers()moved fromExtensionInterfaceto the newMcp\Server\Extension\ServerExtensionInterface, sinceSchemamust not know server handlers. Both are in the CHANGELOG.SecureUrllives inMcp\Schemanow, with internal wrappers inClientandServerthat throw the package's own exception - not a perfect fit forSchema, but the only shared place until we split.Deptrac is on 3.0, since 4.x requires Symfony ^6.4 and we still test 5.4.
Next steps, as follow ups:
composer.jsonper component, with its own dependencies