dart_mcp
0.5.2, released 5 months ago by labs.dart.dev
A Dart library for building Model Context Protocol (MCP) servers and clients.
What it does
Provides base classes and mixins to implement MCP servers and clients, exposing capabilities and utilities defined by the MCP spec. It supports communication over streams, including stdio, and handles initialization, capability negotiation, and RPC calls.
AI-written summary of version 0.5.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to build a local MCP server or client for a Dart application
- You want to expose or consume MCP capabilities such as prompts, resources, or tools
- You prefer a stream‑based, imperative API for RPC communication
Skip it when
- You only need simple HTTP or WebSocket communication
- You require authentication or push notifications
- You need a fully featured AI client library with built‑in models
Strengths
- Built‑in support for MCP protocol versions and capability negotiation
- Stream‑based API fits well with Dart async streams
- Extensible mixins for server and client capabilities
- Supports stdio transport out of the box
Weaknesses
- Experimental and rapidly evolving
- No built‑in authentication or authorization
- Limited transport support (only stdio currently)
- No code generation or declarative UI helpers
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 6
Add dependency to pubspec, import server.dart or client.dart, extend MCPServer/MCPClient, provide a StreamChannel for communication.
import 'package:dart_mcp/server.dart';
class MyServer extends MCPServer {
MyServer(StreamChannel channel) : super(channel);
}
Alternatives
Packages that do the same job and could replace dart_mcp.
- mqtt5_client
A server and browser based MQTT Version 5 client for Dart supporting TCP and WebSockets.
92Compare - mqtt_client
A Dart MQTT client supporting TCP, WebSocket, secure connections and all QoS levels.
91Compare - sse
Bidirectional Server Sent Events client and server for Dart.
80Compare - mcp_client
Dart client implementation for the Model Context Protocol (MCP) supporting all revisions and transports.
75Compare
Works with
Packages commonly used together with dart_mcp: ones it builds on, ones built on it, and its own family.
- asyncdart_mcp depends on itUtility classes and helpers that extend Dart's async library.
- stream_channeldart_mcp depends on itAn abstraction for two-way communication channels based on the Dart Stream class.
- stream_transformdart_mcp depends on itExtension methods adding common stream transform operators
- very_good_cliBuilt on dart_mcpCLI for creating and managing Dart/Flutter projects
- dart_mcp_serverBuilt on dart_mcpAn MCP server for Dart projects, exposing developer tools to AI models.
- serverpod_cliBuilt on dart_mcpCommand line tools for Serverpod.
- sip_cliBuilt on dart_mcpA command-line tool to manage mono-repos, run scripts, execute tests, and handle dependencies.
- apollovmBuilt on dart_mcpPortable multi-language VM to parse, run, translate, and compile Dart, Java, Kotlin, Go, C#, JS, and Python.