Skip to content
pubscout

mcp_client

3.0.2, released 3 weeks ago by makemind.dev

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

WASM-ready
$ flutter pub add mcp_client
Source repository

What it does

Allows Flutter and Dart applications to connect with MCP servers via stdio, SSE, or Streamable HTTP. It provides capability negotiation, OAuth 2.1 authentication, and handles primitives like resources, tools, prompts, tasks, and sampling.

AI-written summary of version 3.0.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to connect your Flutter application to Model Context Protocol (MCP) servers.
  • You want to consume LLM context, tools, and prompts from external MCP-compatible servers.

Skip it when

  • You are building a standard REST or GraphQL client without MCP requirements.

Strengths

  • Supports every MCP revision from 2024-11-05 through 2026-07-28.
  • Unified transport configuration for stdio, SSE, and Streamable HTTP.
  • Built-in OAuth 2.1 authorization and JSON schema validation.

Weaknesses

  • Specific to the Model Context Protocol ecosystem, limiting general-purpose HTTP usage.

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
6

Requires adding the dependency to pubspec.yaml. Stdio transport on Windows may require runInShell: true for .cmd files.

import 'package:mcp_client/mcp_client.dart';

void main() async {
  final config = McpClient.simpleConfig(
    name: 'Example Client',
    version: '1.0.0',
  );
  final transportConfig = TransportConfig.stdio(
    command: 'npx',
    arguments: ['-y', '@modelcontextprotocol/server-filesystem', '/path/to/dir'],
  );
  final clientResult = await McpClient.createAndConnect(
    config: config,
    transportConfig: transportConfig,
  );
  final client = clientResult.fold((c) => c, (error) => throw error);
  client.disconnect();
}

Alternatives

Packages that do the same job and could replace mcp_client.

  • http2

    An HTTP/2 implementation in Dart for low-level transport and pooled HTTP/2 requests.

  • dart_mcp

    A Dart library for building Model Context Protocol (MCP) servers and clients.

  • cronet_http

    An Android Flutter plugin providing access to the Cronet HTTP client.

  • sync_http

    Synchronous HTTP client for Dart using RawSynchronousSockets.

Works with

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