Skip to main content

Expose AnyWidget interfaces as interactive MCP Apps

Project description

anywidget-mcp

PyPI License: MIT

Some answers work better as interfaces.

anywidget-mcp brings AnyWidget to MCP Apps. Build a widget once, use it in Jupyter or marimo, then let people open the same interface right inside the conversation.

Color pickers, data explorers, diagrams, and interactive explanations stay connected to Python, so the model can respond to what the user does next.

Start with a widget library or bring your own.

Documentation: peter-gy.github.io/anywidget-mcp

Install

Requires Python 3.11 or newer.

pip install anywidget-mcp

See a widget in chat

This example uses Wigglystuff, an AnyWidget library:

pip install wigglystuff
anywidget-mcp serve wigglystuff:ColorPicker --port 8010

Keep the server running. Start mcp-use Inspector in another terminal:

npx --yes @mcp-use/inspector@12.0.3 \
  --url http://127.0.0.1:8010/mcp \
  --port 7878 \
  --no-open

Open Inspector Chat, configure a model provider, and ask:

Use color_picker so I can choose a color.

The widget renders in the conversation. Change the color, then ask the model what color it is. The answer comes from the widget's current Python state.

Browse the AnyWidget gallery for other widgets.

Serve your AnyWidget

Point the CLI at any importable AnyWidget class:

anywidget-mcp serve my_widgets:MyWidget

Or start the server from Python:

from anywidget_mcp import serve
from my_widgets import MyWidget

serve(MyWidget)

anywidget-mcp supplies the MCP tool, app resource, session lifecycle, and state synchronization. MyWidget stays an ordinary anywidget.AnyWidget subclass with the same Python traits and frontend module used in notebooks.

When the widget needs data from the conversation, use a Python function that accepts the input and returns the widget. Runtime inputs and composition covers that workflow, multiple widgets, and existing FastMCP servers.

Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anywidget_mcp-0.0.1.tar.gz (148.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anywidget_mcp-0.0.1-py3-none-any.whl (159.4 kB view details)

Uploaded Python 3

File details

Details for the file anywidget_mcp-0.0.1.tar.gz.

File metadata

  • Download URL: anywidget_mcp-0.0.1.tar.gz
  • Upload date:
  • Size: 148.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for anywidget_mcp-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7eb6040a8dd6f5411f007fc12e35e91a3c8e6fd71b6a364e95ea02580c25ae12
MD5 1c1ae44ed4ea07794e4a14dd63f602a4
BLAKE2b-256 f1f8246ddc6a0e8d938388026245c30385fcb09cbdd2157bc81a6f1ce052ebdd

See more details on using hashes here.

Provenance

The following attestation bundles were made for anywidget_mcp-0.0.1.tar.gz:

Publisher: publish.yml on peter-gy/anywidget-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file anywidget_mcp-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: anywidget_mcp-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 159.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for anywidget_mcp-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c80e208ae71e199b8c6dc2d51da1146bb699926ac459e8f7c9f71e3d21ed434
MD5 cf115bfd478cc4e407934265ee052885
BLAKE2b-256 c0d7f0f4681800412febe2f9be98d88fef3b82dc47d26edc7741c282ca8635d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for anywidget_mcp-0.0.1-py3-none-any.whl:

Publisher: publish.yml on peter-gy/anywidget-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page