Skip to content

feat: add scoped per-mailbox agent access and remote MCP - #66

Open
thbechtold wants to merge 3 commits into
cloudflare:mainfrom
thbechtold:feat/scoped-agent-access
Open

thbechtold wants to merge 3 commits into
cloudflare:mainfrom
thbechtold:feat/scoped-agent-access

Conversation

@thbechtold

Copy link
Copy Markdown

Summary

Adds an opt-in, per-mailbox agent access layer for external automation clients. It provides scoped MCP and REST access without changing the existing dashboard or legacy MCP authorization model.

What changed

  • Add named Agent Access keys with hashed-at-rest credentials and revocation.
  • Scope each key to selected mailboxes and read, draft, and send permissions.
  • Support draft-only and direct-send modes, test recipients, recipient allowlists, and daily limits.
  • Add stateless Streamable HTTP MCP at /agent/mcp and JSON REST actions at /agent/api/<tool>.
  • Add on-demand generate_reply_draft using the existing mailbox prompt and AI safety checks.
  • Require an explicit footer choice for every content-writing operation and prevent duplicate footer insertion.
  • Add idempotent write operations and explicit handling for uncertain provider outcomes.
  • Add Settings UI, activity visibility, documentation, and focused tests.

Security and compatibility

  • Existing dashboard, /api/*, /mcp, and mailbox data remain unchanged.
  • No SQL migration, new bucket, or new Durable Object class is required.
  • Agent keys cannot administer mailboxes or fall through to legacy routes.
  • /agent/* is intended to be protected by a path-specific Cloudflare Access policy or Service Auth configuration.

Verification

  • npm run test:agent-access (25 tests passing)
  • npm run typecheck
  • npm run build
  • git diff --check

Existing email rows and storage are not rewritten or migrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant