Логотип Dart的MCP(模型上下文协议)

Dart的MCP(模型上下文协议)

Сообщество
leehack

Dart implementation of MCP SDK

Издательleehack
Репозиторийmcp_dart
ЯзыкDart
Форки
31
Звёзды
114
Доступные инструменты
0
Тип транспортаstdio
Категории
ЛицензияMIT
Ссылки
  • Подключайте инструменты к рабочим процессам с ИИ

    Dart的MCP(模型上下文协议) предоставляет возможности MCP, доступные совместимым ИИ-клиентам и агентам.

  • Доступные инструменты: 0

    Ниже представлены доступные для вызова действия с названиями и описаниями, если сервер их предоставляет.

  • Готовая конфигурация для копирования

    Используйте примеры конфигурации, чтобы настроить этот сервер в предпочитаемом MCP-клиенте.

  • Показатели интереса к открытому проекту

    Звёзды: 114, форки: 31 — в связанном репозитории.

MCP (Model Context Protocol) for Dart

Coverage Stable package likes

mcp_dart is a dual-era Dart and Flutter SDK for MCP clients, servers, and AI hosts. It implements the complete core client/server wire surface of the locked MCP 2026-07-28 specification, retains the MCP 2025-11-25 feature set, and negotiates supported earlier initialization-based specifications.

Here, core means the normative wire requirements assigned to client and server roles by the pinned final specification. It excludes optional MCP extensions, host UI behavior, an authorization-server implementation, JSON Schema external-reference resolution, and custom JSON Schema vocabularies.

[!IMPORTANT] This release is mcp_dart 2.4.2. The separately versioned stable CLI remains mcp_dart_cli 0.2.1, which requires mcp_dart ^2.4.2. Current source passes every scored requirement in the official alpha.11 MCP 2025-11-25 and 2026-07-28 client and server sets, including all 25 required 2026 authorization scenarios, plus bidirectional published TypeScript SDK 2.0.0 and Python SDK 2.1.1 interoperability.

SDK Tier 1 target

The project is pursuing MCP SDK Tier 1. Tier 1 is not yet claimed or assigned. The technical baseline is green; the remaining official audit, repository-governance, and SDK Working Group steps are tracked in the roadmap and 48-feature coverage inventory.

The public maintenance contract is documented in the contribution guide, security policy, dependency policy, and versioning policy.

Requirements

PackageMinimum Dart SDK
mcp_dart 2.4.23.4
mcp_dart_cli 0.2.13.12

SDK-only generated projects retain the SDK's Dart 3.4 minimum. CLI projects use Dart 3.12 because the CLI and its toolchain target that release.

Install Dart from dart.dev.

Installation

Production channel

Use the latest stable package for production projects:

bash
dart pub add mcp_dart

Pin the stable SDK release

Pin the stable 2.4 line explicitly when reproducible dependency resolution is important:

yaml
dependencies:
  mcp_dart: ^2.4.2

The snippets below use the current stable SDK line. Package versions remain separate from protocol profiles: McpProtocol.stable names the SDK's default compatibility policy.

The SDK and CLI are versioned independently. The stable CLI's ^2.4.2 constraint accepts SDK versions from 2.4.2 up to, but not including, 3.0.0.

For direct SDK integration, start with the getting-started guide. The CLI below is optional and provides scaffolding, inspection, and conformance commands.

What the SDK provides

  • MCP servers, clients, and host integrations with null-safe Dart APIs.
  • Core tools, resources, prompts, completion, elicitation, subscriptions, logging, roots, and sampling APIs with behavior selected for the negotiated protocol era. MCP 2026-07-28 logging is retained for compatibility but is deprecated upstream.
  • Stdio, Streamable HTTP, IO stream, and custom transports.
  • OAuth client discovery/PKCE hooks, server authentication callbacks, DNS rebinding protection, and strict Streamable HTTP validation.
  • An experimental Tasks extension implementation, MCP Apps metadata helpers, and generic extension negotiation. Extensions are separate from core protocol coverage; Tasks is not an official extension or part of the SDK's core conformance claim.
  • Automated MCP 2025-11-25 and MCP 2026-07-28 conformance, bidirectional published TypeScript SDK 2.0.0 interoperability, bidirectional Python SDK 2.1.1 interoperability, real-browser transport tests, a real Flutter Web service integration in Chrome, deterministic widget tests, and an independent pinned JSON Schema Test Suite gate.
  • mcp_dart 2.4.2 bounds incoming stdio and IO stream messages to 10 MiB by default, with configurable limits for larger messages. See the transport guide before upgrading integrations that exchange larger frames.
  • Hardened Streamable HTTP access and JSON-RPC error diagnostics, plus the deprecated, opt-in legacy HTTP+SSE client with same-origin routing and bidirectional interoperability against official TypeScript SDK 1.30.0 and Python SDK 2.1.1 peers.

MCP has three roles: a host owns the user experience, a client connects that host to one server, and a server exposes tools, resources, and prompts. A host can manage multiple clients and servers.

Protocol profiles

ProfileProtocol behavior
McpProtocol.stableDefault dual-era profile: prefer MCP 2026-07-28, then fall back to initialization-based MCP specifications; body-only discovery probes are bounded to 5 seconds
McpProtocol.legacyInitialization-era profile: negotiate the MCP 2025-11-25, MCP 2025-06-18, MCP 2025-03-26, MCP 2024-11-05, or MCP 2024-10-07 specification
McpProtocol.require2026Require MCP 2026-07-28 and reject legacy initialization

Use stableProtocolVersion or defaultProtocolVersion for MCP 2026-07-28. previewProtocolVersion remains as a deprecated alias for applications built against a 2.3 prerelease. latestInitializationProtocolVersion remains 2025-11-25 when the default profile falls back to the legacy lifecycle. For compatibility, latestProtocolVersion and supportedProtocolVersions retain their mcp_dart 2.2 initialization-era values; use allSupportedProtocolVersions for the dual-era list.

Select a profile only when you need to constrain negotiation:

dart
final legacyClient = McpClient(
  const Implementation(name: 'my-client', version: '1.0.0'),
  options: const McpClientOptions(protocol: McpProtocol.legacy),
);

final strict2026Server = McpServer(
  const Implementation(name: 'my-server', version: '1.0.0'),
  options: const McpServerOptions(protocol: McpProtocol.require2026),
);

See the MCP 2026-07-28 transition guide for fallback rules and APIs specific to MCP 2026-07-28, or run the strict MCP 2026-07-28 example. Applications upgrading from the stable 2.2 line should also follow the 2.2 to 2.3 migration guide.

Quick start with the CLI

Install the matching stable CLI:

bash
dart pub global activate mcp_dart_cli 0.2.1
mcp_dart create my_server
cd my_server
mcp_dart inspect

The 0.2.1 CLI creates a project with mcp_dart: ^2.4.2. The inspector launches the generated stdio server itself. After leaving the interactive inspector, you can run a single tool directly:

bash
mcp_dart inspect --tool add --json-args '{"a": 1, "b": 2}'

Useful commands:

CommandPurpose
createScaffold a Dart MCP server using the SDK channel paired with the CLI
serveRun a generated server over stdio or HTTP
doctorCheck project health and connectivity
inspectInteractively use a server's capabilities
inspect-serverProduce a structured report for a live server
inspect-clientRun a stdio harness that inspects a connecting client
traceProxy and record a real stdio session
conformanceRun the repository's built-in protocol regression fixtures

See the CLI documentation for command options and scope.

Documentation

Standalone integration examples may declare newer Dart SDK requirements; check each example README before running it.

Authentication

StreamableHttpClientTransport supports OAuthClientProvider and optional authorization-code discovery. Servers can use authenticator or authenticationHandler and publish protected-resource metadata.

The checked-in OAuth examples store tokens in plaintext files for local learning. Production applications must use platform secure storage or an encrypted credential service. See the OAuth examples and Streamable HTTP authentication.

Do not expose example HTTP servers directly to untrusted networks. Production deployments should use TLS, authenticate requests, and configure the documented Host and Origin protections.

Platform support

TargetStdioStreamable HTTPLegacy HTTP+SSEIO/custom stream
Dart VM / desktop serverYesClient and serverClient and serverYes
Browser / Flutter WebNo process spawningClientClientYes
Flutter mobileOnly app-managed native helpersRemote clientRemote clientYes
Flutter desktopLocal helper processesClient and serverClient and serverYes

Legacy HTTP+SSE is deprecated under MCP SEP-2596 and is retained only for explicit compatibility. Use Streamable HTTP for new remote integrations.

See Flutter host and client recipes for lifecycle and secure-storage guidance.

Choosing a Dart MCP package

The Dart team maintains dart_mcp in dart-lang/ai. Choose it when you prefer the Dart team's APIs. Choose mcp_dart when you need this SDK's transport, security, compatibility, extension, and inspection surface. Re-check both packages' current releases before a production decision.

Support

Установка

TypingMind
{
  "mcpServers": {
    "mcp-dart": {
      "command": "path/to/compiled/server_stdio",
      "args": []
    }
  }
}

Используйте MCP Dart的MCP(模型上下文协议) с разными ИИ-моделями

TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому после подключения Dart的MCP(模型上下文协议) вы можете использовать их с разными моделями ИИ в TypingMind, не настраивая подключение отдельно для каждой модели. Эта интеграция MCP работает локально на вашем устройстве через коннектор MCP TypingMind.

Руководство по настройке локального коннектора

Выберите этот способ, если серверу MCP нужен доступ к локальным файлам, приложениям или закрытым ресурсам на вашем компьютере.

1

Откройте настройки MCP

В TypingMind откройте «Настройки», затем «Расширенные настройки», перейдите в раздел «Протокол контекста модели» и выберите «Настроить коннектор».

  1. Откройте TypingMind в браузере.
  2. Нажмите значок настроек.
  3. Перейдите в «Расширенные настройки».
  4. Откройте раздел «Протокол контекста модели».
  5. Нажмите «Настроить коннектор» и выберите «Это устройство».
Экран настройки коннектора MCP в TypingMind с выбранным вариантом «Это устройство»
2

Выполните команду коннектора

Выберите «Это устройство», скопируйте команду из TypingMind и выполните её в терминале. Не останавливайте процесс, пока используете MCP.

  1. Скопируйте команду настройки, показанную в TypingMind.
  2. Откройте «Терминал» в macOS или Windows Terminal в Windows.
  3. Вставьте и выполните команду.
  4. Подтвердите установку пакета, если терминал запросит разрешение продолжить.
  5. Не закрывайте окно терминала и не останавливайте процесс, пока используете инструменты MCP.
3

Добавьте Dart的MCP(模型上下文协议) как сервер

Когда статус коннектора сменится на «Готов», нажмите «Изменить серверы» и вставьте конфигурацию сервера MCP.

  1. Дождитесь, пока статус коннектора сменится на «Готов».
  2. Нажмите «Изменить серверы».
  3. Вставьте конфигурацию сервера MCP для Dart的MCP(模型上下文协议).
  4. Сохраните список серверов.
  5. Обновите статус, если хотите убедиться, что коннектор по-прежнему готов к работе.
Настройки MCP в TypingMind с активным сервером и кнопкой «Изменить серверы»
{
  "mcpServers": {
    "mcp-dart": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Используйте подключение с разными моделями

Сохраните список серверов, откройте раздел «Плагины», включите инструменты MCP для Dart的MCP(模型上下文协议), затем выберите любую поддерживаемую модель ИИ в TypingMind и используйте инструменты в чате или назначьте их ИИ-агенту.

  1. Откройте страницу «Плагины» в TypingMind.
  2. Включите инструменты MCP для Dart的MCP(模型上下文协议).
  3. Начните чат и выберите модель ИИ, которую хотите использовать.
  4. Используйте инструменты MCP в чате или назначьте их ИИ-агенту.
  5. При необходимости переключайтесь на другую модель ИИ без повторного подключения MCP.
Чат TypingMind с включёнными инструментами MCP и выбранной ИИ-моделью
Можете помочь мне с этой задачей с помощью Dart的MCP(模型上下文协议)?
Dart的MCP(模型上下文协议)
Конечно. Я всё прочитал.
Вот что я нашёл с помощью Dart的MCP(模型上下文协议).

Часто задаваемые вопросы

Для чего используется сервер MCP Dart的MCP(模型上下文协议)?

Dart的MCP(模型上下文协议) — это сервер MCP, который позволяет совместимым ИИ-клиентам подключаться к внешним инструментам и получать контекст. В TypingMind достаточно один раз добавить этот сервер MCP, чтобы его инструменты стали доступны в вашем рабочем пространстве с ИИ.

Можно ли использовать сервер MCP Dart的MCP(模型上下文协议) с несколькими ИИ-моделями в TypingMind?

Да. TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому вы можете использовать Dart的MCP(模型上下文协议) с разными ИИ-моделями, например Claude, ChatGPT, Gemini или другими моделями, настроенными в TypingMind, без отдельной настройки сервера MCP для каждой модели.

Зачем использовать MCP Dart的MCP(模型上下文协议) с TypingMind?

TypingMind — один из лучших интерфейсов для чата с LLM: он объединяет разные ИИ-модели, промпты, плагины, ИИ-агентов, ключи API и инструменты MCP в одном рабочем пространстве. Подключив Dart的MCP(模型上下文协议), вы сможете использовать его инструменты MCP с предпочитаемыми моделями, сохраняя удобную организацию работы с чатами в TypingMind.

Как подключить сервер MCP Dart的MCP(模型上下文协议) к TypingMind?

Dart的MCP(模型上下文协议) работает через локальный коннектор MCP TypingMind. Этот вариант лучше всего подходит, когда серверу MCP нужен доступ к локальным файлам, настольным приложениям, инструментам командной строки или закрытым ресурсам на вашем компьютере.

Какие инструменты предоставляет сервер MCP Dart的MCP(模型上下文协议) в TypingMind?

Dart的MCP(模型上下文协议) предоставляет возможности MCP, которые можно включить на странице «Плагины» в TypingMind и использовать в чате или назначить ИИ-агентам.

Нужно ли передавать TypingMind свои ключи API для использования сервера MCP Dart的MCP(模型上下文协议)?

Нет. TypingMind ориентирован прежде всего на локальную работу и позволяет вам контролировать выбор провайдеров моделей, ключи API, промпты и конфигурацию MCP. Если Dart的MCP(模型上下文协议) требует аутентификации, при создании подключения добавьте необходимые заголовки, настройки OAuth или локальную конфигурацию для этого сервера MCP.

Похожие серверы MCP

Все

Создайте свою рабочую ИИ-среду сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇