跳到正文
DEV Community· rarora2026-gif·· 2 小時前AI 評分45

Claude 或 ChatGPT 能否向你的社交媒體帳戶發文?可以,方法如下(MCP、CLI 和 REST)

Can Claude or ChatGPT post to your social media accounts? Yes, and here's how (MCP, CLI and REST)

AI 導讀

Claude 或 ChatGPT 連接可存取社交帳戶的 MCP 伺服器後,便可代為發布或排程貼文,並取得各平台的發布回執。PostWharf 亦提供 CLI 和 REST API,供腳本、工作流程或其他應用程式使用。服務按工作區收費,每月 $15 起,包含不限數量的頻道及 7 天免費試用。

正文

Ask an AI assistant to "post this to LinkedIn and X" and most of the time it writes you a nice caption and stops there. It can't press the button, because nothing has given it a way to.

That changes once you hand it a tool. This post walks through the three ways I wire publishing into an AI or developer workflow: an MCP server your assistant calls directly, a CLI for scripts and cron, and a REST API for everything else (n8n, Zapier, Make, your own backend). The examples use PostWharf, the tool I build, but the pattern is the same whatever you use.

The short answer

An assistant like Claude or ChatGPT can publish to your social accounts when it's connected to an MCP server that has access to them. The assistant drafts the post, calls a publish or schedule tool, and gets a receipt back per network. You stay in control: you connect the accounts once, and the assistant acts through a key you can revoke.

Option 1: an MCP server for posting to social media

MCP (Model Context Protocol) is the standard way to give an AI assistant tools. A social media MCP server exposes tools like "list my channels", "draft a post", "schedule this for Tuesday 9am" and "how did yesterday's post do".

PostWharf's hosted MCP server lives at https://mcp.postwharf.com/mcp (Streamable HTTP). In Claude Code it's one command:

claude mcp add --transport http \
  wharf https://mcp.postwharf.com/mcp \
  --header "Authorization: Bearer $POSTWHARF_KEY"

In Cursor, the same address and header go under mcpServers:

{
  "mcpServers": {
    "wharf": {
      "url": "https://mcp.postwharf.com/mcp",
      "headers": { "Authorization": "Bearer YOUR_WORKSPACE_KEY" }
    }
  }
}

The Claude and ChatGPT apps don't have a field for a header, so they use a connect link from the dashboard instead (under Agent & MCP). Once it's connected you just ask:

"Turn this changelog into a LinkedIn post and a shorter X post, and schedule both for tomorrow at 9am."

The assistant checks which channels you have, adapts the text to each network's limits, schedules it, and tells you what went out where. Setup guides for each client are at postwharf.com/ai/chatgpt and postwharf.com/mcp.

Option 2: a CLI tool to schedule social media posts

Sometimes you don't want a chat window, you want a line in a script. A social media CLI is the simplest way to post from a terminal, a cron job or a CI pipeline:

npm i -g postwharf
export POSTWHARF_API_KEY=wf_live_…

wharf whoami                                   # plan, posts left, channels
wharf post "Shipping today." --all             # every connected account
wharf post "New reel" --media ./out/reel.mp4 \
  --to instagram,tiktok --type-for instagram:reel --at "tue 9am"
wharf status --since 7d                        # what went out, what didn't

A few things that matter when it runs unattended:

  • Local files just work. --media ./clip.mp4 uploads the file for you; nothing needs hosting first.
  • --dry-run runs every check the real call would (text length per network, file formats) and writes nothing.
  • It exits non-zero when a delivery fails, so cron and CI fail loudly instead of quietly not posting.
  • --idempotency-key means a retried job doesn't double-post.

This also makes the CLI a great tool for coding agents. Claude Code or Codex can call wharf like any other command, with no prompts and no config file needed beyond the environment variable.

Option 3: a REST API for posting to multiple platforms

For n8n, Zapier, Make or your own app, it's one HTTP call. Give publish_at to schedule, or leave it out to publish now. Per-channel overrides let one request carry a different caption for each network:

POST https://api.postwharf.com/v1/posts
Authorization: Bearer wf_live_…
Content-Type: application/json

{
  "text": "Most founders think they have a marketing problem.",
  "channels": ["ch_x_main", "ch_li_main", "ch_ig_main"],
  "publish_at": "2026-11-03T09:00:00Z",
  "overrides": {
    "ch_x_main": { "text": "Short version for X →" }
  }
}

You get a post id back, then delivery receipts per network via GET /v1/events or webhooks. The full reference is in the developer docs.

Which networks?

Today PostWharf publishes to Instagram, TikTok, X, LinkedIn, YouTube, Facebook, Threads, Pinterest, Bluesky and Telegram. Reddit, Discord, Snapchat and WordPress are on the request list but can't publish yet. For most networks you also get the post's figures back (views, reach, likes, comments, shares, saves), so your assistant can tell you what worked.

Why I built it this way: no per-channel fees

Most schedulers charge per connected channel, which hurts the moment you run more than one brand or a handful of client accounts. PostWharf is priced per workspace with unlimited channels, starting at $15/month with a seven-day free trial. Connect ten accounts or forty; the price doesn't change.

What it deliberately doesn't do: social listening, an engagement inbox, link-in-bio pages or a visual grid planner. It publishes, it tells you what happened, and it lets your tools and your AI do the posting.

Try it

  1. Sign up at postwharf.com and connect your accounts.
  2. Copy your workspace key.
  3. Pick a door: MCP, CLI or REST.

If you wire it into an agent or a pipeline, I'd love to hear what you build. Drop it in the comments.

來源:DEV Community · dev.to