Add embedded MCP server for in-process UI introspection#11217
Open
tilladam wants to merge 8 commits intoslint-ui:masterfrom
Open
Add embedded MCP server for in-process UI introspection#11217tilladam wants to merge 8 commits intoslint-ui:masterfrom
tilladam wants to merge 8 commits intoslint-ui:masterfrom
Conversation
4 tasks
Add an embedded MCP (Model Context Protocol) server that allows MCP clients (e.g. Claude Code) to inspect and interact with running Slint applications via HTTP/JSON-RPC. The MCP server uses the pbjson serde impls from PR 2 to serialize proto types directly as JSON — no hand-written parameter structs or manual JSON conversion. Both the systest (binary protobuf over TCP) and MCP (JSON over HTTP) transports share a common introspection layer for window/element tracking with FIFO eviction. New files: - introspection.rs: shared IntrospectionState with arena management - mcp_server.rs: thin JSON-RPC/HTTP wrapper with 11 MCP tools Enable with: SLINT_MCP_PORT=8080 ./your-slint-app
bcccaf1 to
5413ba0
Compare
Move window_properties() and take_snapshot_response() into IntrospectionState so both transports call the same method instead of duplicating the logic. Remove redundant index_to_handle/handle_to_index wrappers and physical size/position helpers — import directly from introspection. Move accessibility role mapping test to introspection.rs where the function under test lives.
tronical
approved these changes
Apr 10, 2026
Member
|
Thanks, is is I think as reduced as it gets without "Handarbeit" :). I think we should take this in and start experimenting and learning :) |
tronical
reviewed
Apr 10, 2026
Member
tronical
left a comment
There was a problem hiding this comment.
(Merging contingent on clippy being green, the servo failure is unrelated)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mcpfeature is enabled andSLINT_MCP_PORT=<port>is set at runtime, an HTTP server starts on127.0.0.1:<port>implementing MCP Streamable HTTP transport with 11 toolssystestto share anIntrospectionStatewith the MCP transport, eliminating duplicated window/element tracking logicArchitecture
MCP tools
list_windowsget_window_propertiesget_element_treeget_element_propertiesfind_elements_by_idquery_element_descendantstake_screenshotclick_elementinvoke_accessibility_actionset_element_valuedispatch_key_eventKey design decisions
element_properties(),query_element_descendants(), role/button/action conversions all live inintrospection.rs, called by both transports.initializeresponse includes detailed workflow guidance, handle format, enum values, query syntax, and interaction tips — consumed by all MCP clients.Test plan
cargo build -p i-slint-backend-testing --features system-testing— systest compilescargo build -p i-slint-backend-testing --features mcp— MCP compilescargo test -p i-slint-backend-testing --features system-testing,mcp— 19 tests pass