Source: https://cli.nylas.com/guides/install-openclaw-nylas-plugin

Guide

# Install the OpenClaw Nylas Plugin

Install @nylas/openclaw-nylas-plugin to give OpenClaw native email, calendar, and contact tools with typed schemas, API-key auth, grant discovery, and no exec approvals.

Written by [Qasim Muhammad](https://cli.nylas.com/authors/qasim-muhammad) • Staff SRE

Reviewed by [Hazik](https://cli.nylas.com/authors/hazik)

Updated April 13, 2026

Verified

 —

CLI

3.1.1

 ·

Gmail, Outlook

 ·

last tested

April 11, 2026

## What is the OpenClaw Nylas Plugin?

The `@nylas/openclaw-nylas-plugin` package is an npm-based plugin for [OpenClaw](https://open-claw.org/) that provides native tool schemas for email, calendar, and contacts. Instead of using OpenClaw's `exec` tool to run shell commands (as covered in the [CLI exec guide](https://cli.nylas.com/guides/nylas-openclaw-personal-assistant)), the plugin registers typed tools directly with the agent.

This means the agent calls tools like `nylas_list_emails` and `nylas_send_email` with structured parameters and gets JSON responses back — no command construction, no output parsing, and no `exec-approvals.json`.

Key advantages over the exec approach:

- **Typed tool schemas** — the agent sees parameter names, types, and descriptions, reducing errors
- **Auto-discovery** — the plugin finds all grants associated with your API key automatically
- **Multi-account** — work with multiple email accounts using named grants
- **No shell security config** — no exec-approvals.json, no PATH setup, no allowlists
- **Works with OpenClaw, Moltbot, and Clawdbot**

## Prerequisites

- **OpenClaw** installed and running. See the [existing guide](https://cli.nylas.com/guides/nylas-openclaw-personal-assistant#what-is-openclaw) for setup instructions.
- **Nylas dashboard account** — sign up at [dashboard-v3.nylas.com](https://dashboard-v3.nylas.com/) if you don't have one.
- **Nylas API key** — create one in the dashboard under **Settings → API Keys**.
- **At least one grant** — connect an email account (Gmail, Outlook, Exchange, Yahoo, iCloud, or IMAP) in the dashboard under **Grants**.

## 1. Install the plugin

OpenClaw has a built-in plugin manager. Install the package directly:

```bash
openclaw plugins install @nylas/openclaw-nylas-plugin
```

This downloads the package from npm and registers it with OpenClaw in under 30 seconds. After installation, restart the gateway so the new plugin is loaded.

Verify the installation:

```bash
openclaw plugins list
openclaw gateway restart
```

You should see `@nylas/openclaw-nylas-plugin` in the output.

Newer OpenClaw versions sandbox plugins by default. Trust the plugin and expose its tools to agent sessions before configuring credentials:

```bash
# Trust the plugin and expose its tools to agent sessions
openclaw config set 'plugins.allow' '["nylas"]'
openclaw config set 'tools.alsoAllow' '["nylas"]'
```

Skip this on older OpenClaw releases that allow all installed plugins by default — the config keys are no-ops if the runtime does not enforce them.

## 2. Configure your API key

The plugin needs your Nylas API key to authenticate. Set it via OpenClaw's config:

```bash
openclaw config set 'plugins.entries.nylas.config.apiKey' 'YOUR_NYLAS_API_KEY'
openclaw gateway restart
```

Alternatively, set the `NYLAS_API_KEY` environment variable in your shell profile or OpenClaw's environment config.

If you want named multi-account aliases instead of relying on auto-discovery, configure them explicitly:

```bash
openclaw config set 'plugins.entries.nylas.config.grants' '{"work":"grant-id-1","personal":"grant-id-2"}'
openclaw gateway restart
```

## 3. Verify it works

Verify the plugin is loaded and can see your connected accounts:

```bash
# Check the plugin is loaded
openclaw plugins list

# Verify grant discovery through the plugin
openclaw run "List my connected email accounts" --plugin nylas
```

The plugin auto-discovers grants linked to your API key at startup. If you add grants later, restart the gateway before verifying again.

## 4. What tools does the plugin provide?

Once installed, the plugin registers 16 native tools across four domains — email, calendar, contacts, and grant discovery:

### Email tools

| Tool | Description |
| --- | --- |
| `nylas_list_emails` | List recent messages with optional filters |
| `nylas_get_email` | Read a specific message by ID |
| `nylas_send_email` | Send an email |
| `nylas_create_draft` | Create a draft message |
| `nylas_list_threads` | List email threads |
| `nylas_list_folders` | List mailbox folders/labels |

### Calendar tools

| Tool | Description |
| --- | --- |
| `nylas_list_calendars` | List all calendars |
| `nylas_list_events` | List calendar events |
| `nylas_get_event` | Get a specific calendar event |
| `nylas_create_event` | Create a calendar event |
| `nylas_update_event` | Update an existing event |
| `nylas_delete_event` | Delete a calendar event |
| `nylas_check_availability` | Check free/busy availability |

### Contacts tools

| Tool | Description |
| --- | --- |
| `nylas_list_contacts` | List contacts with optional search filters |
| `nylas_get_contact` | Get a specific contact by ID |

### Discovery tools

| Tool | Description |
| --- | --- |
| `nylas_discover_grants` | Auto-discover grants connected to the configured API key |

## 5. Example conversations

Once the plugin is installed and configured, here are realistic prompts and the tool calls the agent makes under the hood:

### Email examples

- **"What are my unread emails?"** — the agent calls `nylas_list_emails` with `{unread: true, limit: 20}`, then summarizes senders, subjects, and snippets.
- **"Find emails from Sarah about the Q4 budget"** — the agent calls `nylas_list_emails` with `{query: "from:sarah Q4 budget"}`, reads the matching threads, and pulls out the key points.
- **"Draft a reply to the latest email from Dave saying I'll review it by Friday"** — the agent calls `nylas_list_emails` to find Dave's email, then `nylas_create_draft` with the reply content. It shows you the draft before sending.
- **"Send Alice the meeting notes from yesterday"** — the agent calls `nylas_list_contacts` with a search query to resolve Alice's email address, composes the message, confirms with you, then calls `nylas_send_email`.

### Calendar examples

- **"What's on my calendar this week?"** — the agent calls `nylas_list_events` with start and end timestamps for the current week, then summarizes each day's schedule.
- **"Schedule a 30-minute meeting with bob@company.com on Tuesday at 2pm"** — the agent calls `nylas_create_event` with the title, participants, start time, and duration. It confirms the event details before creating it.
- **"Am I free Thursday afternoon?"** — the agent calls `nylas_check_availability` for Thursday 12:00–18:00 and tells you which slots are open.
- **"Move my 3pm meeting to 4pm"** — the agent calls `nylas_list_events` to find the 3pm event, then `nylas_update_event` to shift the start and end times by one hour.

### Contacts examples

- **"What's Sarah Chen's email address?"** — the agent calls `nylas_list_contacts` with `{query: "Sarah Chen"}` and returns the matching contact details.
- **"Look up everyone from Acme Corp in my contacts"** — the agent calls `nylas_list_contacts` with `{query: "Acme Corp"}` and lists all matching names and email addresses.

### Combined workflow examples

- **"Find a time to meet with alice@company.com this week and send her an invite"** — the agent calls `nylas_check_availability` to check both calendars, picks the first open slot, calls `nylas_create_event` with Alice as a participant, and confirms the invite was sent.
- **"Check if I have any emails from the attendees of tomorrow's standup"** — the agent calls `nylas_list_events` to find tomorrow's standup and its participants, then calls `nylas_list_emails` with targeted queries for each attendee to surface recent threads.
- **"Email everyone in my 2pm meeting that I'll be 10 minutes late"** — the agent calls `nylas_list_events` to find the 2pm event, extracts the participant emails, composes a short message, confirms with you, then calls `nylas_send_email` for the outgoing message.

## 6. How do I use multiple email accounts?

If your API key has multiple grants (for example, a work Gmail and a personal Outlook account), the plugin supports named aliases. Configure the aliases in OpenClaw's config:

```bash
openclaw config set 'plugins.entries.nylas.config.grants' '{"work":"grant-id-1","personal":"grant-id-2"}'
openclaw gateway restart
```

With aliases configured, the plugin can target a specific account by name instead of a raw grant ID. If you do not configure aliases, the plugin auto-discovers grants from your Nylas application at startup.

The agent can then specify which account to use when calling tools. For example, "list my work emails" versus "send from my personal account."

## 7. Optional: Standalone usage

You can also use the plugin as a standalone npm package in your own TypeScript or JavaScript projects, outside of OpenClaw:

```bash
npm install @nylas/openclaw-nylas-plugin
```

```typescript
import { createNylasClient } from "@nylas/openclaw-nylas-plugin"

const { client, discovered } = await createNylasClient({
  apiKey: process.env.NYLAS_API_KEY!,
})

console.log(`Discovered ${discovered.length} grants`)

const emails = await client.listMessages({ limit: 5 })
console.log(emails)
```

This is useful if you're building a custom agent with the [agent tools guide](https://cli.nylas.com/guides/build-email-agent-cli) pattern and want typed Nylas tools without the CLI.

## 8. Which approach should I choose: plugin, CLI exec, or MCP?

There are three ways to give an OpenClaw agent Nylas access. Here's how they compare:

| Feature | Plugin (this guide) | CLI exec | MCP server |
| --- | --- | --- | --- |
| Setup complexity | One command | PATH + exec-approvals | Config + running process |
| Tool schemas | Typed (auto-registered) | Text in TOOLS.md | Typed (MCP protocol) |
| Auth method | API key | CLI OAuth | CLI OAuth |
| Multi-account | Named grants | Single grant | Single grant |
| Auto-discovery | Yes | No | No |
| Shell access needed | No | Yes | No |
| Requires running process | No | No | Yes |

**Recommendation:** Use the plugin for the simplest setup and best multi-account support. Use the CLI exec approach if you already have the Nylas CLI authenticated and prefer OAuth-based auth. Use MCP if you need the same tools available to other MCP-compatible clients (Claude Desktop, Cursor, VS Code).

## Troubleshooting

### "apiKey is required"

The plugin cannot find your API key. Make sure you set it with `openclaw config set 'plugins.entries.nylas.config.apiKey'` or via the `NYLAS_API_KEY` environment variable. Check that the value is not empty:

```bash
openclaw config get 'plugins.entries.nylas.config.apiKey'
```

### "No grants found"

Your API key has no connected email accounts. Go to [dashboard-v3.nylas.com](https://dashboard-v3.nylas.com/) → **Grants** and connect at least one email account. Then restart the gateway and verify the plugin again.

```bash
openclaw gateway restart
openclaw run "List my connected email accounts" --plugin nylas
```

### 401 Unauthorized

The API key is invalid or expired. Generate a new one in the Nylas dashboard under **Settings → API Keys** and update it:

```bash
openclaw config set 'plugins.entries.nylas.config.apiKey' 'NEW_API_KEY'
openclaw gateway restart
```

### 404 Not Found on grant operations

A named grant alias or raw grant ID is stale. Update `plugins.entries.nylas.config.grants` to point at valid grant IDs from your Nylas dashboard, then restart the gateway.

### Plugin not showing up

If `openclaw plugins list` does not show the plugin, try reinstalling:

```bash
openclaw plugins uninstall @nylas/openclaw-nylas-plugin
openclaw plugins install @nylas/openclaw-nylas-plugin
openclaw config set 'plugins.allow' '["nylas"]'
openclaw config set 'tools.alsoAllow' '["nylas"]'
openclaw gateway restart
```

If the plugin is listed but its tools never appear in agent sessions, the plugin is installed but not trusted. Run the two `openclaw config set` commands above and restart the gateway.

## Next steps

- [Nylas CLI with OpenClaw (exec approach)](https://cli.nylas.com/guides/nylas-openclaw-personal-assistant) — the alternative setup using shell commands and exec-approvals
- [Give AI Agents Email Access via MCP](https://cli.nylas.com/guides/ai-agent-email-mcp) — connect Claude, Cursor, or VS Code to your inbox
- [Build an Agent with Email Tools](https://cli.nylas.com/guides/build-email-agent-cli) — use Nylas tools in a custom LLM agent
- [Send email from the terminal](https://cli.nylas.com/guides/send-email-from-terminal) — use the Nylas CLI directly for scripting
- [Manage calendar from the terminal](https://cli.nylas.com/guides/manage-calendar-from-terminal) — timezone handling, DST, and AI scheduling
- [Organize Emails by Company](https://cli.nylas.com/guides/organize-emails-by-company) — auto-label and sort messages by sender domain for multi-account workflows
- [Export Email to HubSpot](https://cli.nylas.com/guides/export-email-to-hubspot) — sync email conversations to HubSpot contacts and deals
- [Secure Email Handling with the CLI](https://cli.nylas.com/guides/secure-email-handling-cli) — token storage, grant scoping, and safe automation patterns
- [List iCloud Emails](https://cli.nylas.com/guides/list-icloud-emails) — read and filter iCloud Mail from the command line
- [List IMAP Emails](https://cli.nylas.com/guides/list-imap-emails) — connect to any IMAP provider and list messages with the Nylas CLI
- [OpenClaw CLI Setup Guide](https://cli.nylas.com/guides/openclaw-cli-setup) — install OpenClaw via npm, add plugins, and configure WhatsApp
- [Fix OpenClaw CLI Errors](https://cli.nylas.com/guides/troubleshoot-openclaw-cli) — troubleshoot PATH, npm permissions, Node.js version, and Windows issues
- [Command reference](https://cli.nylas.com/docs/commands) — every flag, subcommand, and example
