Understanding Model Context Protocol Apps
An MCP (Model Context Protocol) App is an application that communicates with AI hosts (such as Claude Desktop, ChatGPT, and VS Code Copilot) through a standardised protocol. MCP defines how AI models discover and use tools (actions), resources (data and UI), and prompts (templates). A standard MCP server exposes tools that return text. An MCP App extends this capability by serving interactive UI widgets as resources. When the AI invokes a tool, the host renders a rich widget (HTML/React) inline within the chat, enabling experiences such as payment forms, booking interfaces, and dashboards.How Model Context Protocol Apps work

Key concepts
The core MCP concepts are defined in the following table:| Concept | Description |
|---|---|
| MCP server | A service that exposes tools and resources over the MCP protocol (stdio or HTTP transport). |
| Tool | A function that the AI model can invoke. It takes structured input and returns structured output. |
| Resource | A piece of data or UI (HTML widget) that the host can render. Resources use URIs such as ui://widget/booking.html. |
| Widget | An HTML/React application served as a resource. It renders interactively inside the AI chat interface. |
| Transport | The method by which the AI host communicates with the MCP server: stdio (local) or StreamableHTTP (remote/hosted). |
- MCP Specification - The official Model Context Protocol documentation.
- MCP Apps Extension - The MCP Apps extension specification for UI widgets and interactive resources.
- MCP TypeScript SDK - The official TypeScript SDK for building MCP servers and clients.
- MCP ext-apps package - Helpers for registering app resources and tools with UI metadata.
Create your own Model Context Protocol App
To build an MCP App that renders UI widgets in AI chats, complete the following steps:
Cashfree HERE handles all of this for the payment widget. You only need to register it on your server.
Cashfree payment plugin
The@cashfreepayments/cashfree-here npm package provides pre-built payment tools and a React payment widget. You register them on your MCP server, and the AI host renders the payment UI when the tool is invoked.
Supported payment methods
The plugin supports the following payment methods:| Method | Description |
|---|---|
| UPI Intent | Launches GPay, PhonePe, Paytm, or BHIM directly on mobile. |
| UPI QR Code | Displays a scannable QR code for UPI payment. |
| Cards | Allows payment with credit or debit cards, including saved cards for one-tap checkout (PCI-DSS compliant). |
| ReservePay | Coming soon. |
| Cashfree Pay | Coming soon. |
Security
The payment widget implements the following security measures:- Card details are handled entirely client-side within the widget.
- No sensitive payment data is sent to the AI model.
- Cashfree handles card processing (PCI-DSS compliant).
- Three-D Secure (3D Secure) is supported for card payments.
- Cards are stored and managed by using Cashfree’s instrument vault.
Prerequisites
Before you begin, ensure that you have the following prerequisites:- Node.js version 18 or later.
- A Cashfree Merchant Account.
- API credentials from the Merchant Dashboard (App ID and Secret Key). For more information, see generate API keys.
Installation
Install the package by using one of the following package managers:Usage
The plugin exports three functions that you register on your MCP server. The following table describes each export:| Export | Purpose |
|---|---|
registerCashfreeWidget | Registers the payment widget as an MCP resource. |
cashfreeUpiTool | Registers the UPI payment tool (intent and QR code). |
cashfreeCardPaymentTool | Registers the card payment tool. |
- MCP Apps (ext-apps helpers)
- Standard MCP SDK
Use
registerAppResource and registerAppTool from @modelcontextprotocol/ext-apps/server for automatic MCP Apps metadata handling.Configuration
The configuration interface for the Cashfree tools is defined as follows:| Parameter | Required | Description |
|---|---|---|
environment | Yes | Specify "sandbox" for testing or "production" for live payments. |
clientId | For cards | Your Cashfree App ID. Required only for cashfreeCardPaymentTool. |
clientSecret | For cards | Your Cashfree Secret Key. Required only for cashfreeCardPaymentTool. |
Tool input schemas
The following sections define the input schemas for each tool: UpiToolEnvironment variables
Configure the following environment variables:Example: Good Food restaurant booking app
The Good Food app demonstrates a complete real-world integration: a restaurant table booking system with Cashfree HERE payments, running as an MCP App inside AI interfaces such as ChatGPT and Claude.What it does
The app follows this workflow:- The user asks to find restaurants in Mumbai.
- The AI host invokes
search_restaurants. The widget displays restaurant listings with images, ratings, and prices. - The user selects a restaurant and books a table.
- The widget creates a Cashfree order and receives a
paymentSessionId. - The AI host invokes
UpiToolorCardPaymentToolwith the session ID. The payment widget renders inline. - The user completes payment by using UPI or a card.
- The booking is confirmed.
How it integrates payment tools
The server registers Cashfree HERE alongside its own app-specific tools:Payment flow
The widget creates a Cashfree order by making a direct API call to the server, which returns apaymentSessionId. This session ID is then passed to the Cashfree HERE payment tools. The following example shows how to create a Cashfree order:
Architecture

Building a custom payment host
If you are building your own AI-powered product (such as your own chat interface, assistant, or custom platform), you aren’t limited to ChatGPT or Claude. You can build a custom host that connects to your MCP server and renders the Cashfree HERE payment widget directly in your interface. To support Cashfree HERE (and MCP Apps in general) in your own host, your platform must complete the following tasks:Connect to the MCP server
Connect to the MCP server by using HTTP and
StreamableHTTPServerTransport. Discover its tools and resources.Detect UI resources
Detect UI resources. When a tool result references a resource with
mimeType: "text/html;profile=mcp-app", treat it as a widget.Render the widget in a sandboxed iframe
Render the widget in a sandboxed iframe. Pass tool arguments and results into the iframe by using
postMessage, following the MCP Apps messaging protocol.Reference host implementation
The MCP Apps team provides abasic-host reference implementation in the official ext-apps repository. It’s a minimal working example of an MCP Apps host. It connects to any MCP server, calls tools, and renders widget UIs in sandboxed iframes. Use it as a starting point for your own platform.
Using @mcp-ui/client
If your platform is React-based, the @mcp-ui/client package provides ready-made React components for rendering MCP Apps views. It handles the iframe sandboxing, postMessage protocol, and tool result delivery. You don’t have to implement the host protocol from scratch.
To install the package, run the following command:
MCP Apps widgets run in a sandboxed iframe. They can’t access your parent page, cookies, or DOM. This security model makes it safe to embed third-party MCP App widgets, including Cashfree HERE, in your own product.
Resources
Npm Package
Install the Cashfree HERE plugin from npm.
MCP Apps Extension
Official MCP Apps extension spec for UI widgets and interactive resources.
ext-apps Reference Host
Basic-host reference implementation and examples for building MCP Apps hosts.
@mcp-ui/client
React components for rendering MCP Apps widgets in your own host application.