Serve an existing Streamlit app as an MCP server — agents drive it natively, no browser.
Project description
streamlit-mcp
Serve any Streamlit app as an MCP server. Agents introspect your app's widgets,
set values, click buttons, and read the rendered output and session_state — natively,
over MCP, with no browser automation.
uv tool install . # or: pip install .
# serve an app over MCP (stdio for local clients, or HTTP/SSE for networked agents)
streamlit-mcp serve app.py
streamlit-mcp serve app.py --transport http --host 127.0.0.1 --port 8000
# drive it yourself from the terminal (same engine the agent uses)
streamlit-mcp inspect app.py
streamlit-mcp call app.py --set "Name=agent" --click "Save" --read
Streamlit has no callback graph — it reruns the whole script per interaction — so
streamlit-mcp drives the app headlessly through Streamlit's own test runtime
(streamlit.testing.v1.AppTest) and returns the semantic element tree, not pixels.
Gradio and Dash already shipped native app-as-MCP; this fills the Streamlit gap.
Tools exposed to agents
| Tool | What it does |
|---|---|
list_widgets / get_layout |
introspect widgets (kind, label, value, constraints) |
set_widget(identifier, value) |
set a widget and rerun |
click(identifier) |
click a button and rerun |
read_output() |
the rendered element tree, agent-readable |
get_state() |
the app's session_state |
Supported widgets (v1): text_input, number_input, text_area, slider, selectbox,
multiselect, checkbox, radio, button, date_input. Unsupported elements (file_uploader,
custom components, st.chat, fragments) are reported explicitly, never silently dropped.
Human ↔ agent parity
Everything an agent can do over MCP, a human can do via the CLI — both call the same engine. The read-only mode and widget allow-list guardrails apply identically to both surfaces.
Security / trust model
app_pathis executed as trusted code in the server process (that's how AppTest runs it). Only serve apps you trust.get_state/read_outputexpose the app'ssession_stateto the caller — do not put secrets there.- HTTP/SSE is loopback-only in v1. A bearer-token primitive exists, but it is not yet
enforced on the transport, so
serverefuses to bind HTTP/SSE to a non-loopback host. Use stdio for local clients, or HTTP/SSE on127.0.0.1. Enforced networked auth is the top follow-up (seeCHANGELOG.md).
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_mcp-0.1.0.tar.gz.
File metadata
- Download URL: streamlit_mcp-0.1.0.tar.gz
- Upload date:
- Size: 181.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cb42286ae666f5187dde4b183881bc90bfca87a5ff4aa0e8cd2ee9b297ec05b
|
|
| MD5 |
60d47e0b6b64e1703c9a1585c172088b
|
|
| BLAKE2b-256 |
38d2b559715cfeb9af2ba6bcae56ad187346d98adc5ac251462634ccbbb44914
|
File details
Details for the file streamlit_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: streamlit_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3d8fa3a5bb7c788a045d21311247790f6fe6a9d7e1a408ca84172ae4956b4df
|
|
| MD5 |
71a1f960906dca469c5272b137c22382
|
|
| BLAKE2b-256 |
63d094f813868054b2a2df4358306487fbdfdb52f2f3b1113060b3c7f4bca06e
|