Developing

lnk-link-file is Link File: an MCP server over stdio that reads and writes an agent's files, each call in a sandbox of its own. How to use it: Link File.

Build and test

From link-tools, with link-core beside it (LINK_CORE for another place):

cargo build -p link-plugin-link-file
# the sandboxed test skips without bubblewrap, unless LNK_REQUIRE_SANDBOX=1
cargo test -p link-plugin-link-file

How it's put together

  • serve -- <command>... is the tool. It touches no file: each call runs <command>, which Link makes lnk sandbox run with the sandbox file's flags, then lnk-link-file apply --files <folder> --write <folder>..., the call on its stdin as {"name", "arguments"}, and reads {"ok": ...} or {"error": "..."} back.
  • apply checks the folders before the sandbox does, so a refusal says why in words: a path is relative, without .., and never through a link, and a write is in a folder --write names.
  • A write goes to a file beside the target, then is moved in place.
  • tests/calls.rs runs it as apply alone, and on Linux under lnk-sandbox run from link-core, told it may write a folder the sandbox doesn't, to show the sandbox holds.