Migrate Lantern MCP mailbox to Pocket ID OAuth #52

Merged
cameron merged 2 commits from hermes/infrastructure:feat/lantern-pocketid-oauth into main 2026-10-12 14:47:37 -04:00
Contributor

Summary

Migrates the planning mailbox from fixed bearer/tunnel credentials to Pocket ID OAuth resource-server authentication, for ChatGPT custom MCP plugin creation.

  • Resource/audience: https://lantern.vanhouzen.me
  • Issuer: https://id.vanhouzen.me
  • MCP URL: https://lantern.vanhouzen.me/mcp
  • Public protected-resource metadata and 401 Bearer discovery challenges.
  • Validate RS256 RFC9068 at+jwt tokens: signature, issuer, audience, required claims, dates, and both planning:read/planning:write permissions. ID tokens are rejected.
  • Pinned asynchronous HTTPS JWKS fetching with deadlines, response/key bounds, cache and failure handling.
  • Strict Host/Origin/duplicate-header checks; loopback listener; exactly the two planning-message tools.
  • Remove the old tunnel package/service and unused Lantern token declarations. Preserve Forgejo, Discord and dashboard authentication.
  • Install the Lantern service and Caddy virtual host on the Hermes host, with automatic startup on deployment/boot while KEEPING writes paused.

Verified

  • 29 Python mailbox/OAuth/HTTP/MCP tests pass, including a real local HTTP JWKS server and RSA test-token MCP round trip.
  • Five Nix configuration tests pass.
  • Latest enabled-host derivation evaluates; packaged source CLI runs with the locked Hermes runtime.
  • Generated Caddy configuration adapts and validates; validation copy redirected log/storage locations to private scratch because the agent cannot write /var/log/caddy.
  • Whitespace and added-line credential/security scans pass.
  • Independent security/logic review: no blockers.

Operator next steps

  1. Review/merge, build and deploy from the trusted checkout.
  2. Ensure DNS/TLS points to the Hermes host; deployment/boot automatically starts lantern-planning-bridge.service. Verify its status.
  3. Verify public metadata returns 200 and unauthenticated /mcp returns 401 with resource_metadata challenge.
  4. In Pocket ID, configure planning:read and planning:write permissions for the created API resource and grant user-delegated access ONLY to the intended ChatGPT client/users.
  5. Create the ChatGPT plugin with the Server URL and OAuth; use its exact displayed redirect URI. Client ID/secret go into ChatGPT privately, NOT this resource server.

Important boundaries

This is a SINGLE shared planning mailbox, not tenant-isolated storage. Every authorized token with the issuer/audience and both scopes accesses it. Restrict Pocket ID grants accordingly. Cache policy may delay acceptance of rotated keys for up to five minutes; apply concurrency/edge rate limits before expanding beyond the small private pilot.

No deployment, service activation, real Pocket ID sign-in, refresh cycle or ChatGPT plugin creation was performed. Public Lantern TLS was failing in the pre-deployment check. Live systemd/TLS/login verification remains necessary. Writes remain paused. The live-session adapter and automatic relay/archive ingestion are separate unfinished work; this PR does not make Lumen and A communicate directly.

## Summary Migrates the planning mailbox from fixed bearer/tunnel credentials to Pocket ID OAuth resource-server authentication, for ChatGPT custom MCP plugin creation. - Resource/audience: https://lantern.vanhouzen.me - Issuer: https://id.vanhouzen.me - MCP URL: https://lantern.vanhouzen.me/mcp - Public protected-resource metadata and 401 Bearer discovery challenges. - Validate RS256 RFC9068 at+jwt tokens: signature, issuer, audience, required claims, dates, and both planning:read/planning:write permissions. ID tokens are rejected. - Pinned asynchronous HTTPS JWKS fetching with deadlines, response/key bounds, cache and failure handling. - Strict Host/Origin/duplicate-header checks; loopback listener; exactly the two planning-message tools. - Remove the old tunnel package/service and unused Lantern token declarations. Preserve Forgejo, Discord and dashboard authentication. - Install the Lantern service and Caddy virtual host on the Hermes host, with automatic startup on deployment/boot while KEEPING writes paused. ## Verified - 29 Python mailbox/OAuth/HTTP/MCP tests pass, including a real local HTTP JWKS server and RSA test-token MCP round trip. - Five Nix configuration tests pass. - Latest enabled-host derivation evaluates; packaged source CLI runs with the locked Hermes runtime. - Generated Caddy configuration adapts and validates; validation copy redirected log/storage locations to private scratch because the agent cannot write /var/log/caddy. - Whitespace and added-line credential/security scans pass. - Independent security/logic review: no blockers. ## Operator next steps 1. Review/merge, build and deploy from the trusted checkout. 2. Ensure DNS/TLS points to the Hermes host; deployment/boot automatically starts lantern-planning-bridge.service. Verify its status. 3. Verify public metadata returns 200 and unauthenticated /mcp returns 401 with resource_metadata challenge. 4. In Pocket ID, configure planning:read and planning:write permissions for the created API resource and grant user-delegated access ONLY to the intended ChatGPT client/users. 5. Create the ChatGPT plugin with the Server URL and OAuth; use its exact displayed redirect URI. Client ID/secret go into ChatGPT privately, NOT this resource server. ## Important boundaries This is a SINGLE shared planning mailbox, not tenant-isolated storage. Every authorized token with the issuer/audience and both scopes accesses it. Restrict Pocket ID grants accordingly. Cache policy may delay acceptance of rotated keys for up to five minutes; apply concurrency/edge rate limits before expanding beyond the small private pilot. No deployment, service activation, real Pocket ID sign-in, refresh cycle or ChatGPT plugin creation was performed. Public Lantern TLS was failing in the pre-deployment check. Live systemd/TLS/login verification remains necessary. Writes remain paused. The live-session adapter and automatic relay/archive ingestion are separate unfinished work; this PR does not make Lumen and A communicate directly.
cameron deleted branch feat/lantern-pocketid-oauth 2026-10-12 14:47:37 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cameron/infrastructure!52
No description provided.