mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 23:29:10 +02:00
* Add FastMCPApp — a Provider for composable MCP applications * Wire Prefab callable resolver via to_json(tool_resolver=) parameter * Remove inspect.signature compat check, use try/except until prefab 0.10.0 * Address review: fix add_tool registry gaps, normalize auth errors, bump prefab to 0.10.0 * Register global key after _add_component succeeds * Simplify: extract decorator dispatch, use get_fastmcp_meta, expose get_global_tool * Remove prek from Marvin workflows These workflows run Claude to respond to /marvin mentions — linting the repo is unnecessary and fails without renderer deps installed. * Return ResolvedTool from callable resolver, add contacts example The callable resolver now returns ResolvedTool (from prefab_ui) instead of a plain string, carrying metadata like unwrap_result that the renderer needs to correctly handle structuredContent envelopes. The unwrap_result flag is derived from the tool's x-fastmcp-wrap-result output schema marker. * Bump prefab-ui requirement to >=0.11.0 * Remove stale ty ignore comments now that prefab-ui 0.11 is published * Add fastmcp dev apps command with browser UI preview * Improve fastmcp dev apps: dropdown picker, reload flag, process cleanup - Replace Tabs with Pages+Select for tool picker (Rx-based reactive state) - Add --reload/--no-reload flag (default: True) to fastmcp dev apps - Kill entire process group on shutdown so port 8000 is freed properly - Suppress uvicorn websockets deprecation warning (websockets-sansio) - Bump prefab-ui to >=0.11.1 (fixes get_renderer_head bug in 0.11.0) - Add farewell tool to greet_server example for multi-tool testing * Add docs for fastmcp dev apps command * Fix orphaned server on startup failure, guard Unix-only signal handling * Show tool title in picker, remove editable prefab source * Bump prefab-ui to >=0.11.2 * Fail fast when prefab-ui is not installed * Add apps/development docs, link from prefab and sidebar * Fix optional field defaults, fail with non-zero on startup timeout
38 lines
1.1 KiB
Python
38 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()
|