Guide
How to Give AI Agents Email & Calendar Access via MCP
The Model Context Protocol (MCP) lets AI assistants interact with external tools through a standardized interface. The Nylas CLI includes a built-in MCP proxy server that gives any MCP-compatible assistant access to your email and calendar across Gmail, Outlook, Exchange, Yahoo, iCloud, and IMAP -- without writing integration code or managing API keys in multiple places.
By Aaron de Mello
Why MCP instead of custom integrations?
Before Model Context Protocol (MCP), giving an AI agent email access meant building custom tool definitions, managing OAuth tokens (Gmail access tokens expire every 3,600 seconds), handling refresh flows, and writing provider-specific code for each of the 6 major email providers. Each assistant needed its own integration — a typical custom integration requires 200–400 lines of OAuth and API client code per provider.
MCP standardizes this into a single protocol. The Nylas CLI acts as an MCP server that exposes 16 tools to any compatible assistant:
- Injects your authenticated credentials automatically
- Detects your system timezone so all times display consistently
- Routes requests to the correct regional endpoint (US or EU)
- Handles grant lookups without requiring you to type your email
1. Install and authenticate
# Install the CLI
brew install nylas/nylas-cli/nylas
# Authenticate
nylas auth login
# Verify
nylas auth whoami2. Install MCP for your assistant
One command detects your installed assistants and writes the correct configuration file:
# Interactive -- detects installed assistants
nylas mcp install
# Or specify directly
nylas mcp install --assistant claude-desktop # Claude Desktop
nylas mcp install --assistant claude-code # Claude Code (also sets permissions)
nylas mcp install --assistant cursor # Cursor
nylas mcp install --assistant windsurf # Windsurf
nylas mcp install --assistant vscode # VS Code (project-level)
# Install for all detected assistants at once
nylas mcp install --allExample output after running nylas mcp install --assistant claude-code:
✓ MCP server configured for Claude Code
Binary: /opt/homebrew/bin/nylas
Command: mcp serve
Config: /home/dev/.claude.json
Restart Claude Code to activate.3. What gets configured
The CLI writes to each assistant's config file. Here is what it adds:
// Example: Claude Desktop config
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"nylas": {
"command": "/opt/homebrew/bin/nylas",
"args": ["mcp", "serve"]
}
}
}For Claude Code, it also adds mcp__nylas__* to ~/.claude/settings.json so all Nylas tools are pre-approved without interactive prompts.
4. Available MCP tools
Once installed, your AI assistant has access to these tools:
Email tools
| Tool | What it does |
|---|---|
list_messages | Search and retrieve emails |
list_threads | List email threads |
create_draft | Create a new draft |
update_draft | Update an existing draft |
send_message | Send a new email (requires confirmation) |
send_draft | Send a draft (requires confirmation) |
Calendar tools
| Tool | What it does |
|---|---|
list_calendars | List all calendars |
list_events | List calendar events |
create_event | Create a new event |
update_event | Update an existing event |
availability | Check availability across participants |
Utility tools
| Tool | What it does |
|---|---|
get_grant | Get grant info (works without email param) |
current_time | Get current time with timezone |
epoch_to_datetime | Convert Unix timestamp to datetime |
datetime_to_epoch | Convert datetime to Unix timestamp |
5. Example prompts for your AI assistant
Once MCP is installed, you can ask your assistant things like:
- "Summarize my unread emails from today" -- uses
list_messages - "Draft a reply to the email from Sarah about the budget" -- uses
list_messages+create_draft - "Schedule a 30-minute meeting with alice@company.com next Tuesday at 2pm" -- uses
create_event - "Check if I am free Thursday afternoon" -- uses
availability - "Find all emails about the Q4 contract and summarize the key decisions" -- uses
list_messageswith search
6. Regional endpoints
The proxy automatically routes to the correct region based on your configuration:
# ~/.config/nylas/config.yaml
region: us # default -- uses mcp.us.nylas.com
# region: eu # uses mcp.eu.nylas.com7. Automatic timezone detection
A common pain point with AI + calendar integrations is timezone inconsistency. The MCP proxy detects your system timezone at startup and injects it into the server instructions. This means:
- All email timestamps display in your local time
- Calendar events are created in your timezone by default
- No more mixing UTC, EST, and PST in the same conversation
If times are displaying incorrectly, restart your AI assistant after installing MCP. The timezone is detected at startup.
8. Verify the installation
# Check MCP status across all assistants
nylas mcp statusExpected output:
MCP Installation Status:
✓ Claude Code configured /home/dev/.claude.json
○ Claude Desktop not configured
○ Cursor not configured
○ VS Code not configured
- Windsurf application not installed
Legend:
✓ Nylas MCP configured
○ Available but not configured
- Not availableTroubleshooting
Permission denied errors (Claude Code)
# Re-run install to fix permissions automatically
nylas mcp install --assistant claude-codeMCP server not responding
# 1. Check you are authenticated
nylas auth listExpected output:
GRANT ID EMAIL PROVIDER STATUS DEFAULT
d3f4a5b6-c7d8-9e0f-a1b2-c3d4e5f6g7h8 dev@example.com Google ✓ valid ✓
e4f5a6b7-d8e9-0f1a-b2c3-d4e5f6a7b8c9 work@example.com Microsoft ✓ valid # 2. Test the server manually
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | nylas mcp serve
# 3. Verify the binary path
which nylasNo authenticated grants found
# Authenticate first
nylas auth login
# Then restart your AI assistantHow it works under the hood
AI Assistant (Claude / Cursor / VS Code)
|
| STDIO (JSON-RPC)
v
Nylas CLI MCP Proxy (nylas mcp serve)
- Reads region from config
- Injects credentials automatically
- Detects timezone
- Handles local get_grant
|
| HTTPS
v
Nylas MCP Server (mcp.us.nylas.com or mcp.eu.nylas.com)
|
| Nylas API v3
v
Email / Calendar Providers (Google, Microsoft, etc.)Next steps
- Getting started with Nylas CLI -- install, setup wizard, and first-run walkthrough
- Give your AI coding agent an email address -- setup for Claude Code, Cursor, Codex CLI, and OpenClaw
- Send email from the terminal -- use the CLI directly for scripting and automation
- Manage calendar from the terminal -- DST detection, timezone locking, AI scheduling
- Full command reference -- every flag, subcommand, and example
- Nylas CLI vs Recall.ai -- email/calendar vs meeting recordings for AI agents
- manus-mcp-cli Setup -- configure MCP servers for Manus AI
- Email APIs for AI agents compared -- Gmail API vs Graph vs SendGrid vs IMAP vs Nylas CLI
- Model Context Protocol spec -- the protocol standard