New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@mcp-web/app

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcp-web/app

Build tooling for MCP Apps - bundle React components into single HTML files for AI UI rendering

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
10
-65.52%
Maintainers
1
Weekly downloads
 
Created
Source

MCP Web App

Tooling for simplify creating MCP Apps from UI components. The packages bundles components into single HTML files that AI agents can render inline in chat interfaces like Claude Desktop.

[!IMPORTANT] We currently only support React. Support for more frameworks will be added in the future.

Overview

MCP Apps combine a tool (that AI can call) with a visual React component. When the AI calls the tool, the handler returns props which are passed to your component via the ext-apps protocol. A Vite plugin handles bundling each app into a self-contained HTML file.

Quick Start

Installation

npm install @mcp-web/app

1. Define an App

Create a file that exports your apps (e.g. src/mcp-apps.ts):

import { createApp } from '@mcp-web/app';
import { Statistics } from './components/Statistics';

export const statsApp = createApp({
  name: 'show_stats',
  description: 'Display statistics visualization',
  component: Statistics,
  handler: () => ({
    completionRate: 0.75,
    totalTasks: 100,
  }),
});

2. Add the Vite Build Config

Create a separate Vite config for building apps (e.g. vite.apps.config.ts):

import react from '@vitejs/plugin-react';
import { defineMCPAppsConfig } from '@mcp-web/app/vite';

export default defineMCPAppsConfig({
  plugins: [react()],
});

Build with:

vite build --config vite.apps.config.ts

This auto-discovers apps in src/mcp-apps.ts and outputs bundled HTML files to public/mcp-web-apps/.

3. Register with MCPWeb

In your web app, register the app so the AI agent can call it:

import { statsApp } from './mcp-apps';

mcp.addApp(statsApp);

Input Schemas

Apps can accept input from the AI agent using Zod schemas:

import { createApp } from '@mcp-web/app';
import { z } from 'zod';
import { Chart } from './components/Chart';

export const chartApp = createApp({
  name: 'show_chart',
  description: 'Display a chart with the given data',
  component: Chart,
  inputSchema: z.object({
    chartType: z.enum(['bar', 'line', 'pie']).describe('Type of chart'),
    title: z.string().describe('Chart title'),
  }),
  handler: ({ chartType, title }) => ({
    chartType,
    title,
    data: getChartData(),
  }),
});

Host Theming

MCP Apps automatically inherit the host's theme. Use these hooks to access it:

import { useMCPHostTheme, useMCPHostContext } from '@mcp-web/app';

function MyApp(props: MyProps) {
  const theme = useMCPHostTheme(); // "light" or "dark"
  const hostContext = useMCPHostContext(); // full context (theme, locale, display mode, etc.)

  return <div className={theme === 'dark' ? 'dark' : ''}>{/* ... */}</div>;
}

Receiving Props

Use the useMCPAppProps hook to receive props from the tool handler:

import { useMCPAppProps } from '@mcp-web/app';

function Statistics() {
  const props = useMCPAppProps<{ completionRate: number; totalTasks: number }>();

  if (!props) return <div>Loading...</div>;

  return (
    <div>
      <p>Completion: {Math.round(props.completionRate * 100)}%</p>
      <p>Total tasks: {props.totalTasks}</p>
    </div>
  );
}

Vite Plugin Options

defineMCPAppsConfig(
  { plugins: [react()] },
  {
    appsConfig: 'src/mcp-apps.ts',       // Path to apps config (auto-detected by default)
    outDir: 'public/mcp-web-apps',        // Output directory (default)
    silenceOverrideWarnings: false,        // Suppress build setting override warnings
  }
);

Exports

ExportDescription
createAppDefine an app with a handler and component
useMCPAppPropsReact hook to receive props from the tool handler
useMCPAppAccess the ext-apps App instance
useMCPHostThemeGet the current host theme ("light" or "dark")
useMCPHostContextGet the full host context
renderMCPAppManually render a component (auto-generated by Vite plugin)
MCPAppProviderContext provider (set up automatically by renderMCPApp)
defineMCPAppsConfigCreate a Vite config for building MCP Apps (via @mcp-web/app/vite)

Learn More

For full documentation, guides, and examples, visit mcp-web.dev.

FAQs

Package last updated on 18 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts