ai_sdk_mcp 1.2.0
ai_sdk_mcp: ^1.2.0 copied to clipboard
MCP (Model Context Protocol) client for AI SDK Dart. Connect to MCP servers via SSE or stdio, discover tools, and use them with any LLM provider.
1.2.0 #
Behavior change:
SseClientTransportnow performs real SSE streaming instead of a plain request/response POST. If you relied on the old single-endpoint POST behavior, switch to the newHttpClientTransport.
- Flutter-web compatible. The package no longer imports
dart:ioat the top level.StdioMCPTransport(which spawns a process) now lives behind a conditional import: the realdart:ioimplementation is used on native platforms, and a stub that throwsUnsupportedErroris used on web. The HTTP/SSE transports rely only on web-safepackage:http, so the package now compiles and runs on Flutter web. - Real SSE transport.
SseClientTransportnow performs genuine Server-Sent-Events streaming (MCP HTTP+SSE, protocol 2024-11-05): it opens a long-lived streamingGET, parses thetext/event-streamwire format, resolves the POST endpoint from the server'sendpointevent, POSTs client→server requests there, and surfaces server→client messages (responses, notifications, and requests) over the stream. Server-pushednotifications/resources/updatednow reachsubscribeResourcelisteners automatically. Previously this class did a plain request/response HTTP POST despite its name. - New
HttpClientTransport. The previous plain request/response POST behaviour is preserved under this honestly-named transport for servers that expose a single JSON-RPC endpoint without SSE. MCPTransportgained anotificationsstream for server-initiated messages (empty for transports without server push).- Fixed a secondary unhandled async error that could leak from the SSE transport when the initial connection failed.
- 100% line coverage.
1.1.0 #
- Bumped
ai_sdk_dartconstraint to^1.1.0. - No MCP client behaviour changes; version aligned with the rest of the monorepo.
1.0.0+1 #
- Improved pubspec descriptions for better pub.dev discoverability.
- Added
example/example.mdwith usage examples and links to runnable apps.
1.0.0 #
First stable release. Depends on ai_sdk_dart 1.0.0.
MCPClient— manages a session with any MCP server via pluggable transport.SseClientTransport— HTTP SSE transport for remote MCP servers; supports custom headers and separate POST URL.StdioMCPTransport— stdio transport that spawns a local process and communicates via stdin/stdout.initialize()— MCP protocol 2024-11-05 handshake with idempotency guard.tools()— discovers available tools and returns aToolSetcompatible withgenerateText/streamText.callTool()— invokes a named tool with structured arguments; throwsMCPExceptionon server-side errors.MCPException— typed exception withmessagefield.
0.2.0 #
- Initial release.
MCPClient— manages a connection to an MCP server via any transport.SseClientTransport— HTTP SSE transport for remote MCP servers.StdioMCPTransport— stdio transport for local MCP server processes.tools()— discovers available tools and returns a typedToolSet.callTool()— invokes a named tool with structured arguments.- MCP protocol 2024-11-05 initialize handshake.
MCPExceptionfor server-side errors.