Skip to main content

Crate iced_mcp

Crate iced_mcp 

Source
Expand description

Lets AI agents see and drive a running iced application.

The bridge wraps your program the way iced’s own tester and devtools do: it adds a loopback socket, a widget wrapped around every window’s view, and a log of your messages. The iced-mcp-server binary speaks MCP to the agent and this protocol to the app, so an agent can read the widget tree, click and type by text or id, scroll, drag, take screenshots and read what the app did in response — without the OS accessibility APIs or pixel guessing.

fn main() -> iced::Result {
    let app = iced::application(App::default, App::update, App::view);
    // Attached only when `ICED_MCP=1`; otherwise exactly `app.run()`.
    iced_mcp::run(app)
}

Only build it into development binaries (behind a cargo feature): anyone who can reach the port can drive the app. It binds 127.0.0.1 only, and ICED_MCP_TOKEN makes connections present a token first.

Re-exports§

pub use iced_mcp_protocol as protocol;

Structs§

Attach
A Program with the bridge attached.
Config
Where and how the bridge listens.
Message
The program’s messages, with the bridge’s beside them.
State
The program’s state, with the bridge’s beside it.

Functions§

attach
Wraps any iced Program — usually an Application — with the bridge.
enabled
Whether ICED_MCP asks for the bridge (set, and not 0/false).
run
Runs application, with the bridge attached when enabled — the one line most apps need.
run_with_state
run, also sharing the app’s state with the state tool (see Attach::state).