flutter_ai_mcp 0.1.1 copy "flutter_ai_mcp: ^0.1.1" to clipboard
flutter_ai_mcp: ^0.1.1 copied to clipboard

Model Context Protocol (MCP) integration for flutter_ai: connect to MCP servers over Streamable HTTP and expose their tools as flutter_ai tools that flow through the agent loop.

flutter_ai_mcp #

☕ Support this project #

Buy me a coffee on Ko-fi

If flutter_ai saves you time, buy me a coffee ☕ — it keeps the whole family maintained.


Model Context Protocol integration for the flutter_ai family. Connect to MCP servers over Streamable HTTP and expose their tools as flutter_ai tools that flow through the agent loop — no glue code.

Usage #

import 'package:flutter_ai_mcp/flutter_ai_mcp.dart';
import 'package:flutter_ai_tools/flutter_ai_tools.dart';

// 1. Connect to an MCP server.
final mcp = await StreamableHttpMcpConnection.connect(
  baseUrl: 'https://my-mcp-server.example.com',
  headers: {'Authorization': 'Bearer <token>'},
);

// 2. Adapt its tools into flutter_ai tools.
final registry = ToolRegistry();
for (final spec in await mcpToolSpecs(mcp)) {
  registry.register(spec);
}

// 3. Advertise + run them through the agent loop.
final controller = UseChatController(
  provider: provider,
  tools: registry.definitions,
  onToolCalls: (calls) => Future.wait(calls.map(registry.run)),
);

Scope #

  • Streamable HTTP only. stdio is desktop-only (subprocess) and out of scope for a mobile-first toolkit.
  • Bring your own transport by implementing McpConnection if you prefer a different MCP client; mcpToolSpecs works with any implementation.

Status #

0.1.0. Built on mcp_client.

0
likes
0
points
166
downloads

Publisher

unverified uploader

Weekly Downloads

Model Context Protocol (MCP) integration for flutter_ai: connect to MCP servers over Streamable HTTP and expose their tools as flutter_ai tools that flow through the agent loop.

Homepage
Repository (GitHub)
View/report issues

Topics

#ai #llm #mcp #tool-calling #agent

License

unknown (license)

Dependencies

flutter_ai_core, flutter_ai_tools, mcp_client

More

Packages that depend on flutter_ai_mcp