molerat: An accessibility & agentic layer for Rust UI applications, built on AccessKit π
molerat-demo.mp4
Table of Contents
cargo add moleratAdd molerat to your app and publish a semantic view alongside your existing UI:
use molerat::Molerat;
let mut molerat = Molerat::<()>::new("Notes");
molerat.publish(|ui| {
ui.text("status", "All changes saved");
});See the available semantic UI components in the API documentation.
If you have actions in your app, define an enum and return them from your UI handlers:
use molerat::Molerat;
#[derive(Debug)]
enum Message {
Save,
}
let mut molerat = Molerat::<Message>::new("Notes");
molerat.publish(|ui| {
ui.button("save", "Save").on_click(|| Message::Save);
});See the available semantic actions in the API documentation.
To handle the incoming actions:
for message in molerat.messages() {
match message {
Message::Save => { /* update app state */ }
}
}Here is how your semantic tree and actions will look in Accerciser:
ratatui-recipe-atspi: An app that speaks Ratatouille recipe.ratatui-dashboard-atspi: An app that speaks the system stats.ratatui-recipe-mcp: Task queue controlled by agents.ratatui-sqlite-mcp: SQLite workbench controlled by agents.ratatui-paint-mcp: Drawing canvas controlled by agents.ratatui-showcase: The demo content shown in the video above.
Run one with:
cargo run --example <example-name> --features <mcp|atspi>
# For example:
cargo run --example ratatui-recipe-atspi --features atspi
# The MCP examples require the stdio bridge (molerat-mcp) to be installed:
cargo install molerat --features mcp --bin molerat-mcp
cargo run --example ratatui-recipe-mcp --features mcpThe examples above are built with Ratatui, but molerat is not designed for any specific UI framework.
Tip
If you want to integrate molerat with Ratatui, see the migration guide or simply give that document as a prompt to your agent π§
Here is knife (a reverse-engineering TUI) solving a crackme challenge:
molerat-knife.mp4
Here is BugStalker (a Rust debugger) debugging an application:
molerat-bugstalker.mp4
You can use the AT-SPI to expose your UI/actions to screen readers on Linux!
- Enable
atspifeature:
cargo add molerat --features atspi- And then adjust your constructor to use AT-SPI:
let mut molerat = Molerat::<Message>::new_atspi("Notes");Nothing else is needed!
You can use the Model Context Protocol (MCP) to expose your UI/actions to agents!
- Install the
molerat-mcpstdio bridge and register it with your MCP client:
cargo install molerat --features mcp --bin molerat-mcp- Register the installed binary with your MCP client. e.g. Codex:
codex mcp add molerat -- "$(command -v molerat-mcp)"- Enable
mcpfeature:
cargo add molerat --features mcp- And then you can change your constructor to use the MCP bridge:
let mut molerat = Molerat::<Message>::new_mcp("Notes")?;That's it! Your app is now agentic and can be controlled by your favorite agent.
Licensed under either of Apache License Version 2.0 or The MIT License at your option.
π¦ γ( ΒΊ _ ΒΊ γ) - respect crables!
Copyright Β© 2026, Orhun ParmaksΔ±z
