Skip to content
pubscout

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.

WASM-ready
$ flutter pub add dart_mcp
Source repository

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.

  • mqtt_client

    A Dart MQTT client supporting TCP, WebSocket, secure connections and all QoS levels.

  • sse

    Bidirectional Server Sent Events client and server for Dart.

  • mcp_client

    Dart client implementation for the Model Context Protocol (MCP) supporting all revisions and transports.

Works with

Packages commonly used together with dart_mcp: ones it builds on, ones built on it, and its own family.