Skip to main content
Glama
MCP Apps Playground

MCP Apps Playground

by digitarald

MCP Apps Playground

A demo MCP server showcasing interactive UI capabilities using the MCP Apps Extension (SEP-1865).

Features

  • πŸ”§ MCP Tools - hello_world, list_sort, flame_graph, and feature_flags tools with Zod schema validation

  • πŸ“± Apps Extension - HTML UI via ui:// resources with text/html;profile=mcp-app

  • πŸ“¦ structuredContent - Data passed to UI via ui/notifications/tool-input

  • πŸ’¬ Bidirectional - UIs can send messages back to chat via ui/message

  • πŸš€ Dual Transport - stdio (default) and HTTP/SSE

Related MCP server: xmcp Demo Application

Tools

list_sort β€” Interactive List Reordering

Before: Agent receives list data from an MCP tool β†’ proposes a sorted order based on its analysis β†’ user reads text output and requests adjustments β†’ multiple back-and-forth messages to align with actual preferences.

With MCP Apps: Agent displays a drag-and-drop interface alongside its suggested order. User applies domain knowledge to reorder items visually, or clicks "Ask AI to Sort" for the agent's reasoningβ€”true collaboration where both contribute.

πŸ–±οΈ Drag-and-drop reordering Β· πŸ€– "Ask AI to Sort" Β· ↩️ Reset Β· πŸ’Ύ Save to chat


flame_graph β€” Performance Profiler Visualization

Before: Agent receives CPU profile data from an MCP tool β†’ analyzes the JSON and identifies bottlenecks β†’ user sees only the agent's text summary β†’ no way to validate hypotheses or apply domain-specific context.

With MCP Apps: Agent renders an interactive flame graph and can annotate suspected hot paths. User explores the visualization with their own domain knowledgeβ€”confirming or rejecting the agent's hypotheses, drilling into areas the agent might have overlooked.

πŸ” Click-to-zoom hierarchy Β· πŸ’¬ Hover tooltips Β· 🧭 Breadcrumb nav Β· πŸ“Š Send frame to chat


feature_flags β€” Feature Flag Selector

Before: Agent fetches flag configuration from an MCP tool β†’ summarizes which flags exist and their status β†’ user cross-references with deployment context β†’ asks agent to generate integration code separately.

With MCP Apps: Agent displays a searchable flag picker with live environment status. User selects flags based on their release priorities, switches between prod/staging/dev views, and generates SDK codeβ€”agent provides data, user drives decisions.

🌍 Environment tabs Β· πŸ”Ž Search & filter Β· β˜‘οΈ Multi-select Β· πŸ“ Generate SDK code

Quick Start

# Install dependencies
npm install

# Build
npm run build

# Run with stdio transport (for Claude Desktop, Cursor, VS Code)
npm run dev

# Or run with HTTP transport (for web-based clients)
npm run dev:http

# Test with MCP Inspector
npm run inspector        # stdio
npm run inspector:http   # HTTP (start server first)

Project Structure

src/
β”œβ”€β”€ index.ts           # Main server (stdio transport)
β”œβ”€β”€ http-server.ts     # HTTP transport variant
└── ui/
    β”œβ”€β”€ hello-world.ts # Greeting UI template
    β”œβ”€β”€ list-sort.ts   # Interactive list sorting UI
    β”œβ”€β”€ flame-graph.ts # Performance flame graph visualization
    └── feature-flags.ts # Feature flag selector UI

MCP Configuration

VS Code

Use the included .vscode/mcp.json:

{
  "servers": {
    "mcp-apps-playground": {
      "type": "stdio",
      "command": "node",
      "args": ["${workspaceFolder}/dist/index.js"]
    }
  }
}

Claude Desktop / Cursor

{
  "mcpServers": {
    "mcp-apps-playground": {
      "command": "node",
      "args": ["/path/to/mcp-apps-playground/dist/index.js"]
    }
  }
}

How It Works

1. UI Resource Declaration

UI resources are declared with ui:// scheme and text/html;profile=mcp-app MIME type:

server.resource(
  "greeting-ui",
  "ui://mcp-apps-playground/greeting",
  {
    description: "Interactive greeting UI panel",
    mimeType: "text/html;profile=mcp-app",
  },
  async (uri) => ({
    contents: [{
      uri: uri.href,
      mimeType: "text/html;profile=mcp-app",
      text: HELLO_WORLD_UI(),
    }],
  })
);

2. Tool with UI Annotation

Tools use _meta.ui.resourceUri to link to a UI resource. Data is passed via structuredContent:

server.registerTool(
  "hello_world",
  {
    description: "Display a Hello World greeting",
    inputSchema: {
      name: z.string().describe("Name to greet"),
    },
    _meta: {
      ui: {
        resourceUri: "ui://mcp-apps-playground/greeting",
        visibility: ["model", "app"],
      },
    },
  },
  async ({ name }) => ({
    content: [{ type: "text", text: `Hello, ${name}!` }],
    structuredContent: { name, greeting: `Hello, ${name}!` },
  })
);

3. UI Communication

UIs communicate with the MCP host via postMessage JSON-RPC:

// Initialize handshake (required)
const result = await sendRequest('ui/initialize', {
  protocolVersion: '2025-06-18',
  capabilities: {},
});
sendNotification('ui/notifications/initialized', {});

// Listen for tool data
window.addEventListener('message', (e) => {
  if (e.data.method === 'ui/notifications/tool-input') {
    const { arguments: args } = e.data.params;
    // Update UI with args
  }
});

// Send message to chat
await sendRequest('ui/message', {
  content: [{ type: 'text', text: 'User selected: ...' }]
});

Resources

License

MIT

Available Tools

5 tools
database_queryB

Query and filter sales database with interactive UI. Filter by date range, category, status, sales rep, and amount. Preview data in table format and export summaries.

Inputs: status, category, salesRep, dateRange, +1 more.

feature_flagsB

Browse and select feature flags to generate SDK code. Shows flag status per environment (prod/staging/dev), rollout percentages, and tags. Multi-select flags to generate useFeatureFlag() hooks.

Inputs: flags, filter, environment.

flame_graphA

Display an interactive flame graph visualization for performance profiling. Shows call hierarchy with execution time. Click frames to zoom, analyze hot paths.

Inputs: title, profile, filename.

hello_worldA

Display a Hello World greeting with optional interactive UI

Inputs: name (required), showUI.

list_sortB

Display an interactive list sorting UI. User can drag to reorder items, save the sorted order, or ask the AI to sort the list.

Inputs: items (required), title.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 5 tools

    Disambiguation4/5

    The five tools are quite distinct: a greeting, list sorting UI, flame graph, feature flag browsing, and database querying are clearly different purposes. The only minor ambiguity is that all are interactive UI renderers, but their specific functions are well-separated enough to avoid meaningful misselection.

    Naming Consistency3/5

    Names use snake_case throughout, which is consistent. However, the naming pattern is inconsistent: hello_world and list_sort are verb+noun-ish, flame_graph and feature_flags are noun-noun compound descriptors, and database_query is verb+noun. There's no consistent verb_noun convention, though all names are readable and descriptive.

    Tool Count4/5

    Five tools is a reasonable count for what appears to be a UI playground/demo server. Each tool represents a distinct interactive component, and the count feels appropriate for the apparent scope of demonstrating various MCP UI capabilities without being bloated.

    Completeness3/5

    Each tool is a self-contained interactive UI demo for a distinct feature area (greeting, list sorting, flame graphs, feature flags, database queries). There's no obvious missing sibling operation for any tool since they're standalone demonstrations rather than CRUD-style APIs, though the domain is unclear β€” these seem to be UI showcase modules with no coherent overarching workflow.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      A proof-of-concept demonstrating interactive UI capabilities for MCP servers through a task management example. Shows how MCP servers can deliver HTML/CSS/JS interfaces that render inside AI chat clients with bidirectional communication.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      A demonstration MCP server showcasing the xmcp framework's structured approach to defining tools, prompts, and resources with automatic discovery from their respective directories.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server with six tools including web search, URL fetching, math calculation, and note management. Designed for a live-coding demo integrating FastMCP with LangGraph ReAct agents.
      8
      -