57 lines
2.3 KiB
Markdown
57 lines
2.3 KiB
Markdown
# Handoff: API Keys Feature — 2026-06-17
|
|
|
|
## What was built
|
|
|
|
Added a working API Keys tab to the SquareMCP dashboard so customers can retrieve and copy their bearer token.
|
|
|
|
## Commit
|
|
|
|
`bf1e690` — feat(app): add API Keys tab so customers can retrieve their bearer token
|
|
|
|
## Changes
|
|
|
|
### Backend (src/billing/middleware.ts)
|
|
- Added `api_key: string` to Customer interface and CustomerRow interface
|
|
- Updated both resolveCustomerByApiKey and resolveCustomerById SELECT queries to include api_key and role
|
|
- Updated buildCustomer to pass api_key through
|
|
|
|
### Backend (src/index.ts)
|
|
- GET /api/auth/me now returns `api_key` alongside {id, email, plan, role} using req.customer.api_key
|
|
|
|
### Frontend (product/app/index.html)
|
|
- Added API Keys nav button (data-view="apikeys")
|
|
- Added #api-keys-section with code display and Copy button, styled using existing .webhook-card classes
|
|
|
|
### Frontend (product/app/app.js)
|
|
- Added api-keys-section to the view toggle in the nav click handler
|
|
- Added loadApiKeys() function: calls GET /api/auth/me, populates #api-key-display, wires Copy button with "Copied!" flash
|
|
- Updated ChatGPT picker copy from "Settings -> API Keys" to "the API Keys tab"
|
|
|
|
### Tests (src/tools.test.ts)
|
|
- Added api_key to mockCustomer fixture
|
|
|
|
## Deploy instructions for kimi-cli
|
|
|
|
Two deploys needed from branch main at commit bf1e690:
|
|
|
|
### 1. hermes-mcp (backend)
|
|
- Build: docker build -t localhost:32000/hermes-mcp:<sha> .
|
|
- Import: docker save localhost:32000/hermes-mcp:<sha> | microk8s ctr image import -
|
|
- Edit hermes-k8s.yaml image tag (do NOT commit)
|
|
- Apply: microk8s kubectl apply -f hermes-k8s.yaml
|
|
- Verify: microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay
|
|
|
|
### 2. squaremcp-app (frontend)
|
|
- Build: docker build -f product/app/Dockerfile -t localhost:32000/squaremcp-app:<sha> .
|
|
- Import: docker save localhost:32000/squaremcp-app:<sha> | microk8s ctr image import -
|
|
- Edit product/app/app-k8s.yaml image tag (do NOT commit)
|
|
- Apply: microk8s kubectl apply -f product/app/app-k8s.yaml
|
|
- Verify: microk8s kubectl rollout status deployment/squaremcp-app -n fetcherpay
|
|
|
|
## Verification after deploy
|
|
|
|
1. Log in at https://app.squaremcp.com
|
|
2. Click API Keys in the top nav
|
|
3. Your key appears in a code block with a Copy button
|
|
4. Test: curl -H "Authorization: Bearer <key>" https://hermes.squaremcp.com/api/auth/me
|