Skip to content
pubscout

mcp_models

2.1.0, released 3 months ago by finchdart.com

Dart model classes for the Model Context Protocol (MCP) with zero dependencies.

WASM-ready
$ flutter pub add mcp_models
Source repository

What it does

Provides plain Dart model classes for the Model Context Protocol (MCP) schema, covering tools, resources, prompts, subscriptions, and notifications. Includes serialization and deserialization methods (toMap and named factories) without requiring code generation, along with a McpBuilder helper.

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

Use it when

  • Building Model Context Protocol (MCP) clients or servers in Dart
  • Working with MCP messages, tools, resources, and prompts without code generation

Skip it when

  • You do not need to interact with the Model Context Protocol

Strengths

  • Full coverage of the MCP 2026-07-28 schema
  • Zero runtime dependencies and pure Dart
  • No code generation required
  • McpBuilder helper for declarative server capability registration

Weaknesses

  • Tied strictly to the evolving Model Context Protocol specification

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:mcp_models/mcp_models.dart';

final request = DiscoverRequest(
  id: '1',
  params: RequestParams(
    $meta: RequestMetaObject(
      protocolVersion: '2026-07-28',
      clientCapabilities: ClientCapabilities({}),
      clientInfo: Implementation(name: 'my_client', version: '1.0.0'),
    ),
  ),
);

final json = request.toMap();
final restored = DiscoverRequest.toMCP(json);

Alternatives

Packages that do the same job and could replace mcp_models.

  • http2

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

Works with

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