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

# MCP server

> Connect Market or Die to Claude, ChatGPT, Cursor, or any MCP client and let your AI draft, schedule, and publish posts.

The Market or Die **MCP server** lets an AI assistant act on your workspace —
list channels, draft, schedule, and publish posts, and read the leaderboard.

There are two ways to connect:

<CardGroup cols={2}>
  <Card title="Remote (recommended)" icon="globe">
    A hosted server at a single URL. Sign in with your Market or Die account —
    **no API key to manage**. Best for Claude, ChatGPT, and Cursor.
  </Card>

  <Card title="Local (npm)" icon="terminal">
    Runs on your machine via `npx` and authenticates with an API key. Use it for
    offline clients or when you'd rather not use OAuth.
  </Card>
</CardGroup>

## Remote server (OAuth)

Point your client at:

```
https://api.marketordie.io/mcp
```

The first time you connect, your browser opens a Market or Die sign-in and
consent screen. Approve it once and the client stays connected — tokens refresh
automatically. Authorization uses OAuth 2.1 with dynamic client registration, so
there's nothing to paste.

<Tabs>
  <Tab title="Claude">
    <Steps>
      <Step title="Open connectors">
        In Claude, go to **Settings → Connectors → Add custom connector**.
      </Step>

      <Step title="Add the URL">
        Name it `Market or Die` and set the URL to
        `https://api.marketordie.io/mcp`. Save.
      </Step>

      <Step title="Sign in">
        Click **Connect**. A Market or Die window opens — sign in and **Authorize**.
        You'll bounce back to Claude, connected.
      </Step>
    </Steps>
  </Tab>

  <Tab title="ChatGPT">
    <Steps>
      <Step title="Open connectors">
        In ChatGPT, go to **Settings → Connectors → Create** (Developer mode /
        custom MCP must be enabled on your plan).
      </Step>

      <Step title="Add the URL">
        Set the MCP server URL to `https://api.marketordie.io/mcp` and choose
        **OAuth** for authentication.
      </Step>

      <Step title="Sign in">
        Connect, then sign in to Market or Die and **Authorize**.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Cursor">
    Add this to `~/.cursor/mcp.json` (or **Settings → MCP → Add server**), then
    click **Login** next to the server when Cursor prompts:

    ```json theme={null}
    {
      "mcpServers": {
        "marketordie": {
          "url": "https://api.marketordie.io/mcp"
        }
      }
    }
    ```
  </Tab>

  <Tab title="Other clients">
    Any client that supports **remote MCP over Streamable HTTP with OAuth** works.
    Use the server URL `https://api.marketordie.io/mcp`; the client handles
    registration and login automatically.

    ```json theme={null}
    {
      "mcpServers": {
        "marketordie": {
          "url": "https://api.marketordie.io/mcp"
        }
      }
    }
    ```
  </Tab>
</Tabs>

## Local server (npm)

Prefer a key over the browser flow? The local server wraps the same
[REST API](/index). First [create an API key](/create-api-key) under
**Profile → Developers**, then add:

```json theme={null}
{
  "mcpServers": {
    "marketordie": {
      "command": "npx",
      "args": ["-y", "marketordie-mcp"],
      "env": { "MARKETORDIE_API_KEY": "mod_live_…" }
    }
  }
}
```

| Variable               | Required | Default                         |
| ---------------------- | -------- | ------------------------------- |
| `MARKETORDIE_API_KEY`  | yes      | —                               |
| `MARKETORDIE_BASE_URL` | no       | `https://api.marketordie.io/v1` |

## Tools

Both servers expose the same tools:

| Tool              | What it does                                                    |
| ----------------- | --------------------------------------------------------------- |
| `whoami`          | Current workspace and member.                                   |
| `list_channels`   | Connected accounts (use their ids in `create_post`).            |
| `create_post`     | Publish now, schedule, or save a draft to one or more channels. |
| `list_posts`      | List posts; filter by status, paginate.                         |
| `get_post`        | Fetch one post.                                                 |
| `delete_post`     | Delete a draft or scheduled post.                               |
| `get_leaderboard` | Team standings by points.                                       |

## Try it

Once connected, ask your assistant things like:

* "What channels can I post to in Market or Die?"
* "Draft a LinkedIn post announcing our new pricing."
* "Schedule this thread to X and LinkedIn for tomorrow 9am."
* "Show my scheduled posts."

## Troubleshooting

<AccordionGroup>
  <Accordion title="The sign-in window doesn't open">
    Make sure your client supports **remote MCP with OAuth**. Older clients only
    support local (command-based) servers — use the [npm option](#local-server-npm)
    instead.
  </Accordion>

  <Accordion title="Authorized but no tools show up">
    Restart the client after connecting. If it persists, remove and re-add the
    server so it re-runs discovery against `https://api.marketordie.io/mcp`.
  </Accordion>

  <Accordion title="It posts to the wrong workspace">
    The connection acts as the member you signed in as. Sign out of that Market
    or Die account in the consent window and reconnect with the right one.
  </Accordion>
</AccordionGroup>
