Files
conversation-history/SquareMCP/2026-06-12-claude-ai-chatgpt-connect-handoff.md

151 lines
5.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Claude.ai / ChatGPT Browser Connect Button — Handoff
**Date:** 2026-06-12
**Agent:** Kimi Code CLI
**Session focus:** Resolve "where is the chatgpt/claude.ai connect button" question and make the browser MCP connection flow work for Claude.ai MCP Directory review.
---
## What changed
The dashboard at `https://app.squaremcp.com` previously had one ambiguous button labeled **“Connect to Claude / ChatGPT”** that opened a generic OAuth popup. The resulting callback page only showed configs for **Claude Desktop** and **Codex CLI**, which confused reviewers looking for the browser-based Claude.ai / ChatGPT path.
### 1. New “Connect AI Client” picker modal
**Files:**
- `product/app/index.html`
- `product/app/app.js`
- `product/app/styles.css`
- `product/app/app-k8s.yaml`
The top-of-dashboard button is now labeled **“Connect AI Client”**. Clicking it opens a modal with four explicit options:
| Option | Action |
|--------|--------|
| **Claude.ai (web)** | Opens popup to `https://hermes.squaremcp.com/oauth/connect-claude-ai` |
| **Claude Desktop** | Opens generic `/oauth/connect-mcp` popup |
| **Codex CLI / OpenCode** | Opens generic `/oauth/connect-mcp` popup |
| **ChatGPT (web)** | Shows GPT Actions / OpenAPI spec instructions (`/openapi.json`) |
### 2. New backend route for Claude.ai browser OAuth
**File:** `src/index.ts`
Added `GET /oauth/connect-claude-ai` that redirects to the SquareMCP OAuth authorize endpoint using Anthropic’s official browser callback:
```
https://claude.ai/api/mcp/auth_callback
```
It now generates a random `state` value and preserves it through login + consent so Claude.ai can complete CSRF validation.
### 3. Updated MCP callback result page
**File:** `src/index.ts`
The `/oauth/mcp-callback` page now has sections for:
- Claude.ai web instructions
- Claude Desktop `claude_desktop_config.json`
- ChatGPT / GPT Actions instructions
- Codex CLI / OpenCode config
### 4. OAuth client redirect_uri registration
**File:** `src/index.ts`
Added `https://claude.ai/api/mcp/auth_callback` to the pre-registered OAuth client redirect URIs in `ensureOAuthAppRegistered(...)`. The function uses `ON DUPLICATE KEY UPDATE`, so the DB row is refreshed on the next server startup.
---
## Commits
```
2014e03 fix(oauth): include state in /oauth/connect-claude-ai flow
f084be6 fix(oauth): register Anthropic Claude.ai redirect_uri for browser MCP flow
6604ab5 feat(connect): dedicated Claude.ai / ChatGPT browser connect picker
```
---
## Deployment status
Both images were rebuilt, pushed to `localhost:32000`, and rolled out in the `fetcherpay` namespace:
- `localhost:32000/hermes-mcp@sha256:c12b7fcfa46eac5cbb5a2ccbb8e9ea8062f52494ddf2700cb5d0bcdd51744e4b`
- `localhost:32000/squaremcp-app@sha256:9c2601dd74bfca9f22350a38dc616eb8a76580090587803911bb2e5633ace361`
K8s manifests updated:
- `hermes-k8s.yaml`
- `product/app/app-k8s.yaml`
### Live verification
```bash
# App dashboard shows the new button
curl -s https://app.squaremcp.com | grep "Connect AI Client"
# Claude.ai connect route includes state and correct redirect_uri
curl -I https://hermes.squaremcp.com/oauth/connect-claude-ai
# → /oauth/authorize?...redirect_uri=https%3A%2F%2Fclaude.ai%2Fapi%2Fmcp%2Fauth_callback&state=...
# After unauthenticated redirect, state is preserved in return_to
curl -I -L https://hermes.squaremcp.com/oauth/connect-claude-ai | grep location
# → /login?return_to=...state%3D...
```
---
## Known issues / next steps
1. **Claude.ai MCP Directory submission** is the active consumer of this flow. The form checkboxes #5, #6, #16, #18 were previously blockers; #16/#18 are resolved. #5 should remain unchecked (third-party APIs). #6 may need a clarifying note that OAuth is AI→SquareMCP, not downstream platform OAuth.
2. **Facebook/Instagram long-lived token** was regenerated and deployed earlier today. Token debug shows `expires_at: 0` (no expiration). If it ever breaks, regenerate via Graph API Explorer and the app-secret exchange flow documented in `2026-06-12-facebook-token-handoff.md`.
3. **Reviewer test account** is set up and verified:
- Email: `reviewer@squaremcp.com`
- Password: `SquareMCPReview2026!`
- API key: `fdb6fb01bb7f4c50a9ab329c7287b81c`
- Account ID: `8e97af56-7b4a-4371-b816-32f6ed51ddcc`
4. **Pre-existing test failures** in `src/oauth.test.ts` (`getTokenCustomer` timing out) are unrelated to these changes. They were failing before this session started.
5. **ChatGPT browser** does not have native MCP support yet. The current implementation shows GPT Actions / OpenAPI spec instructions as a stopgap.
---
## Commands for the next agent
```bash
# Check current git state
git log --oneline -5
git status --short
# Rebuild + deploy hermes-mcp after any src/ change
npm run build
docker build -t localhost:32000/hermes-mcp:latest -f src/Dockerfile .
docker push localhost:32000/hermes-mcp:latest
# update hermes-k8s.yaml digest
microk8s kubectl apply -f hermes-k8s.yaml
microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay --timeout=120s
# Rebuild + deploy squaremcp-app after any product/app change
docker build -t localhost:32000/squaremcp-app:latest -f product/app/Dockerfile .
docker push localhost:32000/squaremcp-app:latest
# update product/app/app-k8s.yaml digest
microk8s kubectl apply -f product/app/app-k8s.yaml
microk8s kubectl rollout status deployment/squaremcp-app -n fetcherpay --timeout=120s
# Verify live
curl -s https://app.squaremcp.com | grep "Connect AI Client"
curl -I https://hermes.squaremcp.com/oauth/connect-claude-ai
```
---
## Related notes in this vault
- `2026-06-12-claude-mcp-directory-submission.md`
- `2026-06-12-facebook-token-handoff.md`
- `2026-06-12-reviewer-account-handoff.md`
- `2026-06-12-v1-launch-execution-summary.md`