Skip to main content

mcp_toolkit 8.1.1 copy "mcp_toolkit: ^8.1.1" to clipboard
mcp_toolkit: ^8.1.1 copied to clipboard

Flutter MCP Toolkit to add Flutter-specific methods to the MCP server

MCP Toolkit for Flutter #

pub package pub points skills.sh License: MIT Flutter

flutter-mcp-toolkit logo

Flutter-side library for flutter-mcp-toolkit: VM service extensions so the MCP server can read errors, capture UI, and run your tools at runtime.

Not the Dart MCP server (analyzer/tooling). This package targets a running debug app.

Screen recording of the flutter-mcp-toolkit harness driving a debug Flutter app and returning UI frames to an AI assistant.

See it in Cursor (~6 MB) #

An early capture of the toolkit in Cursor: the agent grabs a screenshot of a running debug app and reads the UI back. Today's tool is fmt_get_screenshots; a fresh recording is coming with the demo rethink.

docs/view_screenshots.gif — early screen recording of Cursor's agent calling the toolkit's screenshot tool (then named view_screenshots) on a running Flutter debug app and describing the captured UI (inlined in the repo README).

See dynamic tools registration in this short YouTube video.

Docs: docs.page/arenukvern/mcp_flutter · quickstart

Add to your app #

flutter pub add mcp_toolkit
# or: flutter-mcp-toolkit codegen-init
import 'package:flutter/material.dart';
import 'package:mcp_toolkit/mcp_toolkit.dart';

Future<void> main() async {
  final binding = MCPToolkitBinding.instance;
  await binding.bootstrapFlutter(runApp: () => runApp(const MyApp()));
}

Debug mode only (assert-guarded).

Hot reload vs hot restart #

The Dart VM cannot unregister service extensions. addEntries therefore:

  • Registers each ext.mcp.toolkit.* extension once per isolate.
  • Handler updates apply only when app code calls addEntries again with a new [AgentCallEntry] for that tool. main() does not re-run on hot reload, so tools registered once in main() keep the same entry object until the next addEntries — even though Dart may hot-reload new function bodies elsewhere.
  • A later addEntries with the same tool name replaces the live handler without re-registering the VM extension (VM and agent_invoke both read the same live table).
  • Hot restart starts a new isolate with a clean registry; extensions register from scratch.
  • Removed tools stay callable on the VM until hot restart — entries are never deleted from the registry or unregistered from the VM.

After changing bootstrap wiring (first initialize / addEntries in main), use hot restart or a full rerun — not hot reload alone.

Custom tools #

await binding.addEntries(
  entries: {
    AgentCallEntry.tool(
      namespace: 'demo',
      name: 'ping',
      description: 'Health check',
      inputSchema: const {
        'type': 'object',
        'additionalProperties': false,
        'properties': {},
      },
      handler: (args) async => AgentResult.success(message: 'pong'),
    ),
  },
);
await binding.bootstrapFlutter(runApp: () => runApp(const MyApp()));

Full example (pub.dev example/): fibonacci_tool_example.dart. Shared registration: buildCalculateFibonacciTool().

Agent discovery: fmt_list_client_tools_and_resources / fmt_client_tool.

Migrations: projections, AgentCallEntry.

Server pairing #

Run the flutter-mcp-toolkit-server MCP entry (flutter-mcp-toolkit-server on stdio) with the app in debug and mcp_toolkit initialized in main().