Skip to content

Releases: NexusPHP/mcp

v0.5.0

Choose a tag to compare

@paulbalandan paulbalandan released this 26 Jul 19:53
v0.5.0
c4bc793

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 to 1.x.

Fixed

  • The #[InputSchema] attribute's definition parameter no longer claims to be a full schema override in its PHPDoc. Only the type, $schema, properties, and required keys of a supplied definition reach the advertised tool inputSchema, 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 UnsupportedReturnValueException naming the handler method, instead of a bare ExpectationFailedException, matching every other unsupported-return path.
  • A JSON-RPC error response whose error.data is a non-object JSON value (string, number, list, or boolean) no longer fails to decode. The spec types Error.data as unknown, so Error::$data and 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's await() unresolved.
  • A peer-supplied jsonrpc version 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() or Client::initialize() no longer leaves the correlated request registered. Previously, if send() 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

Choose a tag to compare

@paulbalandan paulbalandan released this 26 Jul 19:53
v0.4.0
3ced46e

What's Changed

Added

  • Attribute-based registration. Mark methods with #[AsTool], #[AsPrompt], #[AsResource], or #[AsResourceTemplate], and a class with #[AsServer], then register the object via ServerBuilder::register(object ...$sources). A tool's inputSchema and a prompt's arguments are inferred from the method signature and @param docblocks (overridable per parameter with #[InputSchema]). A ServerContext parameter 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 explicit setServerInfo() / setInstructions() call wins per field and the attribute fills only the gaps, regardless of call order. More than one #[AsServer] across registered sources throws DuplicateServerMetadataException.
  • 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 throws UnsupportedVariadicParameterException.
  • ServerBuilder::register() rejects a source that carries no #[AsServer] and no attribute-marked method with MissingDiscoveryAttributeException, 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(), and setResourceTemplateStore() swap in a custom store implementation, replacing the in-memory one built from the matching addTool() / addPrompt() / addResource() / addResourceTemplate() entries. These mirror the existing setCompletionStore().

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() (was method()), the protocol exceptions' getErrorCode() (was errorCode()), TransportInterface::getSessionId() (was sessionId()), BaseMetadata/Tool::getDisplayName() (was displayName()), and InMemoryTransport::createPair() (was pair()).

Removed

  • The static Server::builder() / Client::builder() factories. Construct the builders directly with new ServerBuilder() / new ClientBuilder().

Full Changelog: https://github.com/NexusPHP/mcp-sdk/compare/v0.3.0...v0.4.0

v0.3.0

Choose a tag to compare

@paulbalandan paulbalandan released this 26 Jul 19:53
v0.3.0
e888395

What's Changed

Added

  • Client::getServerCapabilities() returns the ServerCapabilities negotiated during the handshake, or null before 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/list without a tools capability) throws ServerCapabilityNotSupportedException before the request reaches the transport. ping is never gated.

Fixed

  • Closing a StdioClientTransport whose subprocess is still running no longer fatals on PHP builds without the pcntl extension (such as Windows). The transport now terminates the subprocess via Process::kill() instead of the SIGKILL constant.

Changed

  • StdioClientTransport now prunes the spawned subprocess environment by default instead of inheriting the full parent environment. The env constructor argument changed from array $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

Choose a tag to compare

@paulbalandan paulbalandan released this 26 Jul 19:53
v0.2.0
a8a7032

What's Changed

Fixed

  • Sampling requests (sampling/createMessage) no longer reject a temperature value outside 0.0 to 2.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 negative maxTokens. The MCP schema sets no minimum on the field.
  • A request envelope with a malformed id (wrong type or empty string) now returns a -32600 Invalid Request error instead of -32602 Invalid 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

Choose a tag to compare

@paulbalandan paulbalandan released this 26 Jul 19:53
v0.1.0
c88df84

Initial release

Added

  • MCP server runtime: ServerBuilder plus Server, with tools, prompts, resources (static and RFC 6570 templated), completions, logging, and ping handlers against MCP spec 2025-11-25.
  • MCP client runtime: ClientBuilder plus Client, with the initialize handshake, typed request methods (listTools, listResources, listResourceTemplates, listPrompts, readResource, getPrompt, complete, callTool with streaming progress, ping, setLoggingLevel), and the sendRequest escape hatch.
  • Tool I/O JSON Schema validation: tools/call arguments are checked against the tool's inputSchema and a result's structuredContent against its outputSchema, backed by opis/json-schema and pluggable via SchemaValidatorInterface / ServerBuilder::setSchemaValidator().
  • A tool returning structuredContent with no content blocks gets a serialised-JSON TextContent mirror 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