mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-14 01: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
67 lines
2 KiB
Python
67 lines
2 KiB
Python
from prefab_ui.components import Column, Heading, Muted
|
|
from prefab_ui.components.data_table import DataTable, DataTableColumn
|
|
|
|
from fastmcp import FastMCP
|
|
|
|
mcp = FastMCP("Team Directory")
|
|
|
|
TEAM = [
|
|
{
|
|
"name": "Alice Chen",
|
|
"role": "Engineering",
|
|
"level": "Senior",
|
|
"location": "San Francisco",
|
|
},
|
|
{"name": "Bob Martinez", "role": "Design", "level": "Lead", "location": "New York"},
|
|
{
|
|
"name": "Carol Johnson",
|
|
"role": "Engineering",
|
|
"level": "Staff",
|
|
"location": "London",
|
|
},
|
|
{
|
|
"name": "David Kim",
|
|
"role": "Product",
|
|
"level": "Senior",
|
|
"location": "San Francisco",
|
|
},
|
|
{"name": "Eva Müller", "role": "Engineering", "level": "Mid", "location": "Berlin"},
|
|
{
|
|
"name": "Frank Okafor",
|
|
"role": "Data Science",
|
|
"level": "Senior",
|
|
"location": "Lagos",
|
|
},
|
|
{
|
|
"name": "Grace Liu",
|
|
"role": "Engineering",
|
|
"level": "Junior",
|
|
"location": "Singapore",
|
|
},
|
|
{"name": "Hassan Ali", "role": "Design", "level": "Senior", "location": "Dubai"},
|
|
]
|
|
|
|
|
|
@mcp.tool(app=True)
|
|
def team_directory(department: str | None = None) -> Column:
|
|
"""Browse the team directory — sortable, searchable, paginated."""
|
|
rows = [p for p in TEAM if not department or p["role"] == department]
|
|
with Column(gap=4, css_class="p-6") as view:
|
|
Heading("Team Directory")
|
|
Muted(f"{len(rows)} people")
|
|
DataTable(
|
|
columns=[
|
|
DataTableColumn(key="name", header="Name", sortable=True),
|
|
DataTableColumn(key="role", header="Department", sortable=True),
|
|
DataTableColumn(key="level", header="Level", sortable=True),
|
|
DataTableColumn(key="location", header="Location", sortable=True),
|
|
],
|
|
rows=rows,
|
|
searchable=True,
|
|
paginated=True,
|
|
)
|
|
return view
|
|
|
|
|
|
if __name__ == "__main__":
|
|
mcp.run()
|