Python library for building MCP App UIs — declarative components, themes, and MCP protocol client. Define an app in Python, get self-contained HTML.
Project description
mcpbundles-app-ui
Python library for building MCP App UIs. Define an app declaratively in Python, get self-contained HTML with built-in MCP protocol support and interactive charts.
Installation
pip install mcpbundles-app-ui
Quick Start
from mcpbundles_app_ui import App, LightTheme, Stats, Stat, Card
class MyApp(App):
name = "My App"
subtitle = "Analytics overview"
theme = LightTheme(accent="#3b82f6")
layout = [
Stats(
Stat("preview.total", "Total", primary=True),
Stat("preview.thisWeek", "This Week"),
),
Card(title="Select an option to explore"),
]
# Generate self-contained HTML
html = MyApp().render()
Features
- Declarative components:
Stats,Stat,Card,Grid,Chart.bar(),BarList,RecentList, and more - Theme system:
LightThemeandDarkThemewith customizable accent colors, fonts, and all design tokens - Interactive charts: Built-in Frappe Charts (SVG, CSP-safe, zero dependencies) — bar, line, pie, donut, percentage, heatmap
- MCP protocol client: Built-in JavaScript for
initializeMCP(),callTool(),sendMessage(),askAI() - Navigation: Breadcrumb system with
setBreadcrumbs(),pushBreadcrumb(),popBreadcrumb() - Loading states:
showLoading(),hideLoading(),withLoading(),paginateAll() - Export utilities:
copyToClipboard(),toCSV(),exportAsCSV() - Toast notifications:
showToast()for success/error feedback - Path-based assets:
custom_headandcustom_scriptsacceptPathobjects for file-based CSS/JS - Zero Python dependencies: Only stdlib. Produces standalone HTML with all CSS/JS inline.
Charts
Built-in Frappe Charts provides real interactive SVG charts. Available globally in custom_scripts:
// Bar chart
renderBarChart('container-id', ['Mon', 'Tue', 'Wed'], [10, 20, 15]);
// Line chart with area fill
renderLineChart('container-id', ['Jan', 'Feb', 'Mar'], [100, 150, 130]);
// Pie chart
renderPieChart('container-id', ['Chrome', 'Firefox', 'Safari'], [60, 25, 15]);
// Donut chart
renderPieChart('container-id', labels, values, { donut: true });
// Percentage chart (horizontal stacked bar)
renderPercentageChart('container-id', labels, values);
// Full control
renderChart('container-id', {
type: 'bar',
data: {
labels: ['Q1', 'Q2', 'Q3', 'Q4'],
datasets: [
{ name: 'Revenue', values: [100, 200, 150, 300] },
{ name: 'Costs', values: [80, 150, 120, 200] }
]
},
colors: ['#3b82f6', '#ef4444'],
height: 300,
barOptions: { stacked: true }
});
// Update existing chart data
updateChart('container-id', newData);
Charts automatically use the app's theme colors (--chart-1 through --chart-6).
Components
| Component | Description |
|---|---|
App |
Base class for app definitions |
Stats |
Row of statistic cards |
Stat |
Single statistic with data binding |
Card |
Container with optional title |
Grid |
Grid layout (2-4 columns) |
Chart.bar() |
Bar chart with data binding |
Chart.comparison() |
Side-by-side comparison |
Chart.funnel() |
Pipeline/funnel chart |
BarList |
Horizontal bar ranking list |
RecentList |
Recent items list |
StageList |
Pipeline stage list |
Raw |
Escape hatch for custom HTML |
Themes
from mcpbundles_app_ui import LightTheme, DarkTheme
# Custom accent color
theme = LightTheme(accent="#8b5cf6")
# Custom fonts
theme = LightTheme(
accent="#3b82f6",
font_family="'Inter', system-ui, sans-serif",
font_url="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",
)
File-Based Assets
Load CSS/JS from files instead of inline strings:
from pathlib import Path
from mcpbundles_app_ui import App, LightTheme
class MyApp(App):
name = "My App"
theme = LightTheme()
custom_head = Path(__file__).parent / "assets/styles.html"
custom_scripts = Path(__file__).parent / "assets/app.js"
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 mcpbundles_app_ui-0.3.0.tar.gz.
File metadata
- Download URL: mcpbundles_app_ui-0.3.0.tar.gz
- Upload date:
- Size: 44.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d84c27206e9a50250ddd6af6038e246dda11d84f635076f6b67516feba5b8d96
|
|
| MD5 |
3e54de7937fa2b6be8a8173b1da8cf24
|
|
| BLAKE2b-256 |
4819efb656bb17c636a5f0b05503ade729ed1a3febef6378c4077dca5175ed19
|
Provenance
The following attestation bundles were made for mcpbundles_app_ui-0.3.0.tar.gz:
Publisher:
publish.yml on thinkchainai/mcpbundles-app-ui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcpbundles_app_ui-0.3.0.tar.gz -
Subject digest:
d84c27206e9a50250ddd6af6038e246dda11d84f635076f6b67516feba5b8d96 - Sigstore transparency entry: 969867486
- Sigstore integration time:
-
Permalink:
thinkchainai/mcpbundles-app-ui@d31ba1f1388de802f6fcebbbcf54705415d0dd0e -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/thinkchainai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d31ba1f1388de802f6fcebbbcf54705415d0dd0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcpbundles_app_ui-0.3.0-py3-none-any.whl.
File metadata
- Download URL: mcpbundles_app_ui-0.3.0-py3-none-any.whl
- Upload date:
- Size: 52.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
334376f2ef6ac87159c146f788cf40d94bd23ac31d2957575aaa4d70eb953272
|
|
| MD5 |
a4403499ec6ce6535406bcce687351aa
|
|
| BLAKE2b-256 |
9fa76600980755dc3ca20e4730e1e8bdad8fd9a62bfae67078e76a0971fe8859
|
Provenance
The following attestation bundles were made for mcpbundles_app_ui-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on thinkchainai/mcpbundles-app-ui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcpbundles_app_ui-0.3.0-py3-none-any.whl -
Subject digest:
334376f2ef6ac87159c146f788cf40d94bd23ac31d2957575aaa4d70eb953272 - Sigstore transparency entry: 969867516
- Sigstore integration time:
-
Permalink:
thinkchainai/mcpbundles-app-ui@d31ba1f1388de802f6fcebbbcf54705415d0dd0e -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/thinkchainai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d31ba1f1388de802f6fcebbbcf54705415d0dd0e -
Trigger Event:
push
-
Statement type: