Skip to main content

Crate noyalib_mcp

Crate noyalib_mcp 

Source
Expand description

noyalib-mcp — a Model Context Protocol server for lossless YAML editing.

Six tools, one prompt and three resources. The protocol is handled by rmcp, the official MCP SDK; this crate supplies the tools and the text a model reads. The noyalib-mcp binary serves the same handler over stdio, streamable HTTP or the older HTTP+SSE transport (see src/transport.rs and src/transport/, shared with every Rust server of the suite).

§Why this exists

AI agents that edit YAML configuration regex-replace and corrupt comments and formatting. noyalib’s CST does the edits losslessly: noyalib_set rewrites only the byte span of the value it changes, so every comment, blank line and sibling entry survives. This server is what lets Claude, Cursor, Zed and any other MCP-aware client drive that engine safely.

§The tools

  • noyalib_get reads the value at a dotted/indexed path in a file.
  • noyalib_set sets it, preserving every untouched byte.
  • noyalib_set_multidoc is noyalib_set for one document of a ----separated stream.
  • noyalib_parse, noyalib_edit and noyalib_validate work on YAML text given in the request and touch nothing on disk.

Each is a plain function in tools – get, set, set_multidoc, parse, edit, validate – and YamlServer is the handler that exposes them as MCP tools. Every answer is returned twice: as text for the model, and as structuredContent against the tool’s outputSchema for a client that wants to read it without parsing prose.

§Errors

A tool that ran and could not do the job – a file that cannot be read, YAML that does not parse, a path that does not exist – is a successful JSON-RPC response carrying isError: true and text the model can act on. A tool the server does not have is reported the same way, naming the tools that exist. A request the protocol rejects (an unknown method, a resource that does not exist) is a JSON-RPC error, which the client handles.

§Install + connect

cargo install noyalib-mcp
claude mcp add noyalib -- noyalib-mcp

§MSRV

Rust 1.89.0 stable, the floor shared across the noyalib family and the maintainer’s other Rust crates (noyalib ADR-0014). The manifest’s rust-version is the contract and the msrv-core CI job verifies it. The bump policy is in POLICIES.md.

§Panics

Public functions in this crate do not panic on any input; a fuzz target feeds the stateless tools arbitrary bytes to keep it so.

§Security

#![forbid(unsafe_code)]. No FFI. The file tools are confined to a root directory (the working directory unless --root says otherwise) and refuse any path that resolves outside it; on unix the check and the open are one walk from a handle on the root. Inside the root they read and write whatever the process may; confine a deployment with container mounts or systemd ReadWritePaths=. The HTTP listeners exist only when asked for on the command line, bind loopback by default, refuse a foreign Host or Origin, and do not authenticate. Every tool parses under the --profile limits, and requests are capped in size, nesting and time. Full posture: SECURITY.md.

§API stability and SemVer

Pre-1.0 (0.0.x): the MCP wire contract (tool names, input-schema shapes, the failure taxonomy) is stable within a 0.0.x line – bug fixes only. Adding a tool is allowed within a 0.0.x bump; removing or renaming one is held to a 0.x bump. The Rust surface is the six functions, their argument and output types, and YamlServer.

Re-exports§

pub use tools::DEFAULT_CALL_TIMEOUT;
pub use tools::EditArgs;
pub use tools::EditOutput;
pub use tools::GetArgs;
pub use tools::GetOutput;
pub use tools::MAX_FRAGMENT_BYTES;
pub use tools::MAX_SCHEMA_BYTES;
pub use tools::MAX_VIOLATIONS;
pub use tools::ParseArgs;
pub use tools::ParseOutput;
pub use tools::ParseProfile;
pub use tools::SetArgs;
pub use tools::SetMultidocArgs;
pub use tools::SetMultidocOutput;
pub use tools::SetOutput;
pub use tools::TOOL_NAMES;
pub use tools::ValidateArgs;
pub use tools::ValidateOutput;
pub use tools::Violation;
pub use tools::edit;
pub use tools::edit_with_profile;
pub use tools::get;
pub use tools::parse;
pub use tools::parse_with_profile;
pub use tools::set;
pub use tools::set_multidoc;
pub use tools::validate;
pub use tools::validate_with_profile;

Modules§

prompts
The prompts: prompts/list and prompts/get.
resources
The resources: resources/list, resources/templates/list and resources/read.
tools
The six tools, as plain functions and as MCP tools.

Structs§

YamlServer
The MCP server: the six tools, the prompt and the resources over rmcp.