Files
fil/docs/snippets/dart/mcp/mcp_custom_client.md
Henrik Jess Nielsen b4c07d3693
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s
Nomad changes
2026-06-01 23:40:55 +02:00

711 B

import 'dart:convert';
import 'dart:io';

Future<void> main() async {
  final process = await Process.start('kreuzberg', <String>['mcp']);

  final request = <String, Object?>{
    'method': 'tools/call',
    'params': <String, Object?>{
      'name': 'extract_file',
      'arguments': <String, Object?>{
        'path': 'document.pdf',
        'async': true,
      },
    },
  };

  process.stdin.writeln(jsonEncode(request));
  await process.stdin.flush();
  await process.stdin.close();

  final line = await process.stdout
      .transform(utf8.decoder)
      .transform(const LineSplitter())
      .first;
  print(line);

  await process.exitCode;
}