dart_mcp_core 1.5.1
dart_mcp_core: ^1.5.1 copied to clipboard
Production-ready pure Dart core for Model Context Protocol (MCP). Agent execution engine, LLM adapters, MCP client transports, and tool orchestration — no Flutter dependency.
1.5.1 #
- Tool Parameter Schema Sanitization (
LLMService.sanitizeSchemaForLlm):- Recursively resolves and inlines
$refpointers from$defs/definitions. - Strips unsupported JSON schema properties (
$schema,defaulton Gemini) to eliminate HTTP 400 schema validation errors on strict LLM providers such as Gemini 3.7 Flash and strict OpenAI-compatible endpoints.
- Recursively resolves and inlines
1.5.0 #
- Multi-LLM Profiles & Configuration Schema (
LlmConfig):- Added profile identification attributes:
id,name,displayName, andprofileId. - Added
clone({String? newId, String? newName})for profile duplication and migration. - Added execution and turn limits:
maxToolCalls,maxTurns, andturnLimit. - Changed default
maxToolIterations/maxToolCallsfrom 400 to 30 for safe guardrails against runaway tool loops. - Added resilient JSON parsing supporting snake_case (
max_tool_calls,max_turns,turn_limit,api_key,base_url).
- Added profile identification attributes:
- Infinite Tool Loop Protection (
ToolLoopGuard,LoopEvaluation,LoopAction):- Canonicalized argument hashing to detect repetitive tool calls.
- Injects loop warnings upon 3 consecutive identical calls or alternating patterns (A-B-A-B-A-B).
- Automatically blocks tool execution at 4+ identical calls, preventing runaway token consumption.
- Execution Limits & Session Auto-Rotation (
McpExecutionLimits,SessionRotator):- Added
McpExecutionLimitsfor turn thresholds (maxTurns,turnLimit,maxToolCalls). - Added
SessionRotatorfor automatic rotation of session log files when turn thresholds or file size limits are exceeded.
- Added
- Bulk Serialization for
EpisodicMemoryStore:- Added
loadEntries(List<EpisodicMemoryEntry> entries, {bool replace = false})andloadFromJsonList(List<dynamic> jsonList). - Added bulk
toJson()andtoJsonList()for persisting conversation archives. - Added
EpisodicMemoryStore.fromJson(Map<String, dynamic> json)factory constructor.
- Added
- Dynamic Model Override in Sub-Agent Delegation (
DelegateTaskTool):- Added optional
model/modelOverridesupport to automatically apply model overrides to child agent'sllmConfig.
- Added optional
- Shared Workflow Blackboard Memory (
WorkflowMemoryStore,StoreMemoryTool,RecallMemoryTool):- In-memory key-value scratchpad for passing structured state across multi-agent workflows and sub-agents.
- Automatically injected tools (
store_memory,recall_memory) whenworkflowMemoryStoreis provided toAgentorMcpAgentEngine.
1.4.0 #
- Suite-Wide Architecture Synchronization:
- Aligned package versioning with companion engine extraction (
flutter_ui_mcp_embedded). - Strengthened pluggable
LLMService.embeddedHandlerandLLMService.embeddedStreamHandlerinterface stability.
- Aligned package versioning with companion engine extraction (
- Shared Workflow Blackboard / Scratchpad Memory (
WorkflowMemoryStore,StoreMemoryTool,RecallMemoryTool):- In-memory key-value scratchpad store for passing structured state across multi-agent workflows and sub-agents.
- Automatically injected tools (
store_memory,recall_memory) when aworkflowMemoryStoreis provided toAgentorMcpAgentEngine. - Sub-agent clones and targets inherit the parent's workflow memory store automatically.
- Emits
AgentWorkflowMemoryEventon storage and retrieval operations.
- Dynamic Model Override in Sub-Agent Delegation (
DelegateTaskTool):- Added optional
model/modelOverrideparameter todelegate_tasktool schema. - Automatically applies model override to child agent's
llmConfig(copyWith(model: model)) for specialized sub-tasks without requiring pre-registered agent configurations.
- Added optional
- Bulk Serialization for
EpisodicMemoryStore:- Added
loadEntries(List<EpisodicMemoryEntry> entries, {bool replace = false})andloadFromJsonList(List<dynamic> jsonList). - Added bulk
toJson()andtoJsonList()for persisting conversation archives to DuckDB or disk. - Added
EpisodicMemoryStore.fromJson(Map<String, dynamic> json)factory constructor.
- Added
1.3.0 #
- Typed Multimodal Parts (
ChatContentPart):- Introduced
ChatContentParthierarchy (TextPart,ImagePart,DocumentPart,AudioPart) for rich multimodal message representations. - Native base64/URL/bytes image payload forwarding across OpenAI (
ContentPart.imageUrl), Anthropic Claude (InputContentBlock.image), Google Gemini (Part.inlineData), and Ollama (images). - Added ergonomic factories:
ChatMessage.user(),ChatMessage.assistant(), andChatMessage.system().
- Introduced
- Episodic Memory Store & Recall (
EpisodicMemoryStore,RetrieveMemoryTool):- Prevents permanent information loss during context window auto-compression by stashing raw turn history in an indexed episodic archive before summarization.
- Injects
retrieve_memorytool so the model can inspect exact past code snippets, hashes, and tool outputs on demand. - Emits
AgentMemoryRetrievedEventwhen the model recalls archived turns.
- Sub-Agent Delegation (
DelegateTaskTool):- Native task delegation enabling primary agents to delegate focused sub-tasks to specialized sub-agents or clean agent clones (
assignee: 'clone'). - Multi-level recursion guards (
isSubAgent,delegationDepth) preventing infinite delegation loops. - Real-time delegation event lifecycle:
AgentSubAgentStartedEvent,AgentSubAgentProgressEvent, andAgentSubAgentCompletedEvent.
- Native task delegation enabling primary agents to delegate focused sub-tasks to specialized sub-agents or clean agent clones (
- Dynamic Runtime Skill Activation (
SkillDefinition,ActivateSkillsTool,DeactivateSkillsTool):- Allows grouping system prompts and tools into modular
SkillDefinitionunits. - Non-active skills only publish concise one-line descriptions in the system prompt, keeping token footprints minimal.
- Injects
activate_skillsanddeactivate_skillstools for the model to toggle toolsets on-the-fly. EmitsAgentSkillsChangedEvent.
- Allows grouping system prompts and tools into modular
- Agent Evaluation Harness (
EvalTask,EvalGrader,EvalRunner,TrajectoryRecorder):- Added end-to-end evaluation framework for agent accuracy, regression testing, and model benchmarking.
- Included standard evaluators:
ExactMatchGrader,RegexGrader, andToolCallGrader. - Added
TrajectoryRecorderto serialize full multi-turn conversation trajectories to and from JSON.
1.2.0 #
- Agent Lifecycle Hooks (
AgentHook):- Added lifecycle interceptors:
beforeToolCall,afterToolCall,beforeModelCall, andafterModelCall. - Added
ToolCallDecision(proceed,deny,modify) for security guardrails, parameter sanitization, and enterprise compliance.
- Added lifecycle interceptors:
- Structured Agent Planning (
PlanState,PlanStep,WriteTodosTool):- Native multi-step agent planning and tracking.
AgentPlanEventstream emitted throughMcpAgentEngine.agentEventsfor reactive UI progress visualization.- Optional
enablePlanningflag onAgentautomatically injecting thewrite_todosplanning tool.
- Enhanced
MCPToolResult:- Added
requestStopflag to gracefully terminate execution loops upon task completion. - Added
metadatamap for rich telemetry, timestamps, and custom tool payloads. - Added ergonomic factories:
MCPToolResult.text,MCPToolResult.error,MCPToolResult.stop, andMCPToolResult.image.
- Added
- Context Window Auto-Compression (
ContextCompressor):- Pure Dart token estimation and auto-compression utility designed for SLMs and long-running sessions.
- Automatically summarizes earlier conversation turns via the LLM when approaching context limits while preserving recent turns and system instructions.
- Emits
AgentContextCompressedEventwith token reduction metrics (originalTokens,compressedTokens,compressedTurnCount). - Pluggable via
McpAgentEngine(contextCompressor: ...)orAgent(contextCompressor: ...).
- Progressive MCP Tool Discovery:
- Added
McpListToolsToolandMcpCallToolToolto support workspaces with hundreds of MCP tools without blowing LLM context windows.
- Added
1.1.6 #
- OpenAI-Compatible & Mistral HTTP Response Patching:
- Introduced
_OpenAiCompatiblePatchClientto patch HTTP responses and SSE streams (text/event-stream) for OpenAI-compatible endpoints (such as OpenRouter, vLLM, local LLMs) and Mistral. - Sanitizes
usage.prompt_tokens_detailsandusage.completion_tokens_detailsby strippingnulland non-integer values, preventingFormatException/ParseExceptioninopenai_dart'srequireJsonInt(such as oncache_write_tokens). - Automatically injects missing
type: "function"into tool calls. - Coerces empty list
content: []tonullin streaming delta and completion messages.
- Introduced
1.1.5 #
- Robust Multi-Encoding File Support (
fs_read_file,fs_replace_text):- Implemented automatic encoding fallback (UTF-8 -> Latin-1 / ISO-8859-1 / Windows-1252 -> UTF-8 with
allowMalformed: true) inBaseCodingTool,FsReadFileTool, andFsReplaceTextTool. - Fixes crash (
FileSystemException: Failed to decode data using encoding 'utf-8') when reading or editing legacy embedded C/C++ source code, header files, or non-UTF-8 workspace documents.
- Implemented automatic encoding fallback (UTF-8 -> Latin-1 / ISO-8859-1 / Windows-1252 -> UTF-8 with
1.1.4 #
- Web & WASM Platform Abstraction for Coding Tools:
- Added conditional export for coding tools with
coding_tools_stub.dart, allowingdart_mcp_coreto compile seamlessly in Web and WASM environments wheredart:iois unavailable.
- Added conditional export for coding tools with
- Multimodal Image & Attachment Support:
- Added multimodal image attachment handling across LLM providers:
- OpenAI:
ContentPart.imageUrlwith base64 data URI format. - Anthropic:
InputContentBlock.imagebase64 blocks with media type detection (image/png,image/webp,image/gif,image/jpeg). - Google Gemini:
Part.bytesfor image attachments.
- OpenAI:
- Added multimodal image attachment handling across LLM providers:
- Model Reasoning & Commentary Preservation:
- In
McpAgentEngine, preserved model reasoning and commentary text in conversation history alongside tool calls to prevent repeating thought loops on reasoning models (e.g., DeepSeek).
- In
- Tool Iteration Limit Increase:
- Increased default
maxToolIterationsfrom 100 to 400 inMcpAgentEngineandLlmConfig.
- Increased default
- Dependency Upgrades:
- Upgraded
openai_dartto^11.0.1.
- Upgraded
1.1.3 #
- Upgraded AI SDK Dependencies:
- Upgraded
googleai_dartto^13.0.0(Dart SDK>=3.12.0). - Upgraded
openai_dartto^10.0.0(GPT Image 2.5 support, extensibleImageSizevalue class). - Upgraded
anthropic_sdk_dartto^9.0.0(Dart SDK>=3.12.0). - Upgraded
ollama_dartto^4.0.0(extended thinking union support).
- Upgraded
1.1.2 #
- Conversation Session Resumption & Trajectory Preservation:
- Added
initialMessagesproperty toAgentdefinition and JSON serialization (toJson/fromJson), allowing multi-turn REPL and CLI agents to save, restore, and continue session transcripts seamlessly. - Enhanced
AgentFinalResultEventto carry the fullList<ChatMessage> messagestrajectory generated across all tool calls and responses during execution.
- Added
- Configurable Tool Iteration Limit (
maxToolIterations):- Added configurable
maxToolIterations(default: 100, up from 10) toLlmConfig,Agent, andMcpAgentEngine. - Added graceful final response synthesis when the tool iteration limit is reached instead of halting execution abruptly.
- Added automatic recovery prompting if an LLM finishes tool calling with an empty text response.
- Added configurable
- Token Usage Reporting & Metric Events:
- Added
AgentUsageEventstream event toMcpAgentEngineprovidingpromptTokens,completionTokens, andtotalTokensemitted after each LLM call. - Added
LLMUsagemodel attached toLLMResponsecapturing usage returned by LLM providers or calculated via fallback token estimation.
- Added
- Enhanced Coding Tools:
- Included full 10-tool autonomous engineering tool suite in
CodingTools.createAll():fs_find,fs_list_dir,fs_read_file,fs_write_file,fs_replace_text,fs_create_dir,fs_move,fs_delete,terminal_exec, andfetch_web. - Improved
FsReadFileToolwith intelligent pagination and safe 800-line chunk truncation, providing clear range hints for large files.
- Included full 10-tool autonomous engineering tool suite in
- Bug Fixes:
- Cleaned up nullable type assertions in OpenAI provider usage mapping.
1.1.0 #
- New Native Coding Tools & Engine Helpers:
- Added
FsFindTool(fs_find) for discovering files and directories across workspaces with.gitignoreawareness. - Added
FsReadFileTool(fs_read_file) for line-numbered and paginated file inspection. - Added
FsWriteFileTool(fs_write_file) for creating and overwriting files with automatic directory resolution. - Added
FsReplaceTextTool(fs_replace_text) for surgical, unique search-and-replace edits. - Added
TerminalExecTool(terminal_exec) for cross-platform workspace command execution (e.g.dotnet build,dart test,git status). - Added
CodingTools.createAll()factory helper to bundle coding tools for CLI, Desktop, and Server environments.
- Added
1.0.2 #
- Updated package documentation and branding references to
flutter_mcp_suite.
1.0.1 #
- Expanded LLM SDK dependency version constraints to support
anthropic_sdk_dart9.x,googleai_dart13.x,openai_dart9.x, andollama_dart3.x.
1.0.0 #
- Initial stable production release under the
flutter_mcp_suiteecosystem. - Rebranded and modernized from
mcp_playground_dart. - Production-ready Model Context Protocol (MCP) client transports (HTTP/SSE & stdio subprocesses).
- LLM service adapters for OpenAI, Anthropic, Gemini, and Ollama.
- Agent execution loop and tool orchestration engine.
0.3.2 #
- Upgraded AI SDK dependencies:
anthropic_sdk_dartto^8.0.0googleai_dartto^12.0.1openai_dartto^8.1.0ollama_dartto^2.6.1yamlto^3.1.4testto^1.32.0
- New Pure Dart Examples & Skills:
- Git Staged Diff Reviewer & PR Generator (
examples/dart/git_review_skill): Automated git inspection workflow that reads staged diffs, runs static analysis, and produces structured pull request markdown reviews (PR_REVIEW.md). - API Endpoint Health & Schema Prober (
examples/dart/api_tester_skill): REST health-checking agent benchmarking endpoint latency, validating JSON schema payloads, and generating diagnostic audit reports (API_DIAGNOSTICS.md). - SQLite Database Analyst & Executive Reporter (
examples/dart/sqlite_analyst_skill): Autonomous database exploration agent that introspects relational schemas, executes aggregation queries, and exports business intelligence summaries (DATABASE_REPORT.md).
- Git Staged Diff Reviewer & PR Generator (
0.3.1 #
- Fixed
repositoryURL inpubspec.yamlto point to GitHubmainbranch.
0.3.0 #
- Windows Stdio MCP Server Execution: Switched Windows NPX server launching to direct
node.exeexecution withnpx-cli.js, eliminatingcmd.exestdin pipe stalls during MCPinitializehandshakes. - Mistral Streaming: Fixed
_MistralPatchClientbuffering live SSE event streams, enabling real-time chunk streaming. - Added
LocalMcpRuntime.findNpxCliand_resolveWindowsExehelpers for robust tool detection on Windows. - Unified 0.3.0 release across the MCP Playground ecosystem.
0.2.2 #
- Added
SkillImporter.collectNeededTools()— collects all tool names referenced by a skill manifest (declared tools + per-step enabledToolNames). - Added
SkillImporter.buildUnresolvableToolsWarning()— builds a human-readable warning listing missing tools with capability/install/registry details. McpAgentEngine.registerAgentFromManifest()now tracks resolved capability tools and emits anAgentLogEventwarning when unresolvable tools are detected.
0.2.1 #
- Added
McpAgentEngine.registerAgentFromManifest()— builds and registers anAgentdirectly from a parsedSkillManifest, handling tool-declaration →McpServerConfigmapping and prompt-step conversion. Accepts optionaldartTools,workingDir, andserverOverrides. - Updated
SkillExporter.toSkillMd()compatibility tag frommcp_playgroundto"Universal"to match agentskills.io TealKit standard. - Added
dartToolsparameter toregisterAgentFromManifest()for Dart-native local tool injection (weather, charts, SSH).
0.2.0 #
- BREAKING: SKILL.md export/import format changed to agentskills.io TealKit-compatible standard (
compatibility:,metadata:,workflow:,agents:). Legacy custom format (system_prompt:,prompts:,tools:) is deprecated. - Added
SkillManifest,SkillPromptStep,SkillToolDeclarationmodels with 3-tier portability (capability,local,external). - Added
SkillExporter— convertsSavedPlaygroundSetup/conversation → SKILL.md YAML frontmatter. - Added
SkillImporter— parses SKILL.md (both TealKit and legacy formats) →SavedPlaygroundSetupwith multi-prompt step conversion. - Added
SkillStorageAdapterabstract interface withStoredSkillInfofor pluggable skill ZIP persistence. - Added
yamldependency for robust YAML parsing.
0.1.4 #
- Upgraded dependencies:
anthropic_sdk_dartto^6.0.0,googleai_dartto^9.0.0,ollama_dartto^2.4.0,httpto^1.6.0.
0.1.3 #
- Refactored streaming support for Small Language Models (SLMs) and embedded models.
- Added dynamic static delegates
embeddedHandlerandembeddedStreamHandlerto plug on-device inference engines without hard code dependencies. - Added a new headless CLI example
embedded_exampledemonstrating on-device Hugging Face GGUF model downloading, offline inference, local weather tool execution, and token-by-token terminal stream outputs.
0.1.2 #
- Expose
agentEventsstream inMcpAgentEngineand return a reactive event stream fromrunAsyncfor asynchronous streaming execution. - Add support for loading
LlmConfighyperparameters (temperature,maxTokens,topP,topK,repeatPenalty) inside provider clients. - Isolate local stdio client dependencies from web/wasm builds via default stub conditional imports.
- Protocol and logging compliance updates.
0.1.1 #
- Fixed WASM and Web compilation by integrating
universal_iofor subprocess/file wrappers. - Added pure Dart
McpChangeNotifierto core clients to remove Flutter dependencies. - Added comprehensive self-contained package example for pub.dev.
0.1.0 #
- Initial release of the pure-Dart core package.
- Built-in multi-LLM SDK adapters (OpenAI, Claude, Gemini, Ollama, Mistral).
- HTTP/SSE stateful Model Context Protocol (MCP) clients with authentication and health-monitoring reconnection.
- Desktop stdio process execution client for Node.js and Python MCP servers.
- Core
McpAgentEnginesupporting sub-prompt orchestration pipelines, iterative tool loops, and loop-protection.