Expose AnyWidget interfaces as interactive MCP Apps
Project description
Experimental:
anywidget-mcpis experimental software. Its API is subject to breaking changes.
anywidget-mcp runs AnyWidgets inside AI
conversations. You can interact with a widget directly, and the model can
respond to your input.
Start with a widget from an existing package, or bring the same widget you use in Jupyter or marimo.
Try a multi-widget conversation
Requires Python 3.11 or newer. Serve
Wigglystuff's ColorPicker and
LiveEdit together:
uvx --with wigglystuff anywidget-mcp serve \
wigglystuff:ColorPicker \
wigglystuff:LiveEdit \
--port 8010
Connect a host that supports MCP Apps. For a quick local setup, start the mcp-use Inspector in another terminal:
npx --yes @mcp-use/inspector@12.0.3 \
--url http://127.0.0.1:8010/mcp \
--port 7878
Open Inspector Chat, configure a model provider, then ask:
let me pick a color
Choose a color using ColorPicker, then ask:
given my current selection help explain the HEX to RGB algo interactively
The model reads the picker's current color and opens LiveEdit for the interactive explanation. One server exposes both widgets, so the conversation can move from selection to explanation without leaving the chat.
Getting started explains the Inspector flow and other MCP clients.
But why?
💬 Stay in context: A standalone web app sends you to a separate page. An MCP App stays in the conversation, exchanges data through MCP, and runs in a host-controlled sandbox. With your consent, it can ask the host to use tools you already connected.
🧩 Skip the scaffolding: Building an MCP App directly means wiring together
tools, UI resources, browser code, the host connection, and shared state.
anywidget-mcp handles that integration. You define an
AnyWidget that keeps browser behavior and Python state
in one component.
🧪 Develop in notebooks: The same widget runs in Jupyter and marimo. Create it from Python, inspect its state, and use marimo's reactive execution to test scenarios before serving it through MCP.
🧰 Combine widgets: One server can expose multiple widgets as separate tools, or one call can open several together. Combine widgets from the AnyWidget gallery into an interactive environment for the task, then add your own.
✨ Invent at runtime: When you cannot enumerate every useful interface in
advance, serve
create_anywidget.
Supply Python source directly or ask an agent to invent a fresh AnyWidget during
the conversation. Use that natural-language loop to develop widgets and test
concepts. Run the factory in a sandbox because supplied source executes with the
MCP server's permissions.
Install in a project
Install anywidget-mcp in the Python environment that owns your widget code:
uv pip install anywidget-mcp
Bring your own AnyWidget
Point the CLI at your AnyWidget's import path:
anywidget-mcp serve my_widgets:MyWidget
Or start the server from Python:
from anywidget_mcp import serve
from my_widgets import MyWidget
serve(MyWidget)
MyWidget remains the same anywidget.AnyWidget subclass you use in
notebooks. Browser changes stay synchronized with its Python traits.
When the widget needs data from the conversation, use a Python function that accepts the input and returns an AnyWidget. This function is a widget factory. Pass input to widgets covers that workflow, multiple widgets, and existing MCP servers.
Documentation
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 anywidget_mcp-0.0.3.tar.gz.
File metadata
- Download URL: anywidget_mcp-0.0.3.tar.gz
- Upload date:
- Size: 153.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.30 {"installer":{"name":"uv","version":"0.11.30","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 |
04a4d4bb0ae1bfb0605f2c87703c5b84dc010c031d894f3d7299454b1d5ef0f2
|
|
| MD5 |
b228bcd57c0fdf1d31830140e6b333b6
|
|
| BLAKE2b-256 |
96377ca4a6847c070af51d6fc1732bf7c10b422c48361352cac92323554764d4
|
File details
Details for the file anywidget_mcp-0.0.3-py3-none-any.whl.
File metadata
- Download URL: anywidget_mcp-0.0.3-py3-none-any.whl
- Upload date:
- Size: 165.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.30 {"installer":{"name":"uv","version":"0.11.30","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 |
bc63f6eab80ef4d14b1b0f28809f38d9168436eaca35024e9622d241937cf156
|
|
| MD5 |
379760e7d303a42d5345e54f32144833
|
|
| BLAKE2b-256 |
9eb1c1c8645ee7c0bfd502b4516c0a28fbd8eb3a127f73cf0876d95a05b09eb2
|