Skip to main content

Crate egui_mcp_client

Crate egui_mcp_client 

Source
Expand description

Library to embed in egui apps for MCP integration

This crate provides client-side integration for egui applications to support MCP automation features that require direct application access:

  • Screenshots
  • Coordinate-based input (clicks, drags)
  • Keyboard input
  • Scroll events

Note: UI tree access and element-based interactions are handled via AT-SPI on the server side and don’t require this client library.

§Usage in raw_input_hook

impl eframe::App for MyApp {
    fn raw_input_hook(&mut self, ctx: &egui::Context, raw_input: &mut egui::RawInput) {
        let inputs = self.runtime.block_on(self.mcp_client.take_pending_inputs());
        egui_mcp_client::inject_inputs(ctx, raw_input, inputs);
    }
}

Re-exports§

pub use egui;

Structs§

FrameStats
Frame statistics for performance monitoring
Highlight
A visual highlight to be drawn over an element
IpcServer
IPC server that listens for MCP requests
LogEntry
Log entry captured from the application
McpClient
Shared state for the MCP client
McpLogLayer
A tracing Layer that captures log entries for MCP access
PerfReport
Performance report from a recording session

Enums§

MouseButton
Mouse button for click operations
PendingInput
Pending input event to be processed by the egui application
Request
Request types for IPC communication
Response
Response types for IPC communication

Constants§

DEFAULT_MAX_MESSAGE_LENGTH
Default maximum message length (8KB)

Functions§

draw_highlights
Draw active highlights on the egui context.
inject_inputs
Inject pending MCP inputs into egui’s RawInput.
level_to_priority
Helper functions for filtering logs by level

Type Aliases§

LogBuffer
Shared log buffer type