Skip to main content

utcp_mcp 0.1.0 copy "utcp_mcp: ^0.1.0" to clipboard
utcp_mcp: ^0.1.0 copied to clipboard

Model Context Protocol (MCP) transport for the Dart UTCP client. Discover and call the tools of MCP servers over stdio and streamable HTTP.

example/utcp_mcp_example.dart

import 'dart:io';

import 'package:mcp_dart/mcp_dart.dart' show silenceMcpLogs;
import 'package:utcp/utcp.dart';
import 'package:utcp_mcp/utcp_mcp.dart';

/// Registers an MCP server that runs as a child process and calls its tool.
Future<void> main() async {
  silenceMcpLogs();
  final server = Platform.script.resolve('weather_server.dart').toFilePath();
  final client = await UtcpClient.fromJson(
    {
      'manual_call_templates': [
        {
          'name': 'weather',
          'call_template_type': 'mcp',
          'config': {
            'mcpServers': {
              'local': {
                'command': Platform.resolvedExecutable,
                'args': [server],
              },
            },
          },
        },
      ],
    },
    protocols: [McpCommunicationProtocol()],
  );
  try {
    for (final tool in await client.getTools()) {
      print('Found ${tool.name}: ${tool.description}');
    }
    final result = await client.callTool('weather.local.get_weather', {
      'city': 'Seoul',
    });
    print(result);
  } finally {
    await client.close();
  }
}
0
likes
0
points
642
downloads

Publisher

verified publisherleehack.com

Weekly Downloads

Model Context Protocol (MCP) transport for the Dart UTCP client. Discover and call the tools of MCP servers over stdio and streamable HTTP.

Repository (GitHub)
View/report issues

Topics

#utcp #mcp #ai #llm #tools

License

unknown (license)

Dependencies

http, logging, mcp_dart, utcp

More

Packages that depend on utcp_mcp