MCP Apps & Interactive UI

MCP Apps let you build interactive micro-applications that run directly inside DarcyIQ. Create dashboards, forms, data visualizations, and fully interactive experiencesβ€”all powered by your MCP integration.

circle-check

What are MCP Apps?

MCP Apps extend the standard MCP tool pattern by returning interactive user interfaces instead of (or alongside) text responses. When your tool returns a UI resource, DarcyIQ renders it as a fully interactive web application within a secure sandbox.

Feature
Standard MCP Tool
MCP App

Output

Text/JSON data

Interactive HTML/JavaScript UI

User Interaction

None (read-only)

Buttons, forms, charts, navigation

Visual Richness

Plain text or markdown

Full HTML/CSS styling

Callbacks

N/A

UI can trigger other tools

State

Stateless

Can maintain state and update dynamically

Use Cases for MCP Apps

MCP Apps are ideal for scenarios where visual interaction enhances the user experience:

Use Case
Example
Why MCP App?

Dashboards

Sales metrics, system status

Real-time data visualization with charts

Data Browsers

Customer lists, product catalogs

Sortable tables, filters, pagination

Configuration Panels

Settings, preferences

Forms with validation and save buttons

Wizards

Multi-step workflows

Guided step-by-step interfaces

Reports

Financial summaries, analytics

Formatted tables, charts, export options

Interactive Forms

Data entry, surveys

Input validation, dropdowns, date pickers

Approval Workflows

Review and approve items

Action buttons, status indicators

How MCP Apps Work

Architecture Overview

spinner

The UI Resource Format

MCP Apps return a special UIResource object that tells DarcyIQ to render interactive content:

Field
Required
Description

uri

Yes

Unique identifier for the UI resource

name

Yes

Display name shown in the UI header

mimeType

Yes

Must be text/html for interactive UIs

content

Yes

Your HTML, CSS, and JavaScript code

description

No

Brief description of the UI

Building Your First MCP App

Step 1: Create the MCP Server

Start with a standard MCP server and add a tool that returns a UI resource:

Step 2: Add Callback Tools

Create additional tools that the UI can invoke:

Step 3: Deploy and Test

  1. Deploy your MCP server using MCP Studio

  2. Open DarcyIQ Chat

  3. Ask the AI to "show me the sales dashboard"

  4. Interact with the dashboardβ€”buttons will call back to your tools!

MCP-UI Callbacks

The most powerful feature of MCP Apps is the ability to call back to your MCP server from the UI.

How Callbacks Work

  1. User clicks a button or triggers an action in your UI

  2. Your JavaScript sends a postMessage to the parent window

  3. DarcyIQ intercepts the message and validates it

  4. The tool is invoked on your MCP server

  5. The result is sent back to your iframe

  6. Your UI updates based on the result

Callback Message Format

Receiving Callback Results

Your UI can listen for results:

Dynamic UI Updates

When a callback tool returns a new ui resource, DarcyIQ automatically replaces the current UI:

Best Practices

Security

Practice
Why

Sanitize inputs

Prevent XSS attacks in your HTML

Validate callback params

Don't trust data from the UI blindly

Use HTTPS resources

External assets must be HTTPS

Avoid sensitive data in HTML

UI content may be cached

circle-exclamation

Performance

Practice
Description

Inline CSS/JS

Avoid external dependencies when possible

Minimize HTML size

Large UIs take longer to render

Lazy load data

Fetch data via callbacks, not initial load

Cache static content

Reuse UI components across calls

User Experience

Practice
Description

Loading states

Show spinners during callback operations

Error handling

Display friendly error messages

Responsive design

UIs should work at different sizes

Fullscreen support

Design for both inline and fullscreen modes

Example: Loading State

Example MCP Apps

Interactive Data Table

Form with Validation

Displaying MCP Apps

MCP Apps can be displayed in multiple contexts within DarcyIQ:

Context
Description
Size

Chat Inline

Embedded directly in the chat conversation

Compact, expandable

Artifact Panel

Full artifact view alongside chat

Large, side panel

Fullscreen

Maximized view (click expand button)

Full browser window

Fullscreen Mode

Users can click the expand button to view your MCP App in fullscreen mode. Design your UI to take advantage of the extra space:

Limitations

Limitation
Details

No localStorage

Sandbox prevents persistent storage

No cookies

Third-party cookies blocked

Limited APIs

Some browser APIs restricted in sandbox

Same-origin callbacks only

Can only call tools on the same MCP server

No external fetch

Cannot make HTTP requests from iframe

circle-info

Working Around Limitations: Use tool callbacks to fetch external data. Your MCP server can make HTTP requests and return the data to your UI.

Next Steps

Goal
Documentation

Build custom MCPs

View more code samples

Deploy your app

Troubleshoot issues

Last updated

Was this helpful?