mcp_dart 2.3.0-dev.2
mcp_dart: ^2.3.0-dev.2 copied to clipboard
Dart and Flutter SDK for building Model Context Protocol (MCP) servers, clients, hosts, and AI tools.
2.3.0-dev.2 #
This preview makes MCP 2026-07-28 the preferred protocol while preserving
MCP 2025-11-25 and earlier initialization compatibility.
Changed #
- Made
McpProtocol.stablethe default dual-era profile: prefer statelessserver/discover, then fall back to legacy initialization. UseMcpProtocol.require2026to reject legacy peers. - Added clearer preview, stable, default, and initialization-version constants,
while retaining
latestProtocolVersionas a deprecated stable-version alias. - Added and aligned MCP 2026-07-28 APIs for
input_required, deprecated request-scoped logging compatibility, subscriptions, cache metadata, arbitrary structured tool output, routing headers, and the Tasks extension. - Hardened discovery fallback, Streamable HTTP validation and pagination, SSE closure and request cancellation, URL elicitation, and client reconnect state.
- Upgraded built-in validation to JSON Schema Draft 2020-12 with declared Draft 7 compatibility and same-document references; unsafe external references remain blocked.
- Retained the web/WASM-safe default export path alongside Dart IO exports.
Breaking and compatibility notes #
- Removed
McpProtocol.preview2026;McpProtocol.stablenow provides its dual-era fallback behavior. UseMcpProtocol.legacyfor the former initialization-only default orMcpProtocol.require2026for strict MCP 2026-07-28. The minimum Dart SDK is now 3.5. - Renamed
draftProtocolVersion2026_07_28topreviewProtocolVersion,latestDraftProtocolVersiontodefaultProtocolVersion, andstableProtocolVersion2025_11_25tolatestInitializationProtocolVersion(orstableProtocolVersion). ReplacesupportedProtocolVersionsWithDraftwithsupportedProtocolVersions; uselegacyProtocolVersionsfor the former legacy-only list. - Added cancellation members to
StartSseOptions, andStreamableHttpClientTransportnow implements the newRequestCancellationAwareTransportinterface. Classes that directlyimplementseither concrete type must add the new members; normal callers, subclasses, and customTransportimplementations remain source-compatible. CreateMessageRequestnow rejects invalid sampling tool-use/result roles, ordering, and ID matches during parsing and serialization.- JSON Schema validation now follows Draft 2020-12 by default and declared
Draft 7, so outcomes and errors may differ. Unsupported dialects, custom
vocabularies, unresolved external references, schemas deeper than 64 levels,
and more than 1,024 subschemas are rejected.
JsonSchema.fromJson()may returnJsonAny; the package now depends onjson_schema ^5.2.2. - MCP 2026-07-28 cancellation closes only the matching Streamable HTTP POST
response stream, while MCP 2025-11-25 retains
notifications/cancelled. StreamableHttpClientTransportnow rejects duplicate active stateless request IDs, ends POST SSE streams at their terminal response, ignores trailing events on that response, and interrupts pending OAuth/HTTP work when closed.
Security #
- OAuth authorization-code flows now require matching state, reject untrusted discovery origins, insecure endpoints, unsupported token authentication methods, and automatic endpoint redirects.
- Unexpected handler and validation failures no longer expose internal details in protocol responses; details remain available in server logs.
- Credentialed Streamable HTTP CORS now requires
allowedOrigins, except for DNS-protected loopback development; examples use safe loopback defaults. - Added explicit stdio child-environment isolation and hardened provider examples to withhold API keys, drain child stderr, refresh bounded tool inventories, and require approval for every tool call.
Validation and documentation #
- All current official MCP 2025-11-25 and MCP 2026-07-28 conformance scenarios applicable to the SDK's core client/server roles pass, with bidirectional TypeScript/Python interop, real Chrome transport coverage, a Flutter Web service integration, and widget tests. A pinned JSON Schema Test Suite gate independently exercises the supported Draft 2020-12 and Draft 7 validation surfaces.
- Added a strict MCP 2026-07-28 example, retained labeled legacy examples, refreshed the protocol coverage matrices, and shortened release and onboarding docs.
- Release retries now validate tag provenance, while prerelease documentation and CLI binaries use immutable, version-matched release metadata.
2.3.0-dev.1 #
This dev preview refreshes MCP 2026-07-28 draft/RC support while keeping MCP
2025-11-25 as the default protocol profile.
MCP 2026-07-28 draft/RC refresh #
- Aligned draft protocol-defined error codes with the live draft:
HeaderMismatchis now-32020,MissingRequiredClientCapabilityis now-32021, andUnsupportedProtocolVersionis now-32022. - Marked
server/discoveras an MCP 2026-07-28 cacheable result so stateless responses include defaultttlMsandcacheScopehints. - Removed the legacy
DRAFT-2026-v1draft alias now that official conformance targets the2026-07-28wire version. - Ported the JSON Schema boolean-subschema preservation fix onto the RC dev line, including legacy tool-schema shims.
Conformance and interoperability #
- Updated official conformance gates to
@modelcontextprotocol/conformance@0.2.0-alpha.4, with full MCP 2026-07-28 RC server scenario coverage and alpha.4's spec-filtered MCP 2026-07-28 client scenario list in CI. - Expanded the manual TypeScript SDK 2026-07-28 RC interop fixture pinned to the
upstream PR #2327 preview package, covering modern negotiation,
server/discovercache metadata,tools/list,tools/call,x-mcp-headermirroring, progress notifications, raw HTTP header validation, unsupported-version and removed core RPC rejection,subscriptions/listen, and Streamable HTTP SSE cancellation. - Added a diagnostic Dart preview client -> TypeScript server alpha path and
documented the current TS alpha gaps around mandatory
server/discoverand statelessresultTyperesponses.
2.3.0-dev.0 #
This is a dev preview for MCP 2026-07-28 draft/RC support. MCP
2025-11-25 remains the default protocol profile; draft/RC behavior is enabled
explicitly and may still change before the official spec release.
MCP 2026-07-28 draft/RC preview #
- Added
McpProtocol.preview2026andMcpProtocol.require2026profiles for clients and servers, with stableinitializebehavior preserved by default. - Added
server/discovernegotiation, per-request stateless metadata, protocol/client/capability validation, and version-aware fallback behavior. - Added stateless Streamable HTTP behavior for POST-only requests, no
Mcp-Session-Id,Mcp-Nametask routing,Mcp-Param-*argument headers, CORS preflights, SSE cancellation, and request-scoped logging. - Added draft-only flows for
subscriptions/listen, MCP Tasks extension handlers, MRTRinput_requiredresults, cacheable list/read results, andinput_requiredprompt/resource responses. - Added explicit typed APIs for non-object draft result data, including
JsonValue,structuredContentJson,CallToolResult.fromStructuredArray(), and serveroutputJsonSchema.
Stable compatibility #
- Kept stable public tool-result APIs object-rooted and omitted non-object
structured output from stable MCP
2025-11-25responses. - Preserved stable session behavior, registration-order list output, legacy task
augmentation, stable-only
Tool.executionmetadata, and legacy resource error codes outside the MCP 2026-07-28 stateless profile. - Preserved numeric JSON-RPC request IDs and progress tokens end-to-end while continuing to reject non-finite numeric values.
Spec hardening #
- Tightened JSON-RPC envelope parsing, wrapper constant checks, error object
validation,
_metakey validation, and mixed request/response rejection. - Accepted and preserved JSON Schema 2020-12 boolean subschemas in nested
schema positions such as object properties, array items, composition
keywords, and
not. - Tightened typed parsing for content, resources, prompts, tools, roots, sampling, elicitation, tasks, subscriptions, completions, capabilities, and JSON Schema fields so malformed wire values fail with protocol errors instead of Dart cast errors.
- Validated JSON-only metadata and result data across JSON-RPC, MRTR, task, subscription, sampling, tool, resource, and content boundaries.
Conformance and release readiness #
- Added official MCP
2025-11-25and MCP2026-07-28draft/RC client/server conformance gates to core CI. - Added
tool/spec_example_audit.dartfor parsing upstream machine-readable spec examples through checked-in SDK types during RC/final release audits. - Prepared the dev release workflow so prerelease tags are GitHub prereleases,
publish jobs run
dart pub publish --dry-run, and the draft/RC transition guide includes a dev release checklist. - Pointed prerelease package documentation links at
dev/2026-07-28-rcso pub.dev users see the draft/RC docs that match the dev package.
2.2.2 #
Platform support #
- Made the package barrel's default export path web/WASM-safe while preserving Dart IO native exports, working around pub.dev/pana 0.23.13 WASM platform scoring for conditional exports.
2.2.1 #
Spec Alignment #
- Accepted and preserved JSON Schema 2020-12 boolean subschemas in nested
schema positions such as object properties, array items, composition
keywords, and
not.
2.2.0 #
Documentation #
- Added interoperability, Flutter recipe, and migration cookbook guides, and expanded MCP Apps example guidance with host compatibility notes.
- Added an MCP 2025-11-25 spec coverage matrix that maps high-risk requirements to unit tests, TypeScript interop tests, CLI conformance cases, and known follow-up gaps.
- Added deployment-oriented security coverage for Streamable HTTP Host/Origin allowlists, auth gating, compatibility-toggle trade-offs, and OAuth PKCE S256 example flow, including TypeScript SDK OAuth interop coverage.
- Documented first-class OAuth protected-resource metadata and bearer challenge
support for
StreamableMcpServer. - Refreshed example documentation for current stdio, weather, Streamable HTTP, Flutter, Jaspr, and MCP Apps flows, including non-credentialed smoke commands.
- Refreshed additional guide snippets for request timeouts, task capability
pre-advertisement, progress reporting, local documentation links, and
documented
dart runtargets. - Improved pub.dev discoverability metadata with a clearer package description, documentation link, topics, platform declarations, and package page summary copy.
Spec Alignment #
- Preserved the MCP
Result._metafield across typed result serializers, including initialization, roots, resources, prompts, completion, elicitation, tools, tasks, sampling, and empty results. - Aligned stable completions support with MCP 2025-11-25 by advertising
{"completions": {}}and moving the old completion list-changed helper to an explicit experimental notification namespace. - Aligned URL-mode elicitation responses with MCP 2025-11-25: URL accept
results now serialize only the user
action, while completion still usesnotifications/elicitation/complete.ElicitResult.fromJson()now rejects actions outsideaccept,decline, andcancel. - Changed titled
JsonEnumoutput to JSON Schema 2020-12-nativeoneOfor array-itemanyOfconst/title entries while continuing to parse legacyenumNamespayloads. - Added first-class MCP OAuth client discovery for
StreamableHttpClientTransportthrough optionalOAuthAuthorizationCodeProvidersupport: bearer challenge parsing, protected-resource metadata discovery, authorization-server/OIDC metadata discovery, PKCE S256 authorization URLs withresource, and token exchange withcode_verifierandresource. - Added
OAuthAuthorizationCodeTokensfor token response metadata returned by the authorization-code exchange path without changing the baseOAuthTokensAPI shape used by existing providers and subclasses. - Added
StreamableMcpAuthenticationResultfor high-level Streamable HTTP servers that need to distinguish allow, unauthorized, and OAuthinsufficient_scope403 responses while preserving the existing boolauthenticatorpath. - Tightened MCP/JSON-RPC boundary validation for request IDs, progress tokens,
cancellation request IDs, and sampling tool-use capability gating so malformed
wire values and unsupported
sampling.toolsrequests fail before handler code runs. - Added optional
StreamableMcpServerOAuth protected-resource support that serves OAuth Protected Resource Metadata and returns spec-shapedWWW-Authenticate: Bearer ... resource_metadata=...challenges for failed authentication, including an explicit public metadata URL for reverse-proxy deployments, while preserving legacy generic-auth403behavior when the option is not configured. - Enforced MCP task related-metadata and progress rules by overwriting reserved related-task metadata from the SDK's source task id, preserving unrelated handler metadata, and rejecting repeated/decreasing progress values before sending invalid progress notifications.
- Added MCP
completion/completewire support forcontext.argumentsandPromptReference.title, including context-aware server completion callbacks for prompt and resource-template completions. - Enforced explicit task-augmented request negotiation via
tasks.requests.*: task-based tool calls requiretasks.requests.tools.call, server-initiated task sampling requirestasks.requests.sampling.createMessage, and server-initiated task elicitation requirestasks.requests.elicitation.create. - Enforced MCP lifecycle ordering for incoming protocol messages: servers now
reject operation requests before
initializeand beforenotifications/initialized, and clients now reject server-initiated operation requests before sendingnotifications/initialized. - Validated
elicitation/createparameters as the MCP 2025-11-25 form/URL union, including URL-only client handler registration and unsupported elicitation-mode rejection. - Added MCP 2025-11-25 stable metadata coverage for
Resource.size,Root._meta, stableicons, resource annotations, and tool annotations. Legacy singulariconfields and non-stable annotation helper fields remain parse-compatible but are no longer emitted on stable schema objects. - Enforced stable
Tool.inputSchemaandTool.outputSchemaroot-object shapes at parse and serialization boundaries while preserving the existingJsonSchema-typed public fields for source compatibility. - Aligned JSON-RPC response ID handling with the MCP schema: result responses
require a string or integer
id, error responses may omitid, and malformed response IDs fail during parsing. - Stopped serializing non-stable server capability fields such as top-level
elicitationandtasks.listChanged; legacy payloads still parse for compatibility. - Tightened MCP form elicitation validation to require object-root
requestedSchemavalues with primitive property schemas, restrictedElicitResult.contentto spec-supported primitive values, and validated URL-required error data. - Kept task
_metaonly where MCP permits result or notification metadata: bare nestedTaskvalues in task lists and task creation results no longer serialize_meta. - Refused OAuth authorization-code discovery when the authorization server
metadata omits
code_challenge_methods_supportedor does not advertiseS256. - Added Streamable HTTP resumability priming events so server-initiated SSE
streams with an
EventStorebegin with an eventidand emptydataframe, matching the MCPLast-Event-IDreconnection guidance.
Compatibility Notes (Potentially Breaking) #
- MCP 2025-11-25 wire validation is stricter:
- Stable metadata serializers no longer emit legacy singular
iconfields,ResourceAnnotations.title,ToolAnnotations.priority, orToolAnnotations.audience; those fields still parse into deprecated Dart accessors for one compatibility window. - Missing required result arrays such as
resources,resourceTemplates,contents,prompts,tools,roots, andtasksnow fail during parsing. Empty arrays remain valid when the required key is present. Tool.inputSchema,Tool.outputSchema, and form elicitationrequestedSchemavalues must serialize as root JSON objects. Primitive root schemas are rejected at the MCP wire boundary.- Successful JSON-RPC responses with
id: nullare rejected. Error responses may omitid; legacyid: nullerror payloads still parse, but serialize by omitting the field. - OAuth authorization-code discovery now requires advertised PKCE
S256support; clients refuse servers that omitcode_challenge_methods_supported.
- Stable metadata serializers no longer emit legacy singular
- Stable completion list-changed wire behavior is removed:
ServerCapabilitiesCompletions(listChanged: true)remains source-compatible and still parses legacy payloads, but serializes as the stable MCPcompletions: {}capability.sendCompletionListChanged()is deprecated and emitsnotifications/experimental/completions/list_changedinstead of the non-spec stable method.
- URL-mode elicitation result echoes are no longer emitted:
- Deprecated
ElicitResult.urlandElicitResult.elicitationIdfields remain parse-compatible for legacy payloads, buttoJson()omits them. - Invalid
ElicitResult.actionvalues now fail during parsing.
- Deprecated
- Lifecycle and elicitation validation are stricter:
- Peers that send operation requests before initialization completes now
receive
invalidRequesterrors instead of reaching request handlers. - Invalid form/URL
elicitation/createparameter combinations now fail during parsing or serialization. - No public API signatures were removed or renamed; this is a behavioral wire-protocol compatibility change.
- Peers that send operation requests before initialization completes now
receive
- Task cancellation now returns the final task state:
tasks/cancelresponses now serialize the cancelledTaskrequired by MCP 2025-11-25 instead of an empty result object.- New spec-compliant APIs expose that result explicitly:
onCancelTaskWithResult,CancelTaskCallback,CancelTaskResultHandler.cancelTaskWithResult, andTaskClient.cancelTaskWithResultreturn the cancelledTask. - Legacy APIs remain source-compatible for one compatibility window:
onCancelTask,ToolTaskHandler.cancelTask, andTaskClient.cancelTaskare deprecated shims. The server-side legacy shims still return a full cancelledTaskon the wire by resolving the post-cancel task throughonGetTask/getTask. TaskClient.cancelTaskWithResultexpects a task-shaped result and will reject older non-compliant servers that still return{}. DeprecatedTaskClient.cancelTaskremains available when callers intentionally need the legacy empty-result behavior.Task.fromJson()requires MCP-required task fields (createdAt,lastUpdatedAt, andttl), and theTaskconstructor now requiresttl,createdAt, andlastUpdatedAtso serialization is non-throwing for valid task instances.TaskStatusNotification.fromJson()likewise requires the full MCPNotificationParams & Taskshape (taskId,status,ttl,createdAt, andlastUpdatedAt), and task status notifications always serialize the requiredttlkey even when it isnull.Task.toJson()continues to serialize requiredttleven when it isnull, and now omits optionalpollIntervalwhen it is not set.- Task stores now treat terminal tasks (
completed,failed,cancelled) as immutable, preventing later status or result overwrites.
- Streamable HTTP session/replay semantics are stricter:
- Custom
sessionIdGeneratoroutput must now be non-empty visible ASCII without spaces or control characters; invalid generated IDs fail initialization before anMCP-Session-Idheader is written. - Concurrent standalone GET SSE streams no longer receive broadcast copies of each server-originated message. Messages are routed to one active stream so resumability can preserve the MCP stream ownership boundary.
- Custom
EventStoreimplementations must return non-empty visible-ASCII SSE event IDs without spaces or control characters, scopeLast-Event-IDreplay to the owning live transport/session stream, and reject unknown or foreign event IDs instead of replaying unrelated stream history.
- Custom
Compatibility Notes #
- Custom transports remain source-compatible while string request routing is available:
Transport.send(... relatedRequestId: ...)keeps the existingint?signature for third-party custom transports and middleware.- Transports that route by JSON-RPC request ID can opt into
RequestIdAwareTransport.sendWithRequestId(... relatedRequestId: ...)to receive the full MCP/JSON-RPC request ID shape (Stringorint). - Middleware wrappers that implement
RequestIdAwareTransportshould forward throughsendPreservingRequestId(...)so string IDs are not dropped.
Reliability #
- Scoped Streamable HTTP SSE resumability to the stream identified by
Last-Event-ID, allowing multiple concurrent GET SSE streams per session without replaying events from unrelated streams. - Routed each server-originated standalone GET SSE message to one active stream instead of broadcasting the same JSON-RPC message across concurrent streams, and retried another active stream when the selected target was stale.
- Returned
404 Session not foundfor stale, unknown, or terminated Streamable HTTP session IDs across high-level and bare transports, retried client initialization once without a stale preconfigured session ID, refreshed stale sessions with single-flight reinitialization before retrying post-initialize requests, and stopped old SSE reconnect loops after a session reset. - Honored
RequestOptions.resetTimeoutOnProgressandmaxTotalTimeouttogether so progress notifications can reset inactivity timers without bypassing the absolute total timeout cap. - Supported string progress tokens end-to-end for outgoing requests that supply
a custom
progressToken, while preserving generated integer tokens for the defaultRequestOptions.onprogresspath. - Preserved string JSON-RPC request IDs when handler code sends nested requests, notifications, or cancellation notifications, keeping related-request routing compatible with clients that use string IDs.
- Improved JSON Schema parsing and validation for
const, enum-only schemas, titled enumconstentries, and simpletypearray unions such as nullable schemas. - Fixed browser example interoperability by allowing the MCP protocol-version header in CORS preflight responses, mapping Flutter prompt input to advertised prompt arguments, and using typed DOM inputs in the Jaspr client.
Tooling #
- Added
mcp_dart conformancewith built-in JSON-RPC and protocol-version fixture checks, deterministic JSON-RPC fuzz cases, exact-case filtering, and JSON output for CI/scripts. - Added a
mcp_dart conformance --suite specgate for MCP 2025-11-25 lifecycle, capability, elicitation, task-metadata, and progress-token raw-wire checks. - CI now runs
mcp_dart conformance --suite all --jsonso JSON-RPC and protocol-version fixtures are checked with the spec suite. - Added local non-credentialed example smoke tests for stdio, iostream, required-field schema preservation, CLI inspect, completions, and MCP Apps metadata examples.
- Added Markdown documentation guards for broken local links and documented
dart runtargets.
2.1.1 #
Compatibility Notes (Potentially Breaking) #
JsonEnumwire format is now standard JSON Schema:JsonEnum.toJson()emits standard JSON Schema enum forms instead of the legacytype: 'enum'/valuesshape.- Legacy serialized enum input using
valuesis still accepted when parsing.
Reliability #
- Fixed
JsonEnumtool/input schema serialization to use standard JSON Schema enum output, improving compatibility with downstream consumers that reject the legacytype: 'enum'/valuesshape. - Serialized concurrent stdio transport writes so overlapping requests no longer
trip Dart
IOSinkwrite/flush errors.
Documentation #
- Updated installation snippets and schema/stdio transport guidance for the 2.1.1 release.
2.1.0 #
Compatibility Notes (Potentially Breaking) #
- Streamable HTTP defaults are stricter:
- DNS rebinding protection is enabled by default for Streamable HTTP server entry points.
- Unsupported
MCP-Protocol-Versionrequest headers are rejected by default. - JSON-RPC batch POST payloads are rejected by default.
- Use compatibility toggles to preserve legacy behavior during rollout:
strictProtocolVersionHeaderValidation: falserejectBatchJsonRpcPayloads: falseenableDnsRebindingProtection: false
- Sampling response shape can now be multi-block:
SamplingMessage.contentandCreateMessageResult.contentmay be either a single block or a list.- Prefer normalized access via
contentBlocks.
- Enum expansion:
StopReasonnow includestoolUse; exhaustiveswitchstatements may need an additional branch.
Features #
- Added SDK runtime logging helper APIs:
setMcpLogHandler,resetMcpLogHandler, andsilenceMcpLogs. - Added
Logger.resetHandler()to restore the default internal log output. - Added backward-compatible sampling/content API shims while keeping 2025-11-25 wire-format compliance:
CreateMessageRequest.toolChoicesupports legacy map and typedToolChoiceSamplingMessage.contentandCreateMessageResult.contentaccept single or array content forms with normalizedcontentBlocksaccessResourceLink.annotationssupports map form with typedparsedAnnotationsaccessor
- Added Streamable HTTP compatibility toggles:
strictProtocolVersionHeaderValidationrejectBatchJsonRpcPayloads
- Added related-task metadata compatibility behavior by dual-writing
io.modelcontextprotocol/related-taskand legacyrelatedTaskkeys.
Documentation #
- Added runtime logging guidance with
package:loggingintegration examples using import aliases. - Updated transport logging middleware examples to match SDK logger methods (
debug/info/warn/error). - Added
doc/migration_2025_11_25_compat.mdwith compatibility-mode and API migration guidance. - Updated transport/client/quick-reference docs for strict defaults and compatibility toggles.
Reliability #
- Fixed Streamable HTTP
Acceptheader parsing to handle repeated/multi-value headers without throwingHttpException, improving compatibility with clients that send duplicated or splitAcceptvalues. - Centralized DNS rebinding validation across Streamable HTTP and legacy SSE server entry points.
- Added interop coverage for Dart/TypeScript sampling flows (
sampling.toolscapability and tool-choice propagation).
2.0.0 #
Breaking Changes #
- JSON Schema API:
JsonObject.additionalPropertiesandJsonSchema.object(additionalProperties: ...)now useObject?instead ofbool?.additionalPropertiesmay now be eitherboolorJsonSchema, matching the JSON Schema specification.
Features #
- MCP Apps Support:
- Added typed MCP Apps metadata models and helpers (
McpUiToolMeta,McpUiResourceMeta,McpUiCsp,McpUiPermissions) with extension capability helpers forio.modelcontextprotocol/ui. - Added TypeScript-style server helpers (
registerAppTool,registerAppResource,getUiCapability) and metadata normalization for_meta.ui.resourceUriand legacy_meta['ui/resourceUri']. - Added MCP Apps server examples for helper-based and manual metadata wiring.
- Added typed MCP Apps metadata models and helpers (
Compatibility #
- Host Rendering:
- Updated MCP Apps weather examples to use host-safe tool names (
weather_get_current), include explicitresource_linktool output, and demonstrate host-rendered UI updates from tool input/result notifications.
- Updated MCP Apps weather examples to use host-safe tool names (
Documentation #
- Added and expanded MCP Apps documentation across guides and quick reference, including host compatibility guidance for tool naming constraints.
Reliability #
- JSON Schema Parsing:
- Fixed
JsonObject.fromJsonto accept untyped map values foradditionalProperties(for example{}decoded asMap<dynamic, dynamic>), so schema objects are not silently dropped.
- Fixed
1.3.0 #
- Spec Alignment:
- Added
ResourceLink(resource_link) content type support. - Added icon metadata support with
McpIcon,IconTheme, and optionaliconsfields across tools/prompts/resources/templates. - Added
ResourceAnnotations.lastModified(ISO 8601). - Added MCP
extensionscapability support for client/server initialization capability negotiation.
- Added
- Security:
- Added optional DNS rebinding protection to streamable HTTP/SSE server entry points via host/origin allowlists.
- Reliability:
- Tightened null handling for JSON-RPC tool params and task store TTL parsing paths.
- Fixed URI template matching for RFC 6570 multi-variable operators (for example
{?status,assignee}) soresources/readresolves templated URIs correctly. - Fixed tool metadata passthrough so registered
meta(including nested_metavalues) is preserved intools/listresponses. - Improved URI template variable typing and protocol cancellation reason typing.
- Docs:
- Updated transport, client, server, tools, and quick-reference docs for new fields and security options.
1.2.2 #
- Fix pana analysis issues
1.2.1 #
-
Features:
- Progress Notifications: Implemented full support for progress tracking.
- Added
RequestHandlerExtra.sendProgress()helper for servers to report progress. - Added
RequestOptions.onprogresscallback for clients to receive progress updates. - Updated
ProgressandProgressNotificationtypes to include optionalmessagefield (compliant with the MCP 2025-11-25 specification).
- Added
- Protocol Improvements:
JsonRpcMessage.fromJsonnow supports custom/unknown methods instead of throwing.- Fixed
JsonRpcRequestmetadata extraction to correctly handle nested_metainparams. - Updated
ToolAnnotationsto maketitleoptional, preventing deserialization errors when the field is missing.
- Progress Notifications: Implemented full support for progress tracking.
-
Fixes:
- StreamableHTTP: Prevented the client from attempting to "reconnect" to short-lived POST response streams (used for tool calls). This fixes an issue where multiple tool calls could exhaust the browser's connection limit by spawning zombie reconnection attempts.
-
Examples:
- New Jaspr Client: Added a comprehensive web client example (
example/jaspr-client) built with Jaspr, featuring:- Interactive UI for Tools, Resources, Prompts, and Tasks.
- Real-time connection management.
- Visual task progression and sampling dialogs.
- Anthropic Client: Fixed issues in the Anthropic client example.
- Task Server: Added CORS headers and logging to
simple_task_interactive_server.dart. - Updated examples to remove deprecated API usage.
- New Jaspr Client: Added a comprehensive web client example (
-
Documentation:
- Overhauled documentation (
doc/) to match current API (v1.1.2+). - Added
AGENTS.mdwith comprehensive developer guidelines.
- Overhauled documentation (
-
Testing:
- Updated
test/types_test.dartandtest/types_edge_cases_test.dartto correct expectations for unknown methods.JsonRpcMessage.fromJsonreturns a genericJsonRpcRequest(orJsonRpcNotification) for unknown methods instead of throwing, aligning tests with existing library behavior.
- Updated
1.2.0 #
Breaking Changes #
Tip
All breaking changes below are auto-fixable. Run dart fix --apply to automatically update your code.
- Renamed Core Classes:
Clientis nowMcpClientto avoid conflicts with other libraries (likehttp).ClientOptionsis nowMcpClientOptions.ServerOptionsis nowMcpServerOptions.
- Renamed Request/Notification Parameters:
ReadResourceRequestParams->ReadResourceRequestGetPromptRequestParams->GetPromptRequestElicitRequestParams->ElicitRequestCreateMessageRequestParams->CreateMessageRequestLoggingMessageNotificationParams->LoggingMessageNotificationCancelledNotificationParams->CancelledNotificationProgressNotificationParams->ProgressNotificationTaskCreationParams->TaskCreation
1.1.2 #
- Fixed StdioClientTransport stderr handling: Corrected process mode to always use
ProcessStartMode.normalto ensure stdin/stdout piping works correctly. Fixed inverted stderr mode logic wherestderrMode: normalnow properly exposes stderr via getter (without internal listening), andstderrMode: inheritStdionow manually pipes stderr to parent process.
1.1.1 #
- Structured Content Support: Added explicit
structuredContentfield toCallToolResultwith automatic backward compatibility support.CallToolResult.fromStructuredContentnow automatically populates bothstructuredContent(for modern clients) andcontent(as JSON string for legacy clients).- Updated validation logic to correctly validate
structuredContentpayload against tool schema.
1.1.0 #
Breaking Changes #
- Protocol Version Update: Updated default protocol version to
2025-11-25. - Strict Capabilities Typing:
ServerCapabilitiesandClientCapabilitiesfields (tasks, sampling, elicitation, etc.) are now strictly typed objects instead ofMap<String, dynamic>orbool.- Updated
ServerCapabilitiesto useServerCapabilitiesTasks,ServerCapabilitiesTools, etc. - Updated
ClientCapabilitiesto useClientCapabilitiesTasks,ClientCapabilitiesElicitation,ClientCapabilitiesSampling, etc. - Migration: Update capability declarations to use the new typed classes (e.g.,
ServerCapabilities(tasks: ServerCapabilitiesTasks(listChanged: true))).
- Updated
- File Removal:
lib/src/server/mcp.darthas been removed. Uselib/src/server/mcp_server.dart(exported vialib/src/server/module.dart) instead. - Transport Interface Change:
Transport.sendnow accepts an optional named parameterrelatedRequestId. Custom transports must update their method signature. - Client Validation:
Client.callToolnow strictly validates tool outputs against their defined JSON schema (if present). Mismatches will throw anMcpError(ErrorCode.invalidParams). - API Refactoring:
McpServer.tool,resource, andpromptare deprecated. UseregisterTool,registerResource, andregisterPromptinstead.McpServer.registerTooluses a new callback signature:FutureOr<CallToolResult> Function(Map<String, dynamic> args, RequestHandlerExtra extra).- The deprecated
McpServer.toolretains the old named-parameter signature for backward compatibility.
- Tool Schema Definitions:
ToolInputSchema(akaJsonObject) now requires properties to be defined usingJsonSchemaobjects (e.g.,JsonSchema.string()) instead of raw Maps. - Tool Listing Types:
ListToolsRequestParamshas been replaced byListToolsRequest(update any code passingparams:toClient.listToolsor constructingJsonRpcListToolsRequest). - Tool Result Structured Content:
CallToolResultno longer uses a dedicatedstructuredContentfield in its API; structured results are represented as additional top-level fields (CallToolResult.extra).CallToolResult.fromStructuredContentnow takes a singleMap<String, dynamic>argument. - RequestHandlerExtra Signature Changes:
RequestHandlerExtra.sendNotificationandRequestHandlerExtra.sendRequesthave updated signatures (added task-related metadata/options). Update any server callbacks that call these helpers directly.
Features #
- Task Management System:
- Implemented comprehensive Task support in
lib/src/server/tasks/. - Introduced
TaskStoreabstract interface withInMemoryTaskStoreas the default implementation. - Added strictly typed
TaskResultHandlerandTaskSession. - Introduced
TaskMessageQueuefor handling task messages.
- Implemented comprehensive Task support in
- McpServer Enhancements:
- Added
McpServerhigh-level support for tasks viatasks(...)method. - Integrated
notifyTaskStatusintoMcpServer. - Added
McpServersupport forsampling/createMessage. - Exposed
onErrorhandler setter/getter onMcpServer.
- Added
- StreamableMcpServer:
- Added
StreamableMcpServerclass for simplified Streamable HTTP server creation (handlesserverFactory, event store, and connection management).
- Added
- Client Enhancements:
- Added
onTaskStatuscallback toClient. - Simplified client request handlers for sampling and elicitation.
- Added
Fixes #
- Fixed
Taskserialization. - Fixed capabilities recognition in
McpServer. - Added comprehensive tests for StreamableMcpServer and Task features.
1.0.2 #
- Fix pana analysis issues
- Fix Web support for StreamableHTTP client
1.0.1 #
- Fix Documentation links in README.md
1.0.0 #
- Update the supported protocol version to MCP 2025-06-18.
- Add Elicitation support (server-initiated input collection)
- API:
McpServer.elicitUserInput()(server) |Client.onElicitRequest(client handler) - Types: ElicitRequestParams (
message,requestedSchema), ElicitResult (action,content), ClientCapabilitiesElicitation - Uses
elicitation/createmethod (Inspector-compatible) - Accepts JSON Schema Maps for flexible schema definition
- Helpers:
.accepted,.declined,.cancelledgetters on ElicitResult - Example: elicitation_http_server.dart
- Tests: elicitation_test.dart
- API:
- CRITICAL FIX: Logger → stderr (prevents JSON-RPC corruption in stdio)
- Comprehensive Test Coverage: Added 203 new tests across 4 phases (+13.1% overall coverage: 56.9% → 70.0%)
- Phase 1: External API coverage (Server MCP, URI templates, Client/Server capabilities) - 108 tests
- Phase 2: Transport coverage (Stdio, SSE, HTTPS) - 38 tests
- Phase 3: Types & edge cases (Protocol lifecycle, error handling) - 45 tests
- Phase 4: Advanced scenarios (Protocol timeouts/aborts, Streamable HTTPS integration) - 12 tests
- Fixed critical URI template variable duplication bug
- Fixed McpError code preservation in request handlers
- All 351 tests passing ✅
0.7.0 #
- Add the Completions capability from the MCP 2025-06-18 specification.
- Add ServerCapabilitiesCompletions class for explicit completions capability declaration
- Update ServerCapabilities to include completions field
- Update client capability check to use explicit completions capability instead of inferring from prompts/resources
- Add integration tests and example for completions capability usage
0.6.4 #
- Fix issue with StreamableHTTP server not setting correct content-type for SSE
0.6.3 #
- Replace print statements with lightweight logging implementation
0.6.2 #
- Remove trailing CR before processing the lines
0.6.1 #
- Fix issue with CallToolResult not including metadata
0.6.0 #
- Add ToolInputSchema and ToolOutputSchema support in server.tool()
- Deprecate inputSchemaProperties and outputSchemaProperties in server.tool()
- Update examples to use ToolInputSchema and ToolOutputSchema
0.5.3 #
- Support Web Client for StreamableHTTP
0.5.2 #
- Preserve required fields in ToolInputSchema
0.5.1 #
- Add support for OutputScheme (https://modelcontextprotocol.io/specification/draft/server/tools#output-schema)
0.5.0 #
- Add support for the MCP 2025-03-26 specification.
0.4.3 #
- Fix SSE behavior on StreamableHTTP
- Added sendNotification and sendRequest to extra for server callbacks
0.4.2 #
- Add Tool Annotation
- Remove additionalProperties from all models
- Add AudioContent
0.4.1 #
- Add IOStreamTransport to connect a client and server via dart streams in a single application
0.4.0 #
- Add support for StreamableHTTP client
- Add support for StreamableHTTP server
0.3.6 #
- Improve pub.dev points
0.3.5 #
- Lower min dart sdk to 3.0.0
0.3.4 #
- Fix Sampling result parsing error
0.3.3 #
- Add Gemini MCP Client Example
- Add Anthropic MCP Client Example
- Add Weather MCP Server Example
0.3.2 #
- Add SSE Server Manager for easier SSE server implementation
0.3.1 #
- Add Client support (stdio)
- Add resource and prompts example to stdio server and client
0.3.0 #
- Full refactor of the codebase to match it with the Typescript SDK implementation.
0.2.0 #
- Make it no need to call trasnport.connect()
0.1.1 #
- Add examples visible in pub.dev
0.1.0 #
- Add SSE support
0.0.2 #
- Expose more types
0.0.1 #
- Initial version.