Files
conversation-history/SquareMCP/2026-06-08-browser-ai-connection-ux.md
T

5.0 KiB

Browser AI Connection UX — Deployment & Fixes

Date: 2026-06-08 Project: SquareMCP / hermes-mcp Status: Deployed


Objective

Keep the existing Connect MCP Client workflow and add a separate browser-oriented connection path for ChatGPT and Claude. The distinction matters because desktop/CLI clients use SquareMCP's token/config flow, while browser AI products must complete connector setup and OAuth inside the provider's own interface.


What Changed

UI (product/app/)

The dashboard welcome area now presents two clearly labeled actions:

  • Desktop and CLI - Connect MCP Client: preserves the existing /oauth/connect-mcp popup and token/config workflow.
  • Browser - Connect ChatGPT or Claude: opens a provider picker inside the existing dashboard modal.

The browser provider picker includes:

  • Separate ChatGPT and Claude choices
  • The SquareMCP MCP URL: https://hermes.squaremcp.com/mcp
  • Automatic copying of the MCP URL when a provider is selected
  • Opening the selected provider's connector settings in a new tab
  • Provider-specific next-step guidance
  • Feedback when clipboard access or pop-ups are blocked
  • Escape-key and backdrop dismissal
  • Accessible dialog labeling and focus styling
  • Responsive button and modal layouts for desktop and mobile

Backend (src/index.ts)

  • ChatGPT connector discovery fix: GET /mcp without an mcp-session-id now returns the ChatGPT OpenAPI spec instead of 400 error. Handles ?only_resources=true with an empty resources list.
  • Added authenticated email REST endpoints:
    • GET /api/email/profile
    • GET /api/email/search
    • GET /api/email/read
    • POST /api/email/send
  • Removed split OpenAPI specs (/openapi-messaging.json, /openapi-media.json) per product decision.

Commits

Commit Message Author
6663e63 add browser ai connection ux Codex
2f717ea feat: ChatGPT connector discovery + email REST endpoints Kimi

Deployment

Problem 1: Browser caching

The nginx config caches .js and .css for 1 year:

location ~* \.(js|css|...)$ {
    expires 1y;
    add_header Cache-Control "public, immutable";
}

After the first deploy, users still saw the old app.js from browser cache. The button existed in the DOM but had no event listener.

Fix: Added cache-busting query parameters (?v=2, later bumped to ?v=3) to index.html asset references.

Problem 2: Mobile experience

Three issues on mobile:

  1. navigator.clipboard.writeText() often fails on mobile Safari/Chrome after window.open() steals focus
  2. window.open() is aggressively blocked by mobile popup blockers
  3. ChatGPT/Claude connectors are desktop-first — the settings URLs may not work in mobile browsers

Fixes:

  • Reordered flow: copy first (while still in user-gesture context), then window.open()
  • Added robust clipboard fallback (document.execCommand('copy') via hidden textarea) for mobile Safari
  • Added mobile detection (/iPhone|iPad|iPod|Android/i + touch + small viewport)
  • On mobile, shows a note: "Connector setup works best on desktop. On mobile, copy the URL below and paste it into your AI app later."
  • Added a "Copy URL" button under the server URL for manual fallback
  • Improved status messages that distinguish between copied+opened, copied+blocked, and manual-copy-needed

Deployed images

Service Image SHA
hermes-mcp sha256:9b4219dfd77ce90273f4d280f901f35eb1b688d6dd0428c360cc30abdc25fe02
squaremcp-app sha256:9803b14ccbe007a0c05dc2045b4fea671236a2b51e1e59ac839f431f0c4ce9d2

Both rolled out successfully in fetcherpay namespace. Health checks pass.


Provider Destinations

  • ChatGPT: https://chatgpt.com/#settings/Connectors
  • Claude: https://claude.ai/settings/connectors

These links open provider settings but cannot silently configure the provider. ChatGPT and Claude retain control of connector creation and OAuth authorization.


Files Changed

  • product/app/index.html — Two-button layout, modal a11y, cache-busting params
  • product/app/app.js — Provider picker, clipboard logic, mobile detection, copy fallback
  • product/app/styles.css — Secondary button, provider picker, mobile note, copy button, responsive styles
  • src/index.ts — ChatGPT discovery fix, email REST endpoints, removed split specs
  • hermes-k8s.yaml — Image SHA updates
  • product/app/app-k8s.yaml — Image SHA updates

Verification

  • node --check product/app/app.js
  • npm run build
  • Docker builds + pushes succeeded
  • K8s rollouts succeeded
  • Health checks: hermes.squaremcp.com/health → OK, app.squaremcp.com → serving
  • Desktop: button opens modal, provider selection copies URL + opens settings
  • Mobile: shows mobile note + Copy URL button, clipboard fallback works

Follow-Up

  • Verify ChatGPT and Claude settings URLs still land on connector configuration screens (provider routes can change)
  • Consider adding a QR code in the modal for even easier mobile-to-desktop URL transfer