Plugins Configuration
Relevant source files
The following files were used as context for generating this wiki page:
e-zer0 operates as a secure bridge between AI agents and email providers using the Model Context Protocol (MCP). Configuration requires three distinct layers: global infrastructure secrets, provider-specific OAuth credentials, and individual agent permissions.
The system utilizes Cloudflare Workers, D1 databases, and KV namespaces to store and manage these configurations securely. AI agents connect via a standardized MCP Server implementation that supports Streamable HTTP transport.
Infrastructure Secrets
Initial setup generates core cryptographic keys required for data protection and session management. These keys are stored as Cloudflare Secrets in production or within .dev.vars for local development.
- ENCRYPTION_KEY: A 64-character hexadecimal string used for AES-256-GCM encryption of email provider tokens at rest.
- JWT_SECRET: A secret key used to sign and verify short-lived JSON Web Tokens for agent authentication.
- TURNSTILE_SITE_KEY/SECRET: Credentials for Cloudflare Turnstile to protect the setup and login interfaces.
The diagram shows how the setup script provisions secrets to different environments for use by the application's cryptographic library.
Sources: scripts/setup-cf.js:23-96, AGENTS.md:46-55, src/routes/setup.tsx:14-20
Provider OAuth Configuration
To enable email and calendar access, you must configure OAuth applications in the Google Cloud Console and Azure Portal. These credentials allow e-zer0 to request delegated access to user mailboxes.
Configuration Fields
Administrators enter these values in the Settings dashboard. The system masks these values after saving for security.
| Provider | Required Credentials | Redirect URI |
|---|---|---|
| Client ID, Client Secret | /oauth/google/callback | |
| Microsoft | Application (Client) ID, Secret Value | /oauth/microsoft/callback |
Sources: src/routes/settings.tsx:44-55, src/routes/settings.tsx:189-204
Required Scopes
The following scopes must be enabled in the respective provider consoles for full functionality:
- Google:
gmail.readonly,gmail.modify,gmail.settings.basic,tasks,calendar.events.readonly. - Microsoft:
Mail.Read,Mail.ReadWrite,MailboxSettings.ReadWrite,Tasks.ReadWrite,Calendars.Read.
Sources: src/routes/settings.tsx:132-146, src/routes/settings.tsx:254-275
MCP Agent Configuration
AI agents (MCP clients) must register and receive explicit authorization before accessing email data. e-zer0 implements a dynamic registration and OAuth 2.0 flow for these plugins.
Discovery Endpoints
e-zer0 exposes metadata endpoints following RFC 8414 to allow automated configuration by MCP-compatible clients like ChatGPT.
| Endpoint | Purpose |
|---|---|
/.well-known/oauth-authorization-server | Lists issuer, auth, and token endpoints. |
/.well-known/oauth-protected-resource | Identifies the /mcp path as the protected resource. |
/register | Dynamic client registration for new agents. |
/authorize | Interactive user consent for agent permissions. |
Sources: src/app.ts:70-96, src/routes/mcp-auth.test.ts:365-385
Agent Permission Model
Permissions are granted per-agent and per-account. Users must explicitly select which mailboxes and whether calendar access is permitted during the authorization flow.
The sequence diagram illustrates the OAuth 2.0 flow used to register an agent and grant specific mailbox permissions.
Sources: src/routes/mcp-auth.test.ts:400-480, src/app.ts:71-75
MCP Server Toolset
The McpServer class in src/mcp/server.ts configures the available tools that agents can invoke. Every tool execution undergoes audit logging and content sanitization.
Core Tool Categories
- Email Management:
read_recent_emails,search_emails_semantic,manage_email(archive/delete),draft_email_reply. - Calendar:
list_calendars,get_calendar_events. - Tasks:
list_tasks,create_task,update_task. - Automation:
create_email_rule,preview_email_rule.
Security Constraints
- PII Redaction: The system redacts credit card numbers, passwords, and API keys before sending email content to agents.
- Prompt Injection Protection: The system scans email content for instruction overrides and flags high-risk content.
- Audit Logging: The
logAuditfunction records every tool call, including success/failure status and agent identity.
Sources: src/mcp/server.ts:133-250, AGENTS.md:58-69, src/mcp/server.ts:100-110
Conclusion
Plugins configuration in e-zer0 centers on a zero-trust architecture where agents are dynamically registered and granted granular access. By combining infrastructure-level secrets with provider-specific OAuth apps and per-agent mailbox permissions, the system ensures that AI agents operate within strictly defined boundaries while maintaining a full audit trail of all actions.