Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions api/rs/slint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ unsafe-single-threaded = ["i-slint-core/unsafe-single-threaded"]
## APIs to support screen readers and other assistive technologies.
accessibility = ["i-slint-backend-selector/accessibility"]

## Enable the embedded MCP (Model Context Protocol) server for runtime UI introspection.
##
## When this feature is enabled and the `SLINT_MCP_PORT` environment variable is set at runtime,
## the application starts an HTTP server that exposes the UI element tree, properties, and
## interaction capabilities via the MCP protocol. This allows MCP clients (e.g. coding assistants)
## to inspect and interact with the running application.
##
## Requires `SLINT_EMIT_DEBUG_INFO=1` at build time for full element information.
mcp = ["i-slint-backend-selector/mcp"]

## Enable integration with [raw-window-handle](raw_window_handle_06) version 0.6. This provides a
## [`Window::window_handle()`] function that returns a struct that implements
## [HasWindowHandle](raw_window_handle_06::HasWindowHandle) and
Expand Down
1 change: 1 addition & 0 deletions internal/backends/selector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ accessibility = ["i-slint-backend-winit?/accessibility"]
raw-window-handle-06 = ["i-slint-core/raw-window-handle-06", "i-slint-backend-winit?/raw-window-handle-06"]

system-testing = ["i-slint-backend-testing/system-testing"]
mcp = ["i-slint-backend-testing/mcp"]

unstable-wgpu-27 = [
"i-slint-core/unstable-wgpu-27",
Expand Down
7 changes: 7 additions & 0 deletions internal/backends/selector/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ pub fn with_global_context<R>(f: impl FnOnce(&SlintContext) -> R) -> Result<R, P
i_slint_backend_testing::systest::init();
}

#[cfg(feature = "mcp")]
if result.is_ok() && platform_created {
if let Err(e) = i_slint_backend_testing::mcp_server::init() {
i_slint_core::debug_log!("MCP server init failed: {e:?}");
}
}

result
}

Expand Down
5 changes: 5 additions & 0 deletions internal/backends/testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ internal = ["include_dir"]
# ffi for C++ bindings
ffi = []
system-testing = ["quick-protobuf", "pb-rs", "generational-arena", "async-net", "futures-lite", "byteorder", "image"]
mcp = ["generational-arena", "async-net", "futures-lite", "image", "serde", "serde_json", "base64", "httparse"]

[dependencies]
i-slint-core = { workspace = true, features = ["std", "shared-parley"] }
Expand All @@ -33,6 +34,10 @@ async-net = { version = "2.0.0", optional = true }
futures-lite = { version = "2.3.0", optional = true }
byteorder = { version = "1.5.0", optional = true }
image = { workspace = true, optional = true, features = ["png"] }
serde = { workspace = true, optional = true }
serde_json = { workspace = true, optional = true }
base64 = { version = "0.22", optional = true }
httparse = { version = "1", optional = true }
include_dir = { version = "0.7", optional = true }

[build-dependencies]
Expand Down
Loading
Loading