Skip to content

Commit c29de26

Browse files
authored
Merge main platform support into 2026 RC
Merge current main into dev/2026-07-28-rc to inherit the stable web/WASM export workaround and resolve PR #281 conflicts.
2 parents 29a4cec + e7db2da commit c29de26

8 files changed

Lines changed: 681 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Unreleased
22

3+
### Platform support
4+
5+
- Inherited the stable 2.2.2 web/WASM-safe default export path, preserving
6+
Dart IO native exports while working around pub.dev/pana 0.23.13 WASM
7+
platform scoring for conditional exports.
8+
39
### Conformance and interoperability
410

511
- Updated official conformance gates to
@@ -112,6 +118,14 @@ explicitly and may still change before the official spec release.
112118
- Pointed prerelease package documentation links at `dev/2026-07-28-rc` so
113119
pub.dev users see the draft/RC docs that match the dev package.
114120

121+
## 2.2.2
122+
123+
### Platform support
124+
125+
- Made the package barrel's default export path web/WASM-safe while preserving
126+
Dart IO native exports, working around pub.dev/pana 0.23.13 WASM platform
127+
scoring for conditional exports.
128+
115129
## 2.2.1
116130

117131
### Spec Alignment

lib/mcp_dart.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export 'src/types.dart'; // Exports shared types used across the MCP protocol.
1313
export 'src/shared/uuid.dart'; // Exports UUID generation utilities.
1414
export 'src/shared/logging.dart'; // Exports logging for customization
1515

16-
// Platform-specific exports
17-
export 'src/exports.dart' // Stub export for other platforms
18-
if (dart.library.js_interop) 'src/exports_web.dart'; // Web-specific exports
16+
// Platform-specific exports.
17+
//
18+
// Keep the default branch web/WASM-safe. Pub.dev currently runs pana 0.23.13,
19+
// which does not select `dart.library.js_interop` for WASM platform scoring and
20+
// would otherwise follow the native `dart:io` exports. Native platforms still
21+
// get the full implementation through `dart.library.io`.
22+
export 'src/exports_web.dart' if (dart.library.io) 'src/exports.dart';

lib/src/client/module_web.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
library;
77

88
export './client.dart'; // Client-side implementation for MCP protocol.
9+
export './stdio_stub.dart'; // API-compatible stdio stubs.
910
export './streamable_https.dart'; // Streamable HTTPS implementation.
1011
export './task_client.dart'; // Task client helper.

lib/src/client/stdio_stub.dart

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import 'dart:async';
2+
3+
import 'package:mcp_dart/src/shared/transport.dart';
4+
import 'package:mcp_dart/src/types.dart';
5+
6+
Never _unsupported() => throw UnsupportedError(
7+
'StdioClientTransport is only available on Dart IO platforms.',
8+
);
9+
10+
/// Configuration parameters for launching a stdio server process.
11+
///
12+
/// This web/default-platform stub preserves the public API shape without
13+
/// importing `dart:io`. The real implementation is selected on Dart IO
14+
/// platforms through the package barrel's conditional export.
15+
class StdioServerParameters {
16+
/// The executable command to run to start the server process.
17+
final String command;
18+
19+
/// Command line arguments to pass to the executable.
20+
final List<String> args;
21+
22+
/// Environment variables to use when spawning the process.
23+
final Map<String, String>? environment;
24+
25+
/// How to handle the stderr stream of the child process on IO platforms.
26+
final Object? stderrMode;
27+
28+
/// The working directory to use when spawning the process.
29+
final String? workingDirectory;
30+
31+
/// Creates parameters for launching the stdio server.
32+
const StdioServerParameters({
33+
required this.command,
34+
this.args = const [],
35+
this.environment,
36+
this.stderrMode,
37+
this.workingDirectory,
38+
});
39+
}
40+
41+
/// Stub for the stdio client transport on platforms without `dart:io`.
42+
class StdioClientTransport implements Transport {
43+
/// Creates a stdio client transport stub.
44+
StdioClientTransport(this.serverParams);
45+
46+
/// Configuration for launching the server process.
47+
final StdioServerParameters serverParams;
48+
49+
@override
50+
void Function()? onclose;
51+
52+
@override
53+
void Function(Error error)? onerror;
54+
55+
@override
56+
void Function(JsonRpcMessage message)? onmessage;
57+
58+
@override
59+
String? get sessionId => null;
60+
61+
/// Stderr is unavailable without a spawned process.
62+
Stream<List<int>>? get stderr => null;
63+
64+
@override
65+
Future<void> start() async => _unsupported();
66+
67+
@override
68+
Future<void> close() async {
69+
onclose?.call();
70+
}
71+
72+
@override
73+
Future<void> send(JsonRpcMessage message, {int? relatedRequestId}) async =>
74+
_unsupported();
75+
}

0 commit comments

Comments
 (0)