Skip to main content

Crate rlg_mcp

Crate rlg_mcp 

Source
Expand description

rlg-mcp — a Model Context Protocol server for rlg log files.

Four tools over log files on the server’s filesystem — tail_log, filter_log, summarize_errors, tail_logs_glob — plus one prompt and two resources. The protocol is handled by [rmcp], the official MCP SDK; this crate supplies the tools and the text a model reads.

The four operations are plain functions — tail_log, filter_log, summarize_errors, tail_logs_glob — so they can be called and tested without a transport. LogServer is the handler that exposes them as MCP tools; each answer is returned twice, as text for the model and as a structured value for a client that wants to read it without parsing prose.

§Example

use std::path::Path;
let recent = rlg_mcp::tail_log(Path::new("/var/log/app.ndjson"), 10).unwrap();
for line in recent { println!("{line}"); }

Modules§

transport
One command line for the three MCP transports.

Structs§

ErrorSummary
ERROR-and-above records counted per component: what summarize_errors returns.
FilterLogArgs
Arguments of filter_log.
LogServer
The MCP server: the four tools, one prompt and two resources over [rmcp].
Records
A slice of rendered log records: what tail_log, filter_log and tail_logs_glob return.
SummarizeErrorsArgs
Arguments of summarize_errors.
TailLogArgs
Arguments of tail_log.
TailLogsGlobArgs
Arguments of tail_logs_glob.

Functions§

filter_log
Apply filter to every record in path and return matches rendered in format.
summarize_errors
Count error+ records grouped by component.
tail_log
Return the last n parseable records from path, rendered in Logfmt. Unparseable lines are skipped.
tail_logs_glob
Tail the last n records across every file matching a glob pattern (e.g. /var/log/**/*.log), newest last, optionally keeping only records at or above level. Matched files are read in sorted path order and their records concatenated before the final n are taken; unparseable lines are skipped.