Skip to content

billmetangmo/chatgpt-artgallery-app

Repository files navigation

Art Gallery ChatGPT App (MCP Backend)

Backend MCP (Model Context Protocol) for a ChatGPT App, deployed on Cloudflare Workers. It handles image uploads from ChatGPT file params, stores files in Vercel Blob, and writes metadata to Supabase.

What This Project Is

  • A ChatGPT App integration using MCP tools.
  • The main tool is upload_artwork, called by ChatGPT.
  • Input image comes from ChatGPT file parameters (openai/fileParams) as { download_url, file_id }.
  • The Worker fetches the file from download_url, uploads to Blob, then inserts records in Supabase.

Problem This App Solves

When visiting exhibitions, I often see paintings, objects, or sculptures I want to preserve in my gallery.

Before this app, the workflow was slow and manual:

  1. Take photos during the visit.
  2. Later at home, review each photo.
  3. Search for a better image.
  4. Research metadata on the web.
  5. Manually add everything to the gallery.

This app removes that delayed, repetitive process.

With the ChatGPT App workflow:

  1. Upload the photo directly in ChatGPT while on site.
  2. Ask ChatGPT to find artwork information online.
  3. Let the tool write the artwork to the gallery with image and metadata.

Result: capture and enrichment happen in one flow, without the later manual reprocessing step.

Features

  • MCP tool upload_artwork
  • File param flow compatible with ChatGPT Apps (openai/fileParams)
  • MIME validation (png, jpeg, gif, webp)
  • Max size validation (10 MB)
  • Blob upload + Supabase insert
  • OAuth Access flow support (/authorize, /callback, /token, /register)
  • Fallback no-auth mode on /mcp when OAuth bindings are not configured

Stack

  • Cloudflare Workers + Wrangler
  • agents/mcp + @modelcontextprotocol/sdk
  • @cloudflare/workers-oauth-provider
  • @vercel/blob
  • @supabase/supabase-js

Prerequisites

  • Node.js 20+ (24 recommended)
  • Cloudflare account with Wrangler authenticated
  • Supabase project with an artworks table
  • Vercel Blob token (BLOB_READ_WRITE_TOKEN)

Installation

npm install

Local Configuration

  1. Copy the example file.
cp .dev.vars.example .dev.vars
  1. Fill in values in .dev.vars.

Required variables:

  • BLOB_READ_WRITE_TOKEN
  • SUPABASE_URL
  • SUPABASE_SERVICE_ROLE_KEY

OAuth variables (optional, required only when enabling OAuth):

  • ACCESS_CLIENT_ID
  • ACCESS_CLIENT_SECRET
  • ACCESS_TOKEN_URL
  • ACCESS_AUTHORIZATION_URL
  • ACCESS_JWKS_URL
  • ACCESS_CALLBACK_URL (optional)
  • ACCESS_ISSUER (optional)

Run Locally

npm run dev

Useful endpoints:

  • GET / (text status)
  • POST /mcp (MCP transport)
  • GET /authorize and GET /callback (when OAuth is enabled)

ChatGPT App Flow

  1. ChatGPT sends tool call for upload_artwork.
  2. image is provided as file param metadata (download_url, file_id).
  3. Worker downloads the image from download_url.
  4. Worker uploads image to Vercel Blob.
  5. Worker inserts metadata into Supabase artworks.
  6. Worker returns id, imageUrl, and confirmation fields.

Deployment

npm run deploy

Deployment uses wrangler.jsonc configuration (KV namespace + Secrets Store OAuth bindings).

MCP Tool Contract: upload_artwork

Expected input:

  • image: object with download_url and file_id
  • title: string (required)
  • artist: string (required)
  • year: string (optional)
  • category: en-cours or enregistre (optional, default en-cours)
  • description: string (optional)

Output:

  • id (artwork UUID)
  • imageUrl (public Blob URL)
  • confirmation fields (title, artist, category)

About

Capture artworks in real time with ChatGPT: snap a photo, enrich metadata from the web, and save directly to your gallery.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors