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,40 @@
```typescript title="WASM"
// The WASM crate has no MCP client. To integrate with an MCP server,
// drive the kreuzberg CLI from a Node.js host that uses kreuzberg-wasm
// for in-process extraction.
import { spawn } from "node:child_process";
import * as readline from "node:readline";
const mcpProcess = spawn("kreuzberg", ["mcp"]);
const rl = readline.createInterface({
input: mcpProcess.stdout,
output: mcpProcess.stdin,
terminal: false,
});
const request = {
method: "tools/call",
params: {
name: "extract_file",
arguments: {
path: "document.pdf",
async: true,
},
},
};
mcpProcess.stdin.write(`${JSON.stringify(request)}\n`);
rl.on("line", (line) => {
const response = JSON.parse(line);
console.log(response);
mcpProcess.kill();
});
mcpProcess.on("error", (err) => {
console.error("Failed to start MCP process:", err);
});
```
<!-- snippet:syntax-only --> MCP transport is not exported by the WASM crate; this snippet drives the MCP CLI from the same Node host that loads kreuzberg-wasm.

View File

@@ -0,0 +1,22 @@
```typescript title="WASM"
// MCP server is provided by the kreuzberg CLI (Rust binary). The WASM build
// targets browser/Node.js extraction and does not embed a server process.
// Spawn the CLI from a Node.js host that consumes the WASM module separately.
import { spawn } from "node:child_process";
const mcpProcess = spawn("kreuzberg", ["mcp"]);
mcpProcess.stdout.on("data", (data) => {
console.log(`MCP Server: ${data}`);
});
mcpProcess.stderr.on("data", (data) => {
console.error(`MCP Error: ${data}`);
});
mcpProcess.on("error", (err) => {
console.error(`Failed to start MCP server: ${err.message}`);
});
```
<!-- snippet:syntax-only --> The MCP server is a CLI feature; the WASM crate does not export an MCP server entry point. This snippet shows how a Node host that uses kreuzberg-wasm for extraction can also drive the standalone MCP CLI.