dartmcp
Model Context Protocol (MCP) Dart
Documentation
DartMCP
A Dart implementation of the Model Context Protocol (MCP) for AI agent interactions.
Overview
DartMCP is a Model Context Protocol (MCP) implementation in Dart, providing both server and client components for building interoperable AI/LLM tools and services.
Requirements
- Dart SDK 3.9.2+
- Works on any platform supported by Dart (macOS, Linux, Windows)
Project Structure
The project is organized into two main components:
- `lib/src/server.dart`: The server implementation
- `lib/src/client.dart`: The client implementation
Dependencies
Installation
1. Add DartMCP to your project:
dependencies:
dart_mcp: ^0.3.32. Install dependencies:
dart pub getServer
The DartMCP server component provides a Model Context Protocol server implementation in Dart. It enables AI agents and tools to interact with Dart applications using the standard MCP protocol.
Features
- Built with Dart 3.9.2+
- Implements MCP protocol over standard I/O or custom channels
- Includes support for logging, prompts, resources, and tools
- Cross-platform support
Getting Started
1. Implement your server logic using `Server` from `lib/src/server.dart`.
2. Run your server as a Dart application:
dart run path/to/your_server.dartServer Component Details
The server component is responsible for:
- Handling incoming MCP connections
- Managing model context and state
- Processing client requests
- Maintaining state synchronization
Location: `lib/src/server.dart`
Client
The DartMCP client component allows Dart applications to connect to and interact with MCP-compatible AI agents and servers.
Features
- Built with Dart 3.9.2+
- Implements MCP client over standard I/O or custom channels
- Simple API for initializing and communicating with MCP servers
- Streams for server notifications (tools, resources, logs, etc.)
Getting Started
1. Use the `Client` class from `lib/src/client.dart` in your Dart application.
2. Example usage:
import 'package:dartmcp/dartmcp.dart';
void main() {
var client = Client();
client.main();
}Client Component Details
The client component provides:
- Connection management to MCP servers
- Model context synchronization
- Real-time updates handling
- Client-side state management
Location: `lib/src/client.dart`
Example
See `example/dartmcp_example.dart` for a minimal usage example.
Frequently asked questions
What is dartmcp?
dartmcp is Model Context Protocol (MCP) Dart
How do I install dartmcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is dartmcp open source?
Yes — it is hosted on GitHub at https://github.com/G1Joshi/DartMCP.
Related MCP tools
ChatMCP is an AI chat client implementing the Model Context Protocol (MCP). Dart-based implementation. Trusted by 2000+ developers.
An MCP client for Neovim that seamlessly integrates MCP servers into your editing workflow with an intuitive interface for managing, testing, and using MCP s...
A Unified MCP Server Management App TypeScript-based implementation. Trusted by 800+ developers. Trusted by 800+ developers.
A text-based user interface (TUI) client for interacting with MCP servers using Ollama. Features include multi-server, dynamic model switching, streaming res...
Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth! Python-based implementation. Trusted by 11000+ developers.
🤖 A visualization mcp contains 25+ visual charts using @antvis. Using for chart generation and data analysis. TypeScript-based implementation.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP