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 whoami

2. 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 --all

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

ToolWhat it does
list_messagesSearch and retrieve emails
list_threadsList email threads
create_draftCreate a new draft
update_draftUpdate an existing draft
send_messageSend a new email (requires confirmation)
send_draftSend a draft (requires confirmation)

Calendar tools

ToolWhat it does
list_calendarsList all calendars
list_eventsList calendar events
create_eventCreate a new event
update_eventUpdate an existing event
availabilityCheck availability across participants

Utility tools

ToolWhat it does
get_grantGet grant info (works without email param)
current_timeGet current time with timezone
epoch_to_datetimeConvert Unix timestamp to datetime
datetime_to_epochConvert 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_messages with 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.com

7. 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 configured

Troubleshooting

Permission denied errors (Claude Code)

# Re-run install to fix permissions automatically
nylas mcp install --assistant claude-code

MCP 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 nylas

No authenticated grants found

# Authenticate first
nylas auth login

# Then restart your AI assistant

How 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