Skip to main content

chuk-view-schemas

Pydantic v2 schemas and FastMCP decorators for chuk-mcp-ui Views.

Build MCP Apps with interactive UI — charts, maps, tables, dashboards — from Python, with zero JavaScript.

Install

# Schemas only
pip install chuk-view-schemas

# With FastMCP decorator support
pip install chuk-view-schemas[fastmcp]

Quick Start

from mcp.server.fastmcp import FastMCP
from chuk_view_schemas.fastmcp import chart_tool
from chuk_view_schemas.chart import ChartContent, ChartDataset

mcp = FastMCP("my-server")

@chart_tool(mcp, "show_popularity")
async def show_popularity(chart_type: str = "bar") -> ChartContent:
    """Show programming language popularity as an interactive chart."""
    return ChartContent(
        chartType=chart_type,
        title="Language Popularity",
        data=[
            ChartDataset(
                label="Usage %",
                values=[
                    {"label": "Python", "value": 31.0},
                    {"label": "JavaScript", "value": 25.2},
                    {"label": "Rust", "value": 18.1},
                ],
            )
        ],
    )

The @chart_tool decorator handles:

  • Registering the ui:// resource URI pointing to the hosted chart view
  • Wrapping the return in a CallToolResult with content + structuredContent
  • Generating a text fallback for the LLM

Available Decorators

from chuk_view_schemas.fastmcp import (
    map_tool,        # Interactive Leaflet map
    chart_tool,      # Bar, line, pie, scatter, etc.
    datatable_tool,  # Sortable, filterable table
    form_tool,       # JSON Schema driven form
    markdown_tool,   # Rich markdown rendering
    video_tool,      # HTML5 video player
    pdf_tool,        # PDF viewer
    dashboard_tool,  # Multi-panel layout
    split_tool,      # Two-panel side-by-side
    tabs_tool,       # Tabbed panels
    detail_tool,     # Single record display
    counter_tool,    # Big number with delta
    code_tool,       # Syntax highlighted code
    progress_tool,   # Progress bars
    confirm_tool,    # Confirmation dialog
    json_tool,       # JSON tree viewer
    status_tool,     # Traffic light status
    view_tool,       # Generic (any view type)
)

Schemas

All schemas are Pydantic v2 models with camelCase aliases for JSON serialization:

from chuk_view_schemas import (
    ChartContent, ChartDataset,
    MapContent, MapLayer,
    DataTableContent, Column,
    FormContent,
    DashboardContent, Panel,
    SplitContent, SplitPanel,
    TabsContent, Tab,
    MarkdownContent,
    VideoContent,
    PdfContent,
)

View Inference

Automatically suggest the best view for your data:

from chuk_view_schemas import infer_view

suggestion = infer_view([{"lat": 51.5, "lon": -0.1, "name": "London"}])
# ViewSuggestion(view="map", confidence=0.80, reason="Objects contain lat/lon fields")

Hosted Views

All views are pre-built and hosted at versioned URLs on Fly.io:

https://mcp-views.chukai.io/chart/v1
https://mcp-views.chukai.io/map/v1
https://mcp-views.chukai.io/datatable/v1
...

The decorators point at these URLs automatically. Your Python server never serves HTML.

Links

Metadata

Release files for chuk-view-schemas 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chuk-view-schemas 0.1.8
File Size Uploaded
chuk_view_schemas-0.1.8.tar.gz 32.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chuk-view-schemas 0.1.8
File Interpreter ABI Platform
chuk_view_schemas-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 77.6 kB

Release files / chuk_view_schemas-0.1.8.tar.gz

Download URL chuk_view_schemas-0.1.8.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a0ce43a811187799be7b7cf079e66478b688c60b7f7a7454ce67f80afb56a278
BLAKE2b-256 checksum
How to use checksums
e420e7aadf985be0ec85f22a56ac5924e9ced1f80ce31b451e5970d29bd0694a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release files / chuk_view_schemas-0.1.8-py3-none-any.whl

Download URL chuk_view_schemas-0.1.8-py3-none-any.whl
Size 45.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
131fceac8f0deeb8e0cfe2a3dd050c83da298c863ca99bdd2f2db7b11a25f3f7
BLAKE2b-256 checksum
How to use checksums
f1983b881175f7d3ff5573f9e04bc2e01a7e8f0e05a9f1c3dae5cd7548c73477
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page