> ## Documentation Index
> Fetch the complete documentation index at: https://nuntly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Nuntly from Gemini CLI

> Connect the Nuntly MCP server to Gemini CLI for your user or your project, pass the API key past its redaction, and send a test email from your agent.

The Nuntly MCP server (`@nuntly/sdk-mcp`) gives Gemini CLI tools to send email, manage domains and webhooks, and read and reply to inbound messages. Check the [prerequisites](https://nuntly.com/docs/guides/ai-agents.md#prerequisites) first: an API key and Node.js 20 or later.

## Create an API key

In the dashboard, go to **API Keys** and create a key with the **Sending only** permission, and leave **Restrict to domains** empty. Copy it. Pick **Full access** instead for an agent that manages domains, inboxes, webhooks or agent memory. See [API keys](https://nuntly.com/docs/guides/api-keys.md).

## Add the MCP server

Run this in a terminal. Paste your key when the cursor waits, and press Enter:

```bash bash or zsh theme={null}
printf 'Nuntly API key: ' && read -rs K && \
  gemini mcp add -s user nuntly npx -e NUNTLY_API_KEY="$K" \
  -- -y @nuntly/sdk-mcp@2; unset K
```

The key never shows on screen and never lands in your shell history. `-s user` stores the server in `~/.gemini/settings.json`, outside your repository. Without it, `gemini mcp add` writes to the project's `.gemini/settings.json`, which you may commit with the key in it.

Gemini CLI connects a local MCP server only in a folder you trust. Start `gemini` in your project and trust the folder when it asks, then check the connection:

```bash theme={null}
gemini mcp list
```

The `nuntly` line reads `Connected`. In a Gemini CLI session, `/mcp` lists the tools the server exposes.

## Share the server with your team

Commit a `.gemini/settings.json` file at the project root. It reads the key from the environment Gemini CLI starts in, so each person sets their own `NUNTLY_API_KEY`:

```json .gemini/settings.json theme={null}
{
  "mcpServers": {
    "nuntly": {
      "command": "npx",
      "args": ["-y", "@nuntly/sdk-mcp@2"],
      "env": {
        "NUNTLY_API_KEY": "$NUNTLY_API_KEY"
      }
    }
  }
}
```

Keep the `env` block: Gemini CLI removes every variable whose name contains `KEY` from the environment it passes to an MCP server, unless the server's `env` names it.

## Send a test email

Ask your agent: "Send a test email from [hello@onboarding.nuntly.com](mailto:hello@onboarding.nuntly.com) to my address." Use the email address of your Nuntly account (the organization owner), exactly as you signed up. This sender only delivers to that address.

## Troubleshooting

**`gemini mcp list` shows `nuntly` as `Disabled`.** The current folder is not trusted, so Gemini CLI does not start local MCP servers there. Start `gemini` in the folder and trust it.

**`gemini mcp list` shows `nuntly` as `Disconnected`.** The server started without a key. With the project file, `NUNTLY_API_KEY` is unset in your shell, or the `env` block is missing and Gemini CLI removed the variable. Run `npx -y @nuntly/sdk-mcp@2` in a terminal to see the server's own error.

For errors shared by every client, such as a tool that returns `isError: true`, see [Troubleshooting](https://nuntly.com/docs/guides/ai-agents-troubleshooting.md).

## Next steps

> [card] [AI agent inboxes](https://nuntly.com/docs/guides/receiving-agents.md)
>
> Give the agent its own inbox and a memory per thread

> [card] [What an agent can do](https://nuntly.com/docs/guides/ai-agents.md#what-an-agent-can-do-and-what-stays-with-you)
>
> See which operations stay with you


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.