# Connect an AI agent to EzSocial

EzSocial lets a supported AI assistant plan, draft, schedule, and publish social posts for an existing EzSocial account. Use the hosted MCP server for an interactive assistant. Use the REST API for your own application or a headless workflow.

## Before connecting

1. Create an EzSocial account and choose a [paid plan](https://ezsocial.co/#pricing). API and MCP access require one.
2. Connect the social accounts you intend to use in the EzSocial dashboard. The agent cannot connect a new social account for you.
3. Know which workspace or brand you want the agent to use. An EzSocial account can have more than one workspace.

## Path A: hosted MCP

- Server URL: `https://mcp.ezsocial.co/mcp`
- Transport: Streamable HTTP
- Authentication: OAuth 2.1. Your MCP client opens a browser so you can sign in and approve the requested scopes. This path does not use an API key.
- No server install is needed.

Client-specific instructions:

- [ChatGPT](https://ezsocial.co/chatgpt): Create a custom MCP app in a supported workspace with write actions enabled.
- [Claude](https://ezsocial.co/claude): Add a custom remote MCP connector.
- [Claude Code](https://ezsocial.co/claude-code): Run `claude mcp add --transport http ezsocial https://mcp.ezsocial.co/mcp`, then use `/mcp` to sign in if prompted.

After connecting, ask the assistant: "List my EzSocial workspaces and connected accounts. Tell me which workspace you would use before creating anything." A working connection should call `ezsocial_list_workspaces` and `ezsocial_list_accounts`. If there are no accounts, connect them in EzSocial first.

For the next task, ask: "Read the brand context for my chosen workspace, draft a LinkedIn post about [specific update], and save it for review. Do not schedule or publish it yet."

## Path B: REST API

- Base URL: `https://api.ezsocial.co/api/v1`
- Authentication: a scoped API key in `Authorization: Bearer <key>`.
- Create and revoke keys in [Developers settings](https://ezsocial.co/dashboard/developers). Keep keys in a secret store; do not put one in a prompt, source file, or browser page.

First read-only request, using a key with `accounts:read`:

```sh
curl --fail-with-body \
  -H "Authorization: Bearer $EZSOCIAL_API_KEY" \
  https://api.ezsocial.co/api/v1/workspaces
```

Then read connected accounts and brand context for the intended workspace. See the [REST endpoint and scope reference](https://ezsocial.co/developers#rest-api) before writing or publishing. The API key needs `content:write` to create drafts; publishing requires the separate `publish` scope. AI media generation requires `ai:generate` and spends AI credits.

## Safe agent workflow

1. List workspaces and choose the intended `workspaceId`; do not silently use the default if the user has multiple brands.
2. List connected accounts and read brand context for that workspace.
3. Create a draft or plan. Validate the content for each target platform before scheduling.
4. Show the exact text, platform, account, and scheduled time to the user. Use an absolute ISO 8601 timestamp with timezone; API times are UTC.
5. Schedule or publish only when the user requests it, then read publication status to verify the result.

For human setup, tools, scopes, and webhooks, see [Developers and agents](https://ezsocial.co/developers). For support, email support@ezsocial.co.
