Nomad changes
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s

This commit is contained in:
Henrik Jess Nielsen
2026-06-01 23:40:55 +02:00
parent 72b1a0a6ed
commit b4c07d3693
5723 changed files with 1130655 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<!-- snippet:syntax-only -->
```zig title="Zig"
const std = @import("std");
// The Zig binding does not expose an MCP client. To talk to the bundled
// `kreuzberg mcp` server, spawn the CLI as a subprocess and exchange
// JSON-RPC messages over stdin/stdout.
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
var child = std.process.Child.init(&.{ "kreuzberg", "mcp" }, allocator);
child.stdin_behavior = .Pipe;
child.stdout_behavior = .Pipe;
child.stderr_behavior = .Inherit;
try child.spawn();
const request =
\\{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"extract_file","arguments":{"path":"document.pdf"}}}
++ "\n";
if (child.stdin) |stdin| {
try stdin.writeAll(request);
stdin.close();
child.stdin = null;
}
if (child.stdout) |stdout| {
const response = try stdout.reader().readAllAlloc(allocator, 16 * 1024 * 1024);
defer allocator.free(response);
try std.io.getStdOut().writer().print("{s}\n", .{response});
}
_ = try child.wait();
}
```

View File

@@ -0,0 +1,22 @@
<!-- snippet:syntax-only -->
```zig title="Zig"
const std = @import("std");
// The Zig binding does not expose the MCP server programmatically. Launch
// the bundled `kreuzberg mcp` CLI as a subprocess to start the server.
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
var child = std.process.Child.init(&.{ "kreuzberg", "mcp" }, allocator);
child.stdin_behavior = .Inherit;
child.stdout_behavior = .Inherit;
child.stderr_behavior = .Inherit;
try child.spawn();
const term = try child.wait();
try std.io.getStdOut().writer().print("kreuzberg mcp exited: {any}\n", .{term});
}
```