Files
conversation-history/SquareMCP/2026-06-13-capability-enforcement-deploy.md
T

5.1 KiB

Capability Enforcement Deploy — 2026-06-13

Status: ✅ Deployed to production Image: localhost:32000/hermes-mcp@sha256:80f2fda24e8ad00ad3e9daec43db3a7e3f4552fdd21d6891c5b19f5b6e32731d Manifest: hermes-k8s.yaml Related: 2026-06-13-option-a-capability-enforcement-kimi-handoff


What was deployed

Server-enforced OAuth client capabilities for the new SquareMCP Living Brief GPT, without changing any existing Claude, ChatGPT, browser, CLI, app, MCP, API-key, session-cookie, schema URL, or OAuth connection.

Code changes (already implemented)

  • src/db.ts — nullable allowed_capabilities JSON column on oauth_clients
  • src/oauth.ts — OAuthCapability type, getTokenAuthorization, defensive capability parsing, DCR lockdown, capability-aware consent screen
  • src/index.ts — requireCapability middleware attached to all /api/{platform}/* route families; GET /openapi-living-brief.json
  • src/manifest.ts — getOpenApiSpecLivingBrief with Obsidian-only paths

Deployment-specific changes

  • hermes-k8s.yaml updated to image sha256:80f2fda24e8ad00ad3e9daec43db3a7e3f4552fdd21d6891c5b19f5b6e32731d
  • Added LIVING_BRIEF_OAUTH_CLIENT_ID / LIVING_BRIEF_OAUTH_CLIENT_SECRET env vars
  • Server startup registers the dedicated Living Brief client with allowed_capabilities = ["obsidian"]

Deployment steps executed

npm run build
docker build -t localhost:32000/hermes-mcp:capability-enforcement -f src/Dockerfile .
docker push localhost:32000/hermes-mcp:capability-enforcement
# update hermes-k8s.yaml image SHA + add LIVING_BRIEF_OAUTH_CLIENT_ID/SECRET
microk8s kubectl apply -f hermes-k8s.yaml
microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay --timeout=180s

Rollout completed successfully.


Verification

Health

curl https://hermes.squaremcp.com/health

→ status: ok, toolCount: 55, all endpoints listed.

Schema endpoint

curl https://hermes.squaremcp.com/openapi-living-brief.json
  • Title: SquareMCP Living Brief
  • Description: Obsidian vault only (no email claim)
  • Paths: /api/obsidian/search, /api/obsidian/note, /api/obsidian/note/append, /api/obsidian/sync
  • Operations: 5 (below 30)

Legacy schemas unchanged

  • GET /openapi.json → 200
  • GET /openapi-chatgpt.json → 200
  • GET /openapi-mail.json → 200
  • GET /openapi-social.json → 200

Capability enforcement — Living Brief token

OAuth flow completed with client_id = 0c4b4f66-36ef-4837-9e17-661bd0cfe3c8:

Endpoint Result
GET /api/obsidian/search?query=test ✅ 200, returns notes
GET /api/email/profile ✅ 403 {"error":"insufficient_capability","required_capability":"email"}
GET /api/instagram/profile ✅ 403 {"error":"insufficient_capability","required_capability":"instagram"}

Legacy unrestricted behavior preserved

DCR-registered test client with null allowed_capabilities:

Endpoint Result
GET /api/obsidian/search?query=test ✅ 200
GET /api/email/profile ✅ 200
GET /api/instagram/profile ✅ 200

Non-OAuth auth unchanged

Global API key (x-api-key) still succeeds on /api/email/profile.


Living Brief OAuth credentials

Use these when configuring the ChatGPT Custom GPT Action:

  • Client ID: 0c4b4f66-36ef-4837-9e17-661bd0cfe3c8
  • Client Secret: [REDACTED - rotated]
  • Schema URL: https://hermes.squaremcp.com/openapi-living-brief.json
  • Authorization URL: https://hermes.squaremcp.com/oauth/authorize
  • Token URL: https://hermes.squaremcp.com/oauth/token
  • Scope: mcp
  • Redirect URI: https://chat.openai.com/aip/<gpt-id>/oauth/callback (registered wildcard: https://chat.openai.com/aip/*/oauth/callback)

Notes / caveats

  • K8s kubectl exec / logs / port-forward are currently blocked by a kubelet TLS certificate mismatch (104.190.60.129 not in cert SANs). Verification was performed via public HTTPS endpoints only.
  • The DB migration was inferred successful because initDatabase() runs on startup and the deployment health check passes; direct column inspection was not possible due to the above.
  • A transient test DCR client and test customer (cap-test-2026-06-13@example.com) were created during live verification. They do not affect production behavior.
  • Rollback plan: set allowed_capabilities = NULL for the Living Brief client ID, or remove the LIVING_BRIEF_OAUTH_CLIENT_ID/SECRET env vars and redeploy.

OAuth Secret Rotation - 2026-06-13

  • Client: 0c4b4f66-36ef-4837-9e17-661bd0cfe3c8
  • Client Secret: [REDACTED - rotated]
  • Rotation reason: Secret appeared in ChatGPT conversation and deployment note; replaced as a precaution.
  • Old credential status: Rejected — token exchange returns {"error":"invalid_grant"}.
  • New credential status: Validated — completes Living Brief OAuth flow and enforces Obsidian-only capability policy.
  • Legacy impact: None. Legacy schemas, clients, tokens, API keys, and MCP transports remain unchanged.
  • Operator: kimi-cli
  • Full runbook: 2026-06-13-living-brief-oauth-secret-rotation-runbook