openui_mcp 0.0.1-dev.2
openui_mcp: ^0.0.1-dev.2 copied to clipboard
MCP `ToolProvider` for OpenUI Flutter. Wraps `mcp_dart`'s `McpClient` with the JS-reference-compatible `extractToolResult` envelope unwrap.
openui_mcp #
MCP ToolProvider for OpenUI Flutter.
Wraps mcp_dart's McpClient and exposes a ToolProvider to the
OpenUI Lang runtime. The extractToolResult envelope unwrap from
openui_core mirrors the JS reference:
result.isError→ throwMcpToolError(messageJoinedFromTextContent)result.structuredContent != null→ return it- otherwise join
TextContent.text, attemptjsonDecode, fall back to the raw string
Status #
v0.1, Phase 4 complete.
Install #
dependencies:
openui_mcp: ^0.1.0
Quick start #
import 'package:mcp_dart/mcp_dart.dart';
import 'package:openui/openui.dart';
import 'package:openui_components/openui_components.dart';
import 'package:openui_mcp/openui_mcp.dart';
final client = McpClient(...); // connect your transport
await client.connect();
final provider = McpToolProvider.from(client);
Renderer(
response: response,
library: openuiLibrary(),
toolProvider: provider, // → Query / Mutation calls
);
The renderer routes Query(name: "...", args: {...}) statements
through provider.callTool, which forwards to mcp.McpClient.callTool
and runs the result through extractToolResult before caching the
value under the statement id.
License #
MIT — see LICENSE.