MCP server exposing rlg log streams to LLM agents via JSON-RPC 2.0 over stdio.
io.github.sebastienrousseau/rlg-mcp — Model Context Protocol (MCP) Server
This MCP server exposes rlg log streams to LLM agents using JSON-RPC 2.0 over stdio. It is part of the rlg “RustLogs” ecosystem, which also includes companion crates for structured logging and related observability components.
🛠️ Key Features
MCP server for model-context-protocol
JSON-RPC 2.0 transport over stdio
Integration with rlg structured logging
Ecosystem topics include opentelemetry, otlp, observability, and structured-logging
🚀 Use Cases
Provide log stream access to LLM agents
Use structured logging for observability workflows
Export or connect logging via OTLP/OpenTelemetry components in the rlg ecosystem
⚡ Developer Benefits
Uses MCP to connect logging context to agents
Supports Rust-focused tooling and libraries (e.g., rust, tower, lock-free, ring-buffer)
Includes ecosystem support for PII redaction and structured logging utilities
⚠️ Limitations
Description does not specify authentication, supported tools/endpoints, or log filtering/redaction behavior beyond listing related topics.
Near-lock-free structured logging for Rust: records leave the application thread with a few atomic operations and are formatted and written by a background flusher.
The rlg CLI filtering a service log to errors in Elastic Common Schema, then rlg-report summarising the same file by level, component and message
Contents
Getting started
Install — Cargo for the libraries, cargo install for the CLIs and the MCP server
Satellites install the same way, all at the same version:
toml
[dependencies]rlg-otlp = "0.0.18"# ship records to an OpenTelemetry Collectorrlg-tower = "0.0.18"# per-request access logs for tower servicesrlg-redact = "0.0.18"# scrub secrets and PII before they are written[dev-dependencies]rlg-test = "0.0.18"# assert on captured records in tests
Command-line tools
bash
cargo install rlg-cli # `rlg`: filter and convert log files
cargo install rlg-report # `rlg-report`: summaries by level, component and message
cargo install rlg-mcp # `rlg-mcp`: log files as tools for AI agents
From a checkout, make install builds the three binaries and installs
them with their manpages and bash, zsh and fish completions under
/usr/local (PREFIX and DESTDIR are honoured; make uninstall
reverses it). The binaries generate both themselves:
rlg --manpage > rlg.1, rlg --completions zsh > _rlg.
rlg-mcp is also published as a container image,
ghcr.io/sebastienrousseau/rlg-mcp, and listed in the MCP registry.
Requirements
Rust 1.89.0 or newer (edition 2024). CI builds every library and
binary on 1.89.0; see the toolchain policy.
macOS or Linux for the native sinks (os_log, journald).
Everywhere else, including Windows, rlg writes to a file or stdout.
Quick Start
rust
use rlg::log::Log;
use rlg::log_format::LogFormat;
fnmain() {
// Keep the guard for the life of the program: dropping it flushes// pending records and stops the background thread.let_guard = rlg::init().unwrap();
Log::info("User authenticated")
.component("auth-service")
.with("user_id", 42)
.format(LogFormat::JSON)
.fire();
}
fire() checks the level, pushes the record into a ring buffer and
returns; the flusher thread formats it as JSON and writes it to the
platform sink. This block is compiled and run by cargo test.
The rlg ecosystem
Ten crates at lockstep version 0.0.18, released together.
log facade via rlg::init(); tracing layer (tracing-layer feature)
Stable
Export
OTLP/HTTP to a local Collector (rlg-otlp)
Stable
Agents
MCP server over stdio, streamable HTTP and HTTP+SSE (rlg-mcp)
Stable
Enrichment
eBPF kernel context (rlg-ebpf, Linux)
Scaffold
Ecosystem comparison
rlg trades tracing's span model for an event-only engine that keeps
formatting and I/O off the application thread and ships native sinks,
many formats and an agent interface in the box.
The competitive_bench suite times rlg's fire() against
tracing::info! and log::info! for single records, records with
attributes, 10,000-record bursts and latency distribution. It runs in
CI on every release tag, and its results are published as workflow
artifacts.
Scenario
Result
Environment
rlg fire(), one record
598 ns
GitHub-hosted ubuntu-latest, release profile
tracing::info! to a discarding writer
591 ns
same run
rlg fire() with 3 attributes
947 ns (tracing: 1,117 ns)
same run
On the calling thread rlg now costs about what tracing costs, without
formatting there; what it buys is that the caller never waits on the
sink's I/O.
Load it with Config::load(Some("rlg.toml")), or with the tokio
feature Config::load_async, and follow edits with
Config::hot_reload_async. RUST_LOG sets the level too. The
crate README lists every field.
Examples
Example
Shows
Run
example_log_format
All 14 formats side by side
cargo run -p rlg --example example_log_format
example_config
TOML config, async load, hot-reload
cargo run -p rlg --example example_config --features tokio
example_macros
The logging macros
cargo run -p rlg --example example_macros
serve_a_session
A full MCP session against rlg-mcp
cargo run -p rlg-mcp --example serve_a_session
honeycomb
Exporting through a local Collector
cargo run -p rlg-otlp --example honeycomb
CI runs every example on each pull request (examples-smoke.yml), except
example_config and example_utils, async demos whose behaviour the
crate's own tests cover.
When not to use rlg
Low volume. Below about a hundred records a second, a background
thread and a 65k-slot buffer buy nothing a synchronous logger does not
already give you.
Spans are your model. rlg records events. If hierarchical spans are
what you analyse, use tracing directly; rlg's layer only bridges its
events.
Windows Event Log. There is no native Windows sink; rlg writes to a
file or stdout there.
Every record must survive a crash. Records wait in memory until the
flusher writes them; a process killed before the FlushGuard drops
loses what is still buffered.
You need a stable API. rlg is at 0.0.x: any release may break,
and it has one maintainer.
Development
bash
make verify # everything CI runs on a pull request
make demo # re-render .github/demo.gif from .github/demo.tape
DEVELOPMENT.md lists every gate with its local
command: Miri, Loom and Kani for the engine's concurrency and memory
safety, four fuzz targets, cargo-deny and cargo-vet for the dependency
tree, cargo-semver-checks, a 95% coverage floor and complexity ceilings.
Contribution and signing rules are in CONTRIBUTING.md
and AGENTS.md.
Security
Reporting: privately, by email or GitHub's advisory form; never in a
public issue. The process and response time are in SECURITY.md.
Memory safety: unsafe is denied across the workspace except the
documented macOS os_log FFI in crates/rlg/src/sink.rs. The engine
runs under Miri on every push.
Resource limits: the ring buffer is bounded at 65,536 records and
evicts the oldest when full; rlg-otlp caps a collector's response
headers at 16 KiB and times out every request.
Fuzzing: four cargo-fuzz targets (record parsing, format names,
config loading, redaction) run on every pull request; see
docs/OSS-FUZZ.md for OSS-Fuzz status.
Supply chain: every dependency passes cargo-deny and cargo-vet;
releases publish through crates.io Trusted Publishing with
sigstore-signed SBOMs (pkg/VERIFY.md).
SemVer axis: rlg is at 0.0.x, so under Cargo's rules every release
may be breaking. Breaking changes are marked Breaking in the
CHANGELOG, and cargo-semver-checks runs on every pull request so none
slips through unannounced.
Output stability: the bytes a format produces are an interface. A
change to them for the same record is breaking even when no signature
moves, and is recorded the same way.
Minimum toolchain: Rust 1.89.0, enforced in CI; a rise is its own
CHANGELOG entry with the reason. docs/POLICIES.md
has the full policy.