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

# Connect Migma to Grok Bot

> Ask Grok Bot to add Migma Remote MCP, approve access in your browser, and verify the connection with a read-only brand request.

<Frame caption="Migma connects to Grok Bot through Remote MCP">
  <img src="https://mintcdn.com/migmaai/FD_h5ksPM7EFUv6w/images/tutorials/grok-bot/hero.webp?fit=max&auto=format&n=FD_h5ksPM7EFUv6w&q=85&s=90b33640db234ca560b8ab621fca58c1" alt="Illustration showing Migma connected to Grok Bot through the Migma Remote MCP URL" width="1672" height="941" data-path="images/tutorials/grok-bot/hero.webp" />
</Frame>

Connect Migma once, then ask Grok Bot to design emails, prepare opted-in audiences and campaigns, and read results through Migma tools.

Grok Bot works through Migma Remote MCP at `https://migma.ai/mcp`. Use the browser for sign-in, access review, and claim approval.

<Info>
  Agent-guided Remote MCP setup is available in Grok Bot desktop with user approval. Marketplace availability and connector authentication vary by Grok build and workspace policy.
</Info>

<Warning>
  Use one write path per task. Finish or pause current work before switching between Migma MCP and browser operation. This prevents duplicate drafts.
</Warning>

This guide covers the Grok Bot desktop app.

## Before you start

You need:

* A Migma account.
* Grok Bot desktop with plugins and MCP connections allowed.
* A browser for Migma access approval.

Team and Enterprise admins may need to allow the Migma server URL before members can connect it. Grok Bot follows the same plugin and MCP policy as Cursor.

## Connect Migma from Grok Bot

<Steps>
  <Step title="Ask Grok Bot to add Migma">
    If Migma appears under **Settings → Plugins**, add or enable it there, then continue to access approval. Until the listing is verified, create a Bot and paste this setup request:

    ```text theme={null}
    Read https://docs.migma.ai/grok.md and follow its setup instructions.

    Connect this Grok Bot to Migma Remote MCP at https://migma.ai/mcp.
    Reuse the existing Migma connection when available.
    Use connected Migma tools for routine work.
    Complete access through browser OAuth.

    Before adding the connector, show me what you found and ask for approval.
    When browser access approval is needed, stop and let me review it.

    After connection, verify access by listing my Migma brands read-only.
    ```

    Grok Bot should discover `https://migma.ai/mcp` and ask before adding it. Choose the approval action only when the endpoint is exact.

    <Frame caption="Illustration of Grok Bot discovering Migma Remote MCP and asking before adding it">
      <img src="https://mintcdn.com/migmaai/FD_h5ksPM7EFUv6w/images/tutorials/grok-bot/setup-migma-mcp.webp?fit=max&auto=format&n=FD_h5ksPM7EFUv6w&q=85&s=fe40d02ebe1ec3efe7a8813b63db92e1" alt="Illustration showing Grok Bot reading Migma setup guidance, finding the Migma Remote MCP URL, and asking whether to add the connector" width="1672" height="941" data-path="images/tutorials/grok-bot/setup-migma-mcp.webp" />
    </Frame>
  </Step>

  <Step title="Review Migma access">
    Grok Bot opens a browser for access approval. Sign in yourself if needed. Verify the app, return destination, and every requested permission before selecting **Allow**.

    `email:send` allows test and direct sends. `campaign:write` allows campaign creation, send, and schedule. Select access that matches the work you want Grok Bot to perform.

    <Frame caption="Illustration of the Migma access review opened by Grok Bot">
      <img src="https://mintcdn.com/migmaai/FD_h5ksPM7EFUv6w/images/tutorials/grok-bot/approve-migma-access.webp?fit=max&auto=format&n=FD_h5ksPM7EFUv6w&q=85&s=dec2b580b151142270d126f13f2fc1ac" alt="Illustration showing the Migma connection review with app, return destination, requested access, Cancel, and Allow" width="1672" height="941" data-path="images/tutorials/grok-bot/approve-migma-access.webp" />
    </Frame>

    Migma creates and returns the connection credential through browser OAuth.
  </Step>

  <Step title="Verify with a read-only request">
    Ask:

    ```text theme={null}
    Use Migma to list my brands read-only. State the Migma tool used.
    ```

    A successful result should use `migma_list_projects`, return accessible brands, and leave Migma data unchanged.

    <Frame caption="Illustration of Grok Bot verifying Migma with a read-only brand request">
      <img src="https://mintcdn.com/migmaai/FD_h5ksPM7EFUv6w/images/tutorials/grok-bot/verify-migma-mcp.webp?fit=max&auto=format&n=FD_h5ksPM7EFUv6w&q=85&s=9f8dd579f5d071879a339a8c7f369d78" alt="Illustration showing Grok Bot calling Migma list projects, returning a sanitized demo brand, and making no changes" width="1672" height="941" data-path="images/tutorials/grok-bot/verify-migma-mcp.webp" />
    </Frame>
  </Step>
</Steps>

### If OAuth cannot complete

Some Grok Bot builds use an OAuth callback that Migma cannot accept. If Grok shows `redirect_uris must be HTTPS`:

1. Ask Grok Bot to read `https://api.migma.ai/auth.md`.
2. Confirm Grok can store the claim token and returned credential in its supported secret store.
3. Open the claim link yourself, confirm the signed-in Migma account and requested scopes, then approve.
4. Repeat the read-only brand request.

Claim-code returns a credential once for direct authenticated requests. Confirm secure storage and a durable connected state before completing setup.

<Warning>
  `campaign:write` includes campaign creation, send, and schedule. For email-draft work, request `email:read email:write`.
</Warning>

## Other Grok clients

Grok web and Grok Build are separate from Grok Bot desktop.

For Grok web, open [grok.com/connectors](https://grok.com/connectors), choose **New Connector → Custom**, and add `https://migma.ai/mcp`.

For Grok Build:

```bash theme={null}
grok mcp add --transport http migma https://migma.ai/mcp
grok mcp doctor migma
```

## Browser fallback

When you choose browser fallback, Grok Bot may operate a signed-in Migma browser session. Take over for password, passkey, two-factor code, and CAPTCHA. Every Bot shares that cloud computer and its browser sessions. Sign out after use.

## Give Grok Bot a safe job

Ask Grok Bot to read this page, then save this operating instruction:

```text theme={null}
You run email marketing through Migma.

Use connected Migma tools for Migma work.
Keep one active write path per task and reconcile drafts before switching paths.
Complete access through browser OAuth. If its callback fails, follow auth.md with supported secure credential storage.
Start by listing brands and ask me which brand to use.
Create editable drafts and show every preview and Migma canvas link.
Use only facts in the selected brand or facts I provide.
Use contacts who gave marketing consent.
Wait for my explicit approval in the current conversation before sends, schedules, exports, deletes, or audience changes.
Before any approved send, show the audience, recipient count, sender, subject, schedule, and final preview.
Treat campaign:write as permission to create, send, and schedule campaigns.
```

## Run the email marketing loop

Migma MCP returns exact brand, email, campaign, audience, and result data. Use Migma tools as the active write path for this workflow.

<Steps>
  <Step title="Choose one brand">
    Ask Grok Bot to list Migma brands, then select one.
  </Step>

  <Step title="Save lasting brand facts">
    When you share tone, offers, product facts, policies, or FAQs that should persist, ask Migma to save them to the selected brand's knowledge base.
  </Step>

  <Step title="Build a source brief">
    For current launches or product news, make Grok research primary sources first. Require a dated checklist of exact facts for each email and up to five public HTTPS source-image URLs. Use primary sources for facts and images for visual direction.
  </Step>

  <Step title="Create drafts first">
    Ask for one email or a short series. State audience, goal, approved facts, and CTA. End with **Keep these as editable drafts and show every preview.**

    ```text theme={null}
    Use Migma with brand [name].
    Create 3 launch emails for [audience].
    Goal: [action].
    Required facts by email: [exact checklist from verified sources].
    Source images: [up to 5 public HTTPS URLs].
    Pass those URLs through migma_generate_email.images as structured image inputs.
    Keep every email as an editable Migma draft and show each preview.
    ```

    <Frame caption="Illustration of Grok Bot returning three Migma drafts">
      <img src="https://mintcdn.com/migmaai/FD_h5ksPM7EFUv6w/images/tutorials/grok-bot/create-drafts.webp?fit=max&auto=format&n=FD_h5ksPM7EFUv6w&q=85&s=a7a7f0f31081305545cf561f814bd8cd" alt="Illustration showing three Migma draft email previews in Grok Bot and confirmation that no email was sent" width="1672" height="941" data-path="images/tutorials/grok-bot/create-drafts.webp" />
    </Frame>
  </Step>

  <Step title="Review and check">
    Review returned previews in Grok Bot. Check every required fact in content and every expected source asset in images before saying the work is complete. If a preview cannot be inspected, say verification is incomplete and open its Migma link. Ask for targeted text edits, then run compatibility and deliverability checks. Use replacement generation to add missing structured images.
  </Step>

  <Step title="Prepare the audience">
    Import only opted-in contacts, or choose an existing list or segment. Ask Grok Bot to report created, updated, skipped, and failed counts before continuing.
  </Step>

  <Step title="Confirm the sender">
    Ask Migma to list available sending domains and From addresses. If none are ready, set up a domain you own or start with a managed Migma address before preparing the campaign.
  </Step>

  <Step title="Prepare the campaign for review">
    Migma needs `campaign:write` to create a campaign draft. This permission also includes send and schedule. Ask Grok Bot to create the draft, then pause for review:

    ```text theme={null}
    Create a campaign draft from email [email id or canvas link].
    Recipients: [opted-in list or segment].
    Subject: [subject].
    Sender: [sender].
    Keep the campaign in draft. Show recipient count, sender, subject, and final preview, then wait for my approval.
    ```

    <Frame caption="Illustration of a campaign waiting for approval">
      <img src="https://mintcdn.com/migmaai/FD_h5ksPM7EFUv6w/images/tutorials/grok-bot/review-campaign.webp?fit=max&auto=format&n=FD_h5ksPM7EFUv6w&q=85&s=727ee9628922d5a45deaf6443dd57a85" alt="Illustration showing Grok Bot and Migma preparing a campaign summary with audience, sender, schedule, previews, and nothing sent" width="1672" height="941" data-path="images/tutorials/grok-bot/review-campaign.webp" />
    </Frame>
  </Step>

  <Step title="Approve the exact send">
    Send or schedule only after audience, recipient count, sender, subject, timing, and preview match your intent. Keep Grok Bot approval controls enabled.
  </Step>

  <Step title="Read results and improve the next brief">
    After sending, ask Migma for campaign stats and delivery logs. Use clicks, bounces, and complaints to shape the next draft.

    <Frame caption="Illustration of Grok Bot reading campaign results through Migma">
      <img src="https://mintcdn.com/migmaai/FD_h5ksPM7EFUv6w/images/tutorials/grok-bot/read-results.webp?fit=max&auto=format&n=FD_h5ksPM7EFUv6w&q=85&s=093499d103a1f0202e03727a9a88a588" alt="Illustration showing Grok Bot using Migma campaign stats to summarize delivery, opens, clicks, bounces, and recommend the next brief" width="1672" height="941" data-path="images/tutorials/grok-bot/read-results.webp" />
    </Frame>
  </Step>
</Steps>

## Prompts worth saving

### Import an opted-in CSV

```text theme={null}
Use Migma with brand [name].
Import this CSV into a list named "[list name]".
These contacts opted in on our site.
Use one contact import with the full CSV text.
Report created, updated, skipped, and failed counts.
```

### Approve one exact send

```text theme={null}
Use campaign [name or id].
Confirm the audience, recipient count, sender, subject, final preview, date, time, and timezone.
Send when every value matches this conversation.
When any value differs, show the exact correction and wait for approval.
```

### Read performance

```text theme={null}
Use Migma to show stats and recent delivery logs for campaign [name or id].
Explain the strongest click signal, bounces, and complaints in plain language.
Recommend the next email brief and return the analysis only.
```

## Safe routines

After the Migma connection is verified, first run the task once. When the result is stable, save it as a Grok Bot skill or routine.

Good routines prepare work and stop:

```text theme={null}
Every Monday at 9:00 AM, review last week's Migma campaign results for brand [name].
Prepare one draft based on the strongest click signal.
Use only approved brand facts and opted-in audience data.
Show the preview and reasoning, then wait for approval.
```

Keep routines in preparation and review mode. xAI recommends approval for sending, publishing, deleting, purchasing, and production changes.

## Disconnect or revoke access

1. Pause any routine that uses Migma.
2. Open **Settings → Plugins**, find the installed Migma connector, and disconnect or remove it.
3. Revoke its matching OAuth-created key in **Migma Settings → Developers → API Keys**.
4. If you used claim-code, revoke the matching `Agent:` key and remove its stored credential from Grok.
5. If you used browser fallback, sign out of Migma inside **Grok Bot's Computer**.

## Troubleshooting

| Problem                                             | Fix                                                                                                                               |
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| Grok Bot cannot add Migma                           | Check **Settings → Plugins** and workspace MCP policy. An admin may need to allow `https://migma.ai/mcp`.                         |
| Migma keeps asking for login                        | Open the Migma connector under installed plugins and repeat browser approval.                                                     |
| Bot cannot find a brand                             | Confirm the approved Migma account can access that brand, then repeat the read-only brand request.                                |
| Bot starts changing data during setup               | Send `Stop now`, then repeat the read-only setup prompt above.                                                                    |
| Connector OAuth rejects its callback                | Follow `auth.md` claim-code with Grok's supported secure credential storage.                                                      |
| Bot needs a connection credential                   | Complete hosted OAuth. Use `auth.md` claim-code for a direct client with supported secure credential storage.                     |
| Duplicate drafts appear                             | Browser and MCP wrote at the same time. Stop both, list existing drafts read-only, keep one set, then continue through one mode.  |
| Researched features or images are missing           | Rebuild an exact fact checklist. Pass source URLs through structured `images`, regenerate once, then verify content and previews. |
| Connection still shows `needsAuth` after claim-code | Re-run the brand request and confirm Grok reports a durable connected state before completing setup.                              |

Current Grok behavior: [Grok Bot overview](https://docs.x.ai/grok-bot/overview), [get started and computer login](https://docs.x.ai/grok-bot/get-started), [skills and routines](https://docs.x.ai/grok-bot/skills-routines-and-automations), [approvals and security](https://docs.x.ai/grok-bot/approvals-security-and-privacy), and [Grok Build MCP](https://docs.x.ai/build/features/mcp-servers).

## Next

<CardGroup cols={2}>
  <Card title="MCP permissions" icon="shield-check" href="/security/mcp">
    Review access, approval, and revocation before connecting.
  </Card>

  <Card title="Migma MCP server" icon="server" href="/mcp-server">
    See hosted MCP behavior and troubleshooting.
  </Card>
</CardGroup>
