Releases: NexusPHP/mcp
Releases · NexusPHP/mcp
Release list
v0.5.0
What's Changed
Important
This is the last version supporting the 2025-11-25 spec version. All subsequent versions are now geared towards the upcoming new version: 2026-07-28.
Added
- An online API reference for the public
Nexus\Mcp\API, generated from the source with ApiGen and published to GitHub Pages on every push to1.x.
Fixed
- The
#[InputSchema]attribute'sdefinitionparameter no longer claims to be a full schema override in its PHPDoc. Only thetype,$schema,properties, andrequiredkeys of a supplieddefinitionreach the advertised toolinputSchema, which the annotation now documents. - A discovered tool that returns an array the adapter cannot map (a non-empty list whose items are not all content blocks, or an integer-keyed array that is not valid structured content) now throws
UnsupportedReturnValueExceptionnaming the handler method, instead of a bareExpectationFailedException, matching every other unsupported-return path. - A JSON-RPC error response whose
error.datais a non-object JSON value (string, number, list, or boolean) no longer fails to decode. The spec typesError.dataasunknown, soError::$dataand the response parser now accept any JSON value instead of rejecting a non-object. Previously the client discarded such a response without rejecting the correlated request, leaving the caller'sawait()unresolved. - A peer-supplied
jsonrpcversion value carrying control characters is now escaped (non-printable bytes rendered as\xNN) in the version-mismatch error message instead of being emitted raw, consistent with how the method-name fields are already rendered. This stops a peer from forging newlines in plain-text sinks that record the rejection. - A failed transport send during
Client::sendRequest()orClient::initialize()no longer leaves the correlated request registered. Previously, ifsend()threw after the request was registered (for example, writing to an already-closed transport), the pending-request entry was never freed, slowly growing the correlation map. The client now releases the registration before propagating the send failure.
Full Changelog: https://github.com/NexusPHP/mcp-sdk/compare/v0.4.0...v0.5.0
v0.4.0
What's Changed
Added
- Attribute-based registration. Mark methods with
#[AsTool],#[AsPrompt],#[AsResource], or#[AsResourceTemplate], and a class with#[AsServer], then register the object viaServerBuilder::register(object ...$sources). A tool'sinputSchemaand a prompt'sargumentsare inferred from the method signature and@paramdocblocks (overridable per parameter with#[InputSchema]). AServerContextparameter is injected, and a plain return value (string, content block, or schema object) is adapted to the matching result. #[AsServer]supplies the server identity and instructions. An explicitsetServerInfo()/setInstructions()call wins per field and the attribute fills only the gaps, regardless of call order. More than one#[AsServer]across registered sources throwsDuplicateServerMetadataException.- A variadic parameter on an
#[AsTool]method maps to an array input and is spread back into the call. The same parameter on a prompt, resource, or resource template throwsUnsupportedVariadicParameterException. ServerBuilder::register()rejects a source that carries no#[AsServer]and no attribute-marked method withMissingDiscoveryAttributeException, catching typo'd attribute names and objects passed in by mistake.- An
#[AsTool]parameter typed as an instantiable class is expanded into an object input schema built from the class constructor, and the handler receives a constructed instance. Expansion is one level deep: a nested object, a list of objects, an interface, or an abstract class is not expanded and throws. ServerBuilder::setToolStore(),setPromptStore(),setResourceStore(), andsetResourceTemplateStore()swap in a custom store implementation, replacing the in-memory one built from the matchingaddTool()/addPrompt()/addResource()/addResourceTemplate()entries. These mirror the existingsetCompletionStore().
Changed
- Mutation testing no longer times out while covering the shutdown coroutine drain.
- Public accessors now follow a verb-first naming scheme:
Request/Notification::getMethod()(wasmethod()), the protocol exceptions'getErrorCode()(waserrorCode()),TransportInterface::getSessionId()(wassessionId()),BaseMetadata/Tool::getDisplayName()(wasdisplayName()), andInMemoryTransport::createPair()(waspair()).
Removed
- The static
Server::builder()/Client::builder()factories. Construct the builders directly withnew ServerBuilder()/new ClientBuilder().
Full Changelog: https://github.com/NexusPHP/mcp-sdk/compare/v0.3.0...v0.4.0
v0.3.0
What's Changed
Added
Client::getServerCapabilities()returns theServerCapabilitiesnegotiated during the handshake, ornullbefore it completes.- The client now gates typed requests on the server's advertised capabilities: calling a method whose capability the server did not advertise (e.g.
tools/listwithout atoolscapability) throwsServerCapabilityNotSupportedExceptionbefore the request reaches the transport.pingis never gated.
Fixed
- Closing a
StdioClientTransportwhose subprocess is still running no longer fatals on PHP builds without thepcntlextension (such as Windows). The transport now terminates the subprocess viaProcess::kill()instead of theSIGKILLconstant.
Changed
StdioClientTransportnow prunes the spawned subprocess environment by default instead of inheriting the full parent environment. Theenvconstructor argument changed fromarray $env = []to?array $env = null:null(default) passes a safe allowlist (PATH,HOME,TERM, …) drawn from the parent and skips exported shell-function values. An empty array still inherits the full parent environment. A non-empty array is passed verbatim.
Full Changelog: https://github.com/NexusPHP/mcp-sdk/compare/v0.2.0...v0.3.0
v0.2.0
What's Changed
Fixed
- Sampling requests (
sampling/createMessage) no longer reject atemperaturevalue outside0.0to2.0. The MCP schema sets no bound on the field, so the previous range rejected spec-valid input. - Sampling requests (
sampling/createMessage) no longer reject a negativemaxTokens. The MCP schema sets no minimum on the field. - A request envelope with a malformed
id(wrong type or empty string) now returns a-32600Invalid Request error instead of-32602Invalid Params, matching JSON-RPC 2.0. - Shutdown now drains handler coroutines spawned while an earlier batch of in-flight work is still being awaited, instead of returning before they complete.
Removed
HandlerRegistry::methods(), an unused accessor returning the registered method names.
Full Changelog: https://github.com/NexusPHP/mcp-sdk/compare/v0.1.0...v0.2.0
v0.1.0
Initial release
Added
- MCP server runtime:
ServerBuilderplusServer, with tools, prompts, resources (static and RFC 6570 templated), completions, logging, and ping handlers against MCP spec 2025-11-25. - MCP client runtime:
ClientBuilderplusClient, with theinitializehandshake, typed request methods (listTools,listResources,listResourceTemplates,listPrompts,readResource,getPrompt,complete,callToolwith streaming progress,ping,setLoggingLevel), and thesendRequestescape hatch. - Tool I/O JSON Schema validation:
tools/callarguments are checked against the tool'sinputSchemaand a result'sstructuredContentagainst itsoutputSchema, backed byopis/json-schemaand pluggable viaSchemaValidatorInterface/ServerBuilder::setSchemaValidator(). - A tool returning
structuredContentwith no content blocks gets a serialised-JSONTextContentmirror for backwards compatibility. - Stdio transport for both server and client, plus an in-memory paired transport for tests.
- JSON-RPC 2.0 envelope and MCP schema types under
Nexus\Mcp\Core. - Every SDK exception implements
McpExceptionInterface, so consumers can catch all SDK errors in one block.
Full Changelog: https://github.com/NexusPHP/mcp-sdk/commits/v0.1.0