Skip to main content
Glama
MIDAS MCP Server

MIDAS MCP Server

by Pyrexx-AI
README.md
# @midas-aem/client — Cold Email API, Shadow DOM Newsletter SDK & MCP Server

Official zero-dependency TypeScript/React/Next.js SDK, **Shadow DOM Web Component** newsletter modal (`match-host` theming + Cart Recovery), **1-line Next.js App Router proxy**, and **Model Context Protocol (MCP) server bridge** for **MIDAS** (`https://midas.pyrexxai.com`).

> Unlike iframe newsletter embeds (Substack, Beehiiv) or blast-only outreach tools, MIDAS unifies **multi-mailbox cold B2B email outreach** (with automated warmup, Spintax, and AI reply triage) and **encapsulated Shadow DOM newsletter channels** (`Town Crier Gongs`) under one deliverability-protected API and MCP server.

---

## Quick Links
- **Live Zero-Signup Playground:** [https://midas.pyrexxai.com/playground](https://midas.pyrexxai.com/playground)
- **Developer Docs:** [https://midas.pyrexxai.com/docs](https://midas.pyrexxai.com/docs)
- **MCP Server Spec:** [https://midas.pyrexxai.com/docs/mcp-server](https://midas.pyrexxai.com/docs/mcp-server)
- **Shadow DOM Embed Guide:** [https://midas.pyrexxai.com/docs/shadow-dom-embeds](https://midas.pyrexxai.com/docs/shadow-dom-embeds)
- **OpenAPI 3.1 Spec:** [https://midas.pyrexxai.com/openapi.json](https://midas.pyrexxai.com/openapi.json)

---

## Install & 60-Second CLI Setup

```bash
npm install @midas-aem/client
npx @midas-aem/client init
```

---

## 1. Connect MIDAS MCP Server to Claude Code, Cursor & Codex

### Option A: Stdio Bridge (`npx`)
Add to `.mcp.json` (Claude Code / Cursor / Windsurf):
```json
{
  "mcpServers": {
    "midas": {
      "command": "npx",
      "args": ["-y", "@midas-aem/client", "mcp"],
      "env": {
        "MIDAS_API_KEY": "midas_live_YOUR_SECRET_KEY",
        "MIDAS_BASE_URL": "https://midas.pyrexxai.com"
      }
    }
  }
}
```

### Option B: Remote Streamable HTTP MCP
- Endpoint: `POST https://midas.pyrexxai.com/api/mcp`
- Header: `Authorization: Bearer midas_live_YOUR_SECRET_KEY`
- Manifest: `https://midas.pyrexxai.com/.well-known/mcp.json`

**Exposed MCP Tools (7):** `midas_create_gong_channel`, `midas_get_embed_snippet`, `midas_subscribe_contact`, `midas_track_event`, `midas_send_sandbox_test`, `midas_get_campaign_health`, `midas_create_artifact`.

---

## 2. Zero-CLI Next.js App Router Proxy + Shadow DOM React Modal

Keep `MIDAS_API_KEY` strictly on your server while rendering zero-CSS-conflict Shadow DOM modals in the browser:

```ts
// app/api/midas/subscribe/route.ts
export { POST } from '@midas-aem/client/next';
```

```tsx
// components/NewsletterCTA.tsx
'use client';
import { MidasModal, MidasEmbed } from '@midas-aem/client/react';

export function NewsletterCTA() {
  return (
    <>
      <MidasModal
        endpoint="/api/midas/subscribe"
        gongId="weekly-alpha"
        themeMode="match-host"
        progressiveSteps
        developerToggle
        className="px-4 py-2 rounded-xl bg-amber-500 text-white font-bold"
      >
        Subscribe
      </MidasModal>

      <MidasEmbed
        endpoint="/api/midas/subscribe"
        gongId="weekly-alpha"
        layout="horizontal"
        themeMode="match-host"
        showCount
      />
    </>
  );
}
```

---

## 3. Server / Node.js Cold Email, Events & Newsletter SDK

```ts
import { MidasClient } from '@midas-aem/client';

// Automatically resolves process.env.MIDAS_API_KEY & process.env.MIDAS_BASE_URL
const midas = new MidasClient();

// 1. Zero-Setup Sandbox test email to your own inbox (no DNS needed)
await midas.sendSandboxTest({ subject: 'Hello from MIDAS' });

// 2. Subscribe a lead to a Town Crier Gong channel
await midas.subscribe({
  email: 'founder@acme.com',
  name: 'Alex Mercer',
  gongId: 'weekly-alpha',
  cadence: 'weekly',
  metadata: { isDeveloper: true },
});

// 3. Emit SaaS behavioral events to trigger transactional emails or sequences
await midas.trackEvent({
  email: 'founder@acme.com',
  eventName: 'trial.expiring',
  idempotencyKey: 'evt_trial_expiring_acme',
  properties: { daysLeft: 3 },
});

// 4. Trigger bounded cold-outreach sweep (<= 5 emails/tick)
await midas.dispatchCampaign('campaign_cuid_123');
```

---

## 4. Verify Outbound Webhooks (HMAC-SHA256)

```ts
import { MidasClient } from '@midas-aem/client';

const isValid = MidasClient.verifyWebhookSignature(
  rawBody,
  req.headers.get('x-midas-signature') || '',
  process.env.MIDAS_WEBHOOK_SECRET!
);
```

---

## License
Apache-2.0 — Pyrexx Technologies Inc.