How to connect nicemails to VS Code

To give GitHub Copilot in VS Code an email inbox, create a nicemails API key and add nicemails to an mcp.json file as an HTTP server that sends the key in an Authorization header. VS Code asks for the key once and stores it securely; Copilot can then read, search and organize your mail and send mail you approve.

What do you need before you start?

This guide uses an API key. The VS Code configuration reference documents OAuth for remote servers through a client ID registered in advance. nicemails registers OAuth clients automatically and has no fixed client ID to give you, so the reliable route is the key, sent as a request header.

How do I create the API key?

  1. In nicemails, open Settings → API keys and select Create API key.
  2. Choose AI agent (MCP) as the key purpose.
  3. Pick the permissions and, if you like, limit the key to one mailbox.
  4. Copy the key. It is shown only once.

Create one key per machine or workspace. You can then revoke one without breaking the others.

How do I add nicemails to VS Code?

  1. Run MCP: Open User Configuration from the Command Palette to use nicemails in every workspace, or create .vscode/mcp.json in a workspace folder. Add an input for the key and the nicemails server:
    {
      "inputs": [
        {
          "type": "promptString",
          "id": "nicemails-key",
          "description": "nicemails API key",
          "password": true
        }
      ],
      "servers": {
        "nicemails": {
          "type": "http",
          "url": "https://nicemails.net/mcp",
          "headers": {
            "Authorization": "Bearer ${input:nicemails-key}"
          }
        }
      }
    }
  2. Save the file. The first time the server starts, VS Code asks for the nicemails API key. Paste the key; VS Code stores it securely for later sessions.
  3. Open Copilot Chat and ask “list my nicemails mailboxes”. Approve the tool request when it appears.
  4. To see the server and its controls later, run MCP: List Servers.

VS Code uses servers as the top-level key, not the mcpServers key other clients use. It tries Streamable HTTP first, which nicemails supports.

Do not type the key into the MCP: Add Server form, into chat or into a shared file; the VS Code docs warn against all three. With the inputs entry, the key never appears in mcp.json, so a workspace file is safe to share.

What can Copilot do with your mailboxes?

Copilot gets the nicemails tools the key’s permissions allow. There are 8:

For example: “Find the latest email from the payment provider’s sandbox in the billing-test mailbox and tell me which webhook it mentions,” or “Mark every message from the CI notifier in the builds mailbox as read.”

Who approves what Copilot does?

Troubleshooting

VS Code never asked for my key, or the server does not start.

Check the JSON: the top-level key must be servers, type must be http, and the input id in ${input:nicemails-key} must match the id in inputs. Run MCP: List Servers to see the server and its actions.

The server starts but every call is unauthorized.

The key is wrong, revoked or was pasted with extra spaces. Create a new key, then change the input id in both places, for example to nicemails-key-2, so VS Code asks for the new value.

Can I sign in with OAuth instead of using a key?

The VS Code configuration reference describes OAuth through a client ID you register in advance. nicemails issues client IDs only through automatic registration, so this guide does not describe an OAuth setup for VS Code. Use a key.

Related guides

Start for free