60e0ffc959
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from prefab_ui.components import Column, Heading, Muted
|
|
from prefab_ui.components.charts import BarChart, ChartSeries
|
|
|
|
from fastmcp import FastMCP
|
|
|
|
mcp = FastMCP("Sales Dashboard")
|
|
|
|
DATA = [
|
|
{"month": "Jan", "online": 4200, "retail": 2400},
|
|
{"month": "Feb", "online": 3800, "retail": 2100},
|
|
{"month": "Mar", "online": 5100, "retail": 2800},
|
|
{"month": "Apr", "online": 4600, "retail": 3200},
|
|
{"month": "May", "online": 5800, "retail": 3100},
|
|
{"month": "Jun", "online": 6200, "retail": 3500},
|
|
]
|
|
|
|
|
|
@mcp.tool(app=True)
|
|
def sales_chart(stacked: bool = False) -> Column:
|
|
"""Show monthly online vs. retail sales as a bar chart."""
|
|
with Column(gap=4, css_class="p-6") as view:
|
|
Heading("Monthly Sales")
|
|
Muted("Online vs. retail — hover bars for details")
|
|
BarChart(
|
|
data=DATA,
|
|
series=[
|
|
ChartSeries(data_key="online", label="Online"),
|
|
ChartSeries(data_key="retail", label="Retail"),
|
|
],
|
|
x_axis="month",
|
|
stacked=stacked,
|
|
show_legend=True,
|
|
)
|
|
return view
|
|
|
|
|
|
if __name__ == "__main__":
|
|
mcp.run()
|