NEWn1n v2.0.1 is live! Enterprise Unified LLM API Gateway with 500+ AI Models, up to 90% off, Try now

How to Give Claude or Cursor an Email Inbox Using MCP and ReceiveHQ

Authors
  • avatar
    Name
    Nino
    Occupation
    Senior Tech Editor

The evolution of Large Language Models (LLMs) has transitioned from simple chat interfaces to sophisticated agents capable of interacting with the real world. However, one persistent barrier for AI agents like Claude and Cursor has been the lack of a native, standardized way to receive and process real-time external communications, specifically email. While outbound email is easily handled via standard APIs, inbound email requires a complex infrastructure of MX records, DNS management, and real-time listeners. This tutorial explores how to bridge this gap using the Model Context Protocol (MCP) and ReceiveHQ.

The Role of Model Context Protocol (MCP)

The Model Context Protocol (MCP) is an open standard that allows developers to provide LLMs with a set of tools and data sources in a secure, structured way. By using MCP, you are not just giving an agent access to a file; you are giving it a functional interface to an external service. When combined with a high-performance LLM aggregator like n1n.ai, which provides access to industry-leading models like Claude 3.5 Sonnet and OpenAI o3, the possibilities for agentic workflows expand exponentially.

Introducing ReceiveHQ

ReceiveHQ is a specialized service designed to give coding agents a real inbound mailbox. It allows you to use a domain you control, point its MX records to mx.receivehq.com, and use MCP tools to manage the lifecycle of that mailbox.

Key Features:

  • Real Inbound Mail: Not a simulation; these are real emails delivered to your domain.
  • MCP Native: Built specifically for the Model Context Protocol.
  • Security: Uses OAuth 2.1 with PKCE and Dynamic Client Registration (DCR).
  • Flexibility: Supports "blackhole" storage (agent reads only) or webhooks (forwarding to your apps).

Step-by-Step Implementation Guide

1. Configuring the MCP Server in Cursor or Claude

To begin, you need to register the ReceiveHQ MCP server in your environment. For Cursor users, this is handled via the mcp.json configuration file. For Claude Desktop users, the process is similar within the application settings.

Add the following configuration:

{
  "mcpServers": {
    "receivehq": {
      "url": "https://receivehq.com/api/mcp"
    }
  }
}

Once added, restart your editor or agent. The client will automatically discover the OAuth requirements, initiate a Dynamic Client Registration, and prompt you to log in via a magic link. This secure handshake ensures that your agent only has the permissions you explicitly grant.

2. Understanding the Toolset

ReceiveHQ provides a robust set of tools that your agent can call. These are divided into two scopes: mcp:read (for listing and reading mail) and mcp:admin (for managing domains and endpoints).

Tool NamePurposeKey Arguments
list_tenantsIdentify accessible accountsNone
create_tenantCreate a new organizational unitname
setup_inbound_domainThe "Wizard" for domain setuptenantId, endpointKind
verify_inbound_domain_mxConfirm DNS propagationtenantId, domainId
list_messagesFetch inbound mail headerstenantId, limit
get_messageRetrieve full email contenttenantId, messageId

3. Setting Up Your Domain

Ask your agent (Claude or Cursor) to start the process. A typical prompt might be: "List my tenants and then set up a new inbound domain for my project."

The agent will likely use setup_inbound_domain. If you only want the agent to read the mail within the session, choose the blackhole endpointKind. This stores the message securely without forwarding it elsewhere.

Crucial DNS Step: You must manually add the MX record at your DNS provider (e.g., Cloudflare, Route53):

  • Type: MX
  • Value: mx.receivehq.com (Priority 10)

Once added, tell the agent: "Verify the MX records for my new domain." It will call verify_inbound_domain_mx to confirm everything is live.

Advanced Workflows with n1n.ai

Integrating ReceiveHQ with n1n.ai allows you to build highly autonomous systems. For instance, you can use n1n.ai to route complex email processing tasks to specialized models. While Claude 3.5 Sonnet might be great for general reasoning, you might use a different model for high-volume data extraction or sentiment analysis.

Pro Tip: Webhook Integration If you want your agent's email to trigger external actions, use the webhook endpointKind. This allows ReceiveHQ to POST the incoming email to an HTTPS URL of your choice. You can specify the payloadFormat using IDs like postmark (JSON) or mailgun_sendgrid (multipart).

// Example of updating an endpoint to use a webhook
// Tool: update_endpoint
{
  "tenantId": "your-tenant-id",
  "endpointId": "your-endpoint-id",
  "endpointKind": "webhook",
  "url": "https://api.yourdomain.com/inbound-mail",
  "payloadFormat": "postmark"
}

Security and Retention

Handling email involves sensitive data. ReceiveHQ adheres to a 14-day retention window for raw mail and delivery logs. Authentication is strictly managed via OAuth 2.1 with PKCE, meaning your credentials are never exposed to the agent directly. You can revoke access at any time under the Settings → MCP section of the ReceiveHQ console.

Use Cases for Developers

  1. Automated QA Testing: Create temporary mailboxes to test user registration flows and verify "Welcome" emails automatically during the build process.
  2. Support Ticket Triage: Have an agent monitor an inbox and automatically categorize or summarize incoming requests.
  3. Agentic Research: Allow your agent to sign up for newsletters or technical updates and synthesize the information for your project.

Pricing

ReceiveHQ offers a trial with the first 10 emails free and up to 3 trial tenants. For production use, the paid plan starts at €10/month, covering 100,000 inbound emails—a cost-effective solution for high-volume agentic workflows.

By empowering your AI tools with real-world communication capabilities, you move beyond code generation into true workflow automation. Start building more capable agents today by connecting your tools to the broader ecosystem.

Get a free API key at n1n.ai