Source: https://cli.nylas.com/guides/ai-agent-email-mcp

# Give AI Agents Email 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.

Written by [Aaron de Mello](https://cli.nylas.com/authors/aaron-de-mello) Senior Engineering Manager

Reviewed by [Caleb Geene](https://cli.nylas.com/authors/caleb-geene)

Updated May 2, 2026

> **TL;DR:** Run [`nylas mcp install`](https://cli.nylas.com/docs/commands/mcp-install) to give any MCP-compatible AI assistant ([Claude Desktop](https://claude.ai/download), [Cursor](https://cursor.com/), Windsurf, VS Code Copilot, Claude Code) direct access to your email and calendar. No API keys, no OAuth code, no per-assistant integration. One command, 16 tools, every provider.
>
> Pair this with the [Nylas Agent Skills](https://cli.nylas.com/guides/nylas-agent-skills) (`npx skills add nylas/skills`) so the agent also learns CLI and v3 API conventions, not just the live tool surface.

## Why MCP instead of custom integrations?

Before [Model Context Protocol (MCP)](https://modelcontextprotocol.io/), giving an AI agent email access meant building custom tool definitions, managing OAuth tokens ([Gmail access tokens expire every 3,600 seconds](https://developers.google.com/identity/protocols/oauth2#expiration)), 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

```bash
# Install the CLI
brew install nylas/nylas-cli/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:

```bash
# 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
```

Example output after running [`nylas mcp install --assistant claude-code`](https://cli.nylas.com/docs/commands/mcp-install):

```text
✓ 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:

```json
// 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_messages` with search

## 6. Regional endpoints

The proxy automatically routes to the correct region based on your configuration:

```yaml
# ~/.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

```bash
# Check MCP status across all assistants
nylas mcp status
```

Expected output:

```text
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 available
```

## Troubleshooting

### Permission denied errors (Claude Code)

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

### MCP server not responding

```bash
# 1. Check you are authenticated
nylas auth list
```

Expected output:

```text
  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
```

```bash
# 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

```bash
# Authenticate first
nylas auth login

# Then restart your AI assistant
```

---

## How it works under the hood

```text
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.)
```

> **Update (February 18, 2026)**: Corrected the Homebrew install command to `brew install nylas/nylas-cli/nylas`.

## Next steps

- [Getting started with Nylas CLI](https://cli.nylas.com/guides/getting-started) -- install, setup wizard, and first-run walkthrough
- [Give your AI coding agent an email address](https://cli.nylas.com/guides/give-ai-agent-email-address) -- setup for Claude Code, Cursor, Codex CLI, and OpenClaw
- [Send email from the terminal](https://cli.nylas.com/guides/send-email-from-terminal) -- use the CLI directly for scripting and automation
- [Manage calendar from the terminal](https://cli.nylas.com/guides/manage-calendar-from-terminal) -- DST detection, timezone locking, AI scheduling
- [Full command reference](https://cli.nylas.com/docs/commands) -- every flag, subcommand, and example
- [Nylas CLI vs Recall.ai](https://cli.nylas.com/guides/nylas-vs-recall-ai-agent-email) -- email/calendar vs meeting recordings for AI agents
- [manus-mcp-cli Setup](https://cli.nylas.com/guides/manus-mcp-cli-setup) -- configure MCP servers for Manus AI
- [Email APIs for AI agents compared](https://cli.nylas.com/guides/email-apis-for-ai-agents-compared) -- Gmail API vs Graph vs SendGrid vs IMAP vs Nylas CLI
- [Model Context Protocol spec](https://modelcontextprotocol.io/) -- the protocol standard
