FastMCP Apps: Interactive Interfaces Inside the Chat

Let tools return forms, tables and charts that render in the conversation, and preview them locally.

Chat window displaying an interactive bar chart returned by a FastMCP app tool

Key takeaways

  • Install with pip install "fastmcp[apps]".
  • Set app=True on a tool and return a Prefab component.
  • Preview locally with fastmcp dev apps my_server.py.
  • Pin prefab-ui before deploying.

Text is not always the clearest answer. A list of figures is easier to read as a chart, and a request for several details is easier to complete as a form. FastMCP Apps let a tool return an interactive interface that the host application renders inside the conversation.

What an App Tool Is

An app tool is an ordinary tool with one difference: instead of returning a string or a value, it returns a user-interface component. The host displays that component in place, and the person can interact with it without leaving the chat. Typical examples include searchable tables, charts, forms and small dashboards.

Apps form the third pillar of FastMCP, alongside servers and clients. They build on everything you already know about tools: type hints still define the schema, and the docstring still tells the model when to call the tool.

Install the Apps Extra

App support depends on additional packages, published as an optional extra:

pip install "fastmcp[apps]"
# or
uv add "fastmcp[apps]"

The extra installs the Prefab component library that app tools use to describe interfaces.

Mark a Tool as an App

Set app=True on the tool decorator and return a Prefab component instead of plain text. The official documentation illustrates the pattern with a searchable staff directory:

# Excerpt: see the Apps quickstart for the imports and data setup
@mcp.tool(app=True)
def team_directory() -> DataTable:
    """Show the team directory as a searchable table."""
    return DataTable(columns=[...], rows=employees, search=True)

Here DataTable is a Prefab component, employees is your data and search=True adds a search box. Other components cover charts, forms and layouts; the Apps section of the documentation lists them all with their options.

Ways to Build an App

FastMCP offers several levels of control, so you can start simple and go further only when you need to:

ApproachWhat it gives you
Prefab components with app=TrueReady-made tables, charts and forms returned from a tool
Generative UI providerRegistered with mcp.add_provider(GenerativeUI()); the model writes Prefab code for the current data and request
Interaction providersOne-line additions for approvals, choice pickers, file upload and forms
FastMCPAppInterfaces that call back to your server
Custom HTML, CSS and JavaScriptFull control over every detail

Preview Without a Host

You do not need a full AI application to see how an app looks. The CLI includes a browser preview, added in FastMCP 3.2:

fastmcp dev apps my_server.py

By default the MCP server listens on port 8000 and the preview on port 8080; change them with --mcp-port and --dev-port. Auto-reload and a log panel are switched on, so you can adjust layout and data and see the result immediately.

Pin the Component Library

The documentation describes Prefab as under active development, with frequent breaking changes. FastMCP sets a minimum prefab-ui version but no upper limit, so pin prefab-ui to a specific version in your own dependencies before you deploy.
uv add "prefab-ui==<version you tested>"

When an App Is the Right Choice

  • Comparisons and trends – charts communicate shape faster than lists of numbers.
  • Structured input – a form gathers several fields in one step instead of a long exchange of messages.
  • Large results – a table with sorting and searching keeps the conversation readable.
  • Confirmation – an approval step makes the person’s decision explicit before an action runs.

For short answers, plain text remains the better option; an interface adds weight that a one-line reply does not need.

Design Tips

  • Keep each app focused on one task.
  • Label axes, columns and fields clearly; the person may not have seen the underlying data.
  • Return only the data the interface needs, which keeps responses quick.
  • Check how the app behaves with empty, very small and unusually large data before you ship it.
  • Write the docstring for the model as carefully as for any other tool, so it knows when an interface is helpful.

Testing App Tools

App tools are still tools, so the in-memory client and pytest work as usual for checking that they are registered and accept the expected arguments. Use the browser preview for the visual side: layout, labels and behaviour with real data.

Summary

Apps extend tools from returning answers to returning experiences. Install the extra, add app=True, return a component, pin the component library and preview the result locally before connecting it to a host.

Frequently Asked Questions

Support depends on the host application. Check your host's documentation, and keep each app tool's docstring clear so the model knows what the tool returns.

No. Prefab components such as tables, charts and forms cover most needs. Custom HTML, CSS and JavaScript remain available when you need complete control.

The documentation describes Prefab as under active development with frequent breaking changes. FastMCP sets only a minimum version, so pinning protects deployed servers from unexpected updates.

Yes. App tools are still tools, so the in-memory client can confirm they are registered and accept the expected arguments. Use the browser preview to check the visual result.

Keep reading

Related Guides