ChatGPT · Apps in ChatGPTCRM
Deals table
Widget that lists deals and their status inside ChatGPT.
by Prompt Studio
apps-sdkwidgetdeals
License: MITView original
Contents
Where it goes: server.ts
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';
const server = new McpServer({ name: 'deals-lista', version: '1.0.0' });
const html = `<div id="root"></div>
<style>
body { font-family: system-ui, sans-serif; margin: 0; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 6px 8px; border-bottom: 1px solid #e5e5e5; text-align: left; }
.card { border: 1px solid #e5e5e5; border-radius: 12px; padding: 12px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #eef; font-size: 12px; }
</style>
<script type="module">
const data = window.openai?.toolOutput ?? { items: [] };
const cols = ["title", "amount", "currency", "closeDate"];
document.getElementById('root').innerHTML =
'<table><tr>' + cols.map(c => '<th>' + c + '</th>').join('') + '<th>estado</th></tr>' +
data.items.map(i => '<tr>' + cols.map(c => '<td>' + (i[c] ?? '') + '</td>').join('') + '<td><span class="chip">' + i.status + '</span></td></tr>').join('') +
'</table>';
</script>`;
// Widget que ChatGPT muestra dentro de la conversación.
server.registerResource('widget', 'ui://widget/deals-list.html', {}, async () => ({
contents: [{ uri: 'ui://widget/deals-list.html', mimeType: 'text/html+skybridge', text: html }],
}));
server.registerTool(
'listar_deal',
{
title: 'Listar oportunidades',
description: 'Muestra oportunidades en una tabla, con filtro opcional por estado',
inputSchema: { status: z.enum(["abierta", "ganada", "perdida"]).optional() },
_meta: { 'openai/outputTemplate': 'ui://widget/deals-list.html' },
},
async ({ status }) => {
const res = await fetch(`https://api.tu-dominio.com/v1/deals${status ? `?status=${encodeURIComponent(status)}` : ''}`, { headers: { authorization: `Bearer ${process.env.API_TOKEN}` } });
const { items } = await res.json();
return { structuredContent: { items }, content: [{ type: 'text', text: `${items.length} oportunidades` }] };
},
);
// Expón el servidor por HTTP (Streamable HTTP) y agrégalo en ChatGPT → Configuración → Apps y conectores.
More in Apps in ChatGPT
Product carousel
MCP server with a tool that returns products and a carousel widget.
Appointment booking
Shows available slots and confirms the booking inside the chat.
KPI dashboard
Widget with KPI cards that reads data from window.openai.
Contacts table
Widget that lists contacts and their status inside ChatGPT.
Contact card
Card with the full details of one contact.
Contact form
In-chat form that creates a contact in your API.