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 -- without writing integration code or managing API keys in multiple places.
Why MCP instead of custom integrations?
Before MCP, giving an AI agent email access meant building custom tool definitions, managing OAuth tokens, handling refresh flows, and writing provider-specific code for Gmail vs Outlook vs IMAP. Each assistant (Claude, Cursor, Copilot) needed its own integration.
MCP standardizes this into a single protocol. The Nylas CLI acts as an MCP server that:
- 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-cli/tap/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 --all3. 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 status
# Example output:
# Claude Desktop: ✓ configured
# Claude Code: ✓ configured (permissions set)
# Cursor: ✓ configured
# Windsurf: not installed
# VS Code: not configuredTroubleshooting
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 list
# 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
- 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
- Model Context Protocol spec -- the protocol standard