Building ChatGPT Apps with Supabase Edge Functions and mcp-use
ChatGPT apps built on OpenAI's Apps SDK consist of an MCP server backend and an iframe-rendered web component, and mcp-use lets that MCP server run on Supabase Edge Functions by using Hono instead of the Express-based official SDK. The walkthrough builds a database explorer exposing list-tables, show-table, execute-SQL and Supabase-status tools, each returning React widgets. It distinguishes display-only widgets, which are auto-registered as tools and fetch data client-side, from data-returning widgets, where the server sends separate props to the UI and output to the LLM. It closes with deployment via an mcp-use script and connecting the endpoint in ChatGPT developer mode.
Related posts
- Supabase MCP Server
Supabase mediumAdeptSupabase ships an official MCP server with 20+ tools that let AI clients like Cursor and Claude create projects, manage tables via migrations, run SQL, create database branches, fetch config and logs, and generate TypeScript types. Setup is a JSON config running the npx package with a personal access token. MCP standardizes tool implementations so clients can use any compliant server, and it also defines resources and prompts, which most clients don't yet support. The roadmap covers deploying Edge Functions, OAuth-based authorization from the 2025-03-26 spec, more token-efficient schema discovery than querying information_schema, and confirmation before destructive operations.
- Give your Supabase app its own MCP server
Supabase mediumAdeptSupabase apps can expose their own MCP server so customers use the app from ChatGPT, Claude or other MCP clients, signed in with their existing account. An installable MCP Server block generates an Edge Function with an MCP handler, OAuth middleware and per-file tools. Supabase Auth acts as the OAuth 2.1 server, and `withSupabase({ auth: 'user' })` gives each tool a user-scoped client, so Postgres RLS policies govern what an agent can reach without a service role key. Setup requires asymmetric signing keys, dynamic client registration, a consent page and `verify_jwt = false` on the function; MCP Apps can render reused React components inside the chat.
- Building ChatGPT Plugins with Supabase Edge Runtime
Supabase mediumAdeptA TypeScript template for ChatGPT Plugins runs on Supabase Edge Runtime (Deno). The required ai-plugin.json manifest is served by importing JSON into the main function handler, since Edge Runtime can't serve static files. The OpenAPI definition is generated from JSDoc annotations on Deno oak routes using swagger-jsdoc. The guide also covers adding ChatGPT-specific CORS headers via oak middleware, running locally with Docker and docker-compose bind mounts, installing the localhost plugin in the ChatGPT UI, and deploying to Fly.io.
- Mozilla Llamafile in Supabase Edge Functions
Supabase mediumAdeptSupabase Edge Functions can now use Mozilla Llamafile, alongside Ollama, as the inference server via an OpenAI-API-compatible mode. Setup takes one of two paths. You can set AI_INFERENCE_API_HOST and call Supabase.ai.Session with mode 'openaicompatible'. Or you can point the OpenAI Deno SDK at the Llamafile server through OPENAI_BASE_URL and stream responses back as server-sent events. With the SDK, the model parameter is ignored because the model is whichever Llamafile is running. The walkthrough covers local serving with the Supabase CLI, deploying a containerized Llamafile to a host like Fly.io, and setting secrets to deploy the functions.
- AI Inference now available in Supabase Edge Functions
Supabase mediumAdeptSupabase Edge Functions gain a built-in Supabase.ai.Session API for running AI inference in a few lines of code, starting with gte-small embeddings for storage in pgvector and experimental, invite-only Llama and Mistral LLMs with streaming responses. Embeddings run on a native Edge Runtime extension that calls ONNX Runtime through the Rust Ort wrapper, replacing the slow WASM boot of Transformers.js. A typical embedding request finishes in under 1s even from a cold start and uses 100-200ms of CPU, and Supabase claims this is about 10x cheaper than OpenAI's embedding API with comparable MTEB scores. LLM requests are routed to GPU-accelerated Ollama servers, and database webhooks can trigger embedding generation automatically when rows are inserted.