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.
Examples #
These examples are runnable from a repository checkout or the published
package archive. The default SDK profile prefers MCP 2026-07-28 and falls
back to initialization-era peers; strict and legacy examples opt into one era
explicitly.
Run these commands from the package root.
Strict MCP 2026-07-28 #
The client starts its paired server and exercises server/discover,
subscriptions/listen, input_required, and non-object structured output:
dart run example/mcp_2026_07_28/client.dart
Client source and server source.
Default dual-era #
The stdio client starts its paired server, lists capabilities, calls a tool, reads a resource, and gets a prompt:
dart run example/client_stdio.dart
Stdio client and stdio server.
For Streamable HTTP, run these in separate terminals:
dart run example/streamable_https/server_streamable_https.dart
dart run example/streamable_https/client_streamable_https.dart
Streamable HTTP server and client.
MCP 2025-11-25 and earlier compatibility #
The interactive task client and server, elicitation server, and SSE server intentionally demonstrate retained initialization-era behavior.
Integrations #
- Authentication and OAuth
- Anthropic client
- Gemini client
- Safe fetch server
- Flutter client
- Jaspr browser client
- MCP Apps helpers
- MCP Apps metadata server
Validation #
CI runs credential-free process smokes for stdio, strict MCP 2026-07-28, a Streamable HTTP tool flow against the high-level server, and representative legacy and MCP Apps paths. It tests and compiles the Anthropic, Gemini, and fetch packages, builds the Jaspr production bundle, and runs the Flutter Web service integration in Chrome through repeated tool requests, RPC-error recovery, and reconnect. Flutter widget tests cover the UI separately. Live provider and OAuth calls require credentials or external services; Jaspr browser and native-device sessions remain manual.
See the complete examples guide for setup, security boundaries, and additional recipes.