MindThread 如何限制 AI 智能體未經批准地發佈 Threads 貼文
Letting an AI agent post to Threads without letting it go rogue
MindThread 作者重建了服務的智能體端,提供 CLI 和 MCP 伺服器,讓 Claude Code、Codex、Cursor 或自編腳本操作 Threads 帳戶。
I run a one-person company in Taiwan. My product, MindThread, schedules and publishes Threads posts for paying users here, and it has had a REST API for a while. This month I rebuilt the agent side of it: a CLI and an MCP server, so Claude Code, Codex, Cursor or your own scripts can run a Threads account.
Letting an agent post is easy. Making sure it can't post something you didn't approve took most of the work.
Start in the sandbox
Sign up at mindthread.tw, connect a Threads account (Meta's official OAuth, no password), then create a key under Settings → API keys. Start with a test key (mt_test_…): reads show your real data, writes are simulated, and nothing reaches Threads.
The CLI
npm install -g mindthread-cli # or run any command with: npx mindthread-cli <command>
export MINDTHREAD_API_KEY=mt_test_your_key # PowerShell: $env:MINDTHREAD_API_KEY="mt_test_your_key"
mindthread whoami # plan, permissions, calls left today
Then schedule a first post:
mindthread accounts # find your @handle
mindthread post "Hello from my terminal" --account @yourbrand --at 2026-11-01T09:00:00+08:00
mindthread schedules --account @yourbrand # check it is there
For agents, the important parts are --json (or MINDTHREAD_JSON=1), which prints the API response unchanged on stdout, and fixed exit codes: 0 ok, 1 API error, 2 usage error (nothing sent), 3 waiting for the owner, 4 key problem, 5 rate limited.
The MCP server
If your client speaks MCP, point it at the hosted endpoint. In Claude Code:
claude mcp add --transport http mindthread https://mindthread.tw/api/mcp --header "Authorization: Bearer mt_test_your_key"
For clients that only start servers with a command, the npm package is a stdio bridge to the same endpoint. Claude Desktop:
{
"mcpServers": {
"mindthread": {
"command": "npx",
"args": ["-y", "mindthread-mcp"],
"env": { "MINDTHREAD_API_KEY": "mt_test_your_key" }
}
}
}
Cursor and VS Code configs are in the README; use your mt_test_ key while trying it. Without any key, initialize, tools/list, get_playbook and list_formulas still work, so you can see the tools before signing up. The server is listed in the MCP Registry as io.github.ppcvote/mindthread.
Then ask:
List my MindThread accounts. Then write a short post about why I started my business, show it to me, and schedule it on my account for tomorrow at 9:00 Taipei time.
The ask step
Prompts are not permissions. "Always show me the draft first" works until the context gets long, so the control lives on the key.
Each permission on a key (read, write drafts, schedule, publish now, send replies, turn cloud patrol on, connect accounts, loosen guardrails, webhooks) is set to allow, ask or deny (read can only be allow or deny). With ask, the request does not run. The agent gets approval_required with a link to hand you, and the action runs only after you confirm on mindthread.tw.
Defaults for a new live key: publish now, sending replies, enabling patrol and loosening guardrails ask first; scheduling a post 30+ minutes ahead is allowed, and you can set it to ask.
In the CLI that is exit code 3, and the bundled agent skill says: give the human the link, do not resend. The agent can check later with mindthread approval <id>, or nudge you with --remind.
A few things are never delegated. Turning cloud patrol on is never granted to an OAuth connection such as Claude or ChatGPT, and undoing a guardrail change is always done by the owner on the website. If something goes wrong, disable_this_key lets the agent switch off its own key, and you can revoke keys in Settings.
Content rules sit in the same place. Length limits, banned phrases, no hashtags, and "only numbers from my fact list" are checked by the server on every API write and again at publish time. With enforce: block a violating post is refused, whatever the model wrote; the default is warn, which only flags it.
Reply drafts you approve
Cloud patrol searches Threads for your keywords through the official API and drafts replies. It is off by default. With review_before_reply on, every drafted reply waits in a pending list until you approve or reject it; with it off, replies go out on their own up to the daily cap. The agent reviews pending drafts with you:
mindthread patrol pending -a @yourbrand
mindthread patrol approve <id> --reply "Thanks, that is exactly why we built it."
Over MCP the same flow is list_pending_replies, approve_pending_reply and reject_pending_reply.
Rate limits, ours and Meta's
Every plan includes API access. In October 2026 the free plan is 1 account, 3 posts a day and 50 calls a day per live key, test keys share a 500-a-day sandbox, and paid plans raise the daily pool; a per-minute limit applies too. A 429 tells the agent which limit it hit and when it resets, and the CLI turns it into exit code 5.
Meta has its own caps per Threads profile, about 250 API posts and 1,000 replies in 24 hours. MindThread cannot lift those, and the official API lowers the risk of Meta restricting an account; it does not remove it.
What we learned
-
Agents poll. In the week before launch, 405 of 449 API errors were 429s on the event feed, which looks like an agent polling it until it hit the free plan's 50-call daily cap. The docs now lead with webhooks;
mindthread events --followstill exists. -
Retries post twice.
post,thread publishandqueue addtake--idempotency-key, and a retry with the same key returns the first result. -
Never block on stdin. The CLI reads stdin only when you pass
-, so an agent running it through an open pipe cannot hang. - Clients drift. The old CLI's response fields no longer matched the API. The new one has contract tests that check each route against the live OpenAPI spec, and the MCP package takes its tool list from the server, so a new tool does not need a new npm release.
What is missing
Threads only. The MCP server does not have the thread, webhook and A/B experiment tools the CLI has. Cursor and VS Code connect with an API key header for now, not OAuth. Parts of the dashboard are still Chinese first. The CLI and MCP bridge are MIT; the service behind them is hosted, not open source.
Try it
- CLI: https://github.com/ppcvote/mindthread-cli (
npx mindthread-cli) - MCP: https://github.com/ppcvote/mindthread-mcp (
npx -y mindthread-mcp) - Docs and current limits: https://mindthread.tw/developers
If you let an agent post for you, tell me what you would want it to ask first.
來源:DEV Community · dev.to