Skip to main content

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

MCP transport for the Dart UTCP client: let LLM agents discover and call Model Context Protocol server tools 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
160
points
642
downloads

Documentation

API reference

Publisher

verified publisherleehack.com

Weekly Downloads

MCP transport for the Dart UTCP client: let LLM agents discover and call Model Context Protocol server tools over stdio and streamable HTTP.

Repository (GitHub)
View/report issues

Topics

#utcp #mcp #llm #agents #tool-calling

License

MPL-2.0 (license)

Dependencies

http, logging, mcp_dart, utcp

More

Packages that depend on utcp_mcp