MCP Server

Mailrith's official MCP server is the highest-level interface for agent runtimes. This page covers the remote endpoint plus copy-paste examples for OpenAI, Claude, n8n, and Pipedream.

5 min read

Official MCP server

Mailrith exposes an official remote MCP endpoint for agent runtimes that prefer tools over raw HTTP requests. This is the recommended integration surface for OpenAI, Claude, and other MCP-aware systems.

The remote endpoint is /mcp on the API origin, and it authenticates with the same workspace API keys used by the REST API.

  • Preferred transport: Streamable HTTP.
  • Authentication: Authorization: Bearer <workspace_api_key>.
  • Tool names are stable, snake_case wrappers around the public API operations such as subscribers_list, broadcasts_create, and webhook_subscriptions_create.

OpenAI Responses API

OpenAI's current MCP tool integration can connect directly to Mailrith's remote MCP server. This keeps your agent on the high-level tool surface instead of hand-building REST calls.

Use Mailrith as an MCP tool source in OpenAI
import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});

const response = await openai.responses.create({
  model: "gpt-5.1",
  input: "List the newest subscribers and draft a re-engagement broadcast.",
  tools: [
    {
      type: "mcp",
      server_label: "mailrith",
      server_url: "https://api.mailrith.com/mcp",
      headers: {
        Authorization: `Bearer ${process.env.MAILRITH_API_KEY}`,
      },
      allowed_tools: ["subscribers_list", "broadcasts_create"],
      require_approval: "never",
    },
  ],
});

Claude MCP connector

Claude can connect to Mailrith's remote MCP server directly through Anthropic's MCP connector. Mailrith only needs a public HTTPS MCP URL and a workspace API key.

Use Mailrith with Claude's MCP connector
curl https://api.anthropic.com/v1/messages \
  -H "content-type: application/json" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: mcp-client-2025-11-20" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1200,
    "messages": [
      {
        "role": "user",
        "content": "List the newest subscribers and propose a broadcast."
      }
    ],
    "mcp_servers": [
      {
        "type": "url",
        "url": "https://api.mailrith.com/mcp",
        "name": "mailrith",
        "authorization_token": "MAILRITH_API_KEY_HERE"
      }
    ],
    "tools": [
      {
        "type": "mcp_toolset",
        "mcp_server_name": "mailrith",
        "default_config": {
          "enabled": false
        },
        "configs": {
          "subscribers_list": { "enabled": true },
          "broadcasts_create": { "enabled": true }
        }
      }
    ]
  }'

n8n and Pipedream

Workflow tools usually expose MCP connection fields in a UI rather than a code-first SDK. Mailrith's remote server fits those clients directly with a streamable HTTP URL and a Bearer token.

n8n MCP client fields
Transport: Streamable HTTP
Server URL: https://api.mailrith.com/mcp
Authentication: Header
Header name: Authorization
Header value: Bearer {{$env.MAILRITH_API_KEY}}
Pipedream remote MCP server fields
Server URL: https://api.mailrith.com/mcp
Authorization header: Bearer {{process.env.MAILRITH_API_KEY}}
Suggested tools: subscribers_list, broadcasts_create, broadcasts_send_test

Need help shipping an integration?

Reach the Mailrith team if you need help planning a sync, validating a webhook flow, or troubleshooting a request.

Contact Mailrith

Related guides

On this page

Jump to the section you need.