# AI agents that post and reply on X, with your approval

> Let Claude or your own agent post, reply and answer DMs from its own X account: local MCP account tools that ask before every write, and Python, Node.js and Go SDKs. $0.065 to $0.10 per 1,000 calls.

HTML page: https://www.twittrapi.com/use-cases/agents-that-post

Solutions · AI agents that post

Let Claude or your own agent draft posts, reply to people and answer DMs from its own X account, and approve each write before it goes out. Each action is one call, the same price as a read: $0.065 to $0.10 per 1,000.

[Get an API key](https://www.twittrapi.com/start) [MCP account tools →](https://github.com/twittrapi/twittrapi-mcp#account-tools)

For agents that only read X data, see [AI agents](https://www.twittrapi.com/use-cases/ai-agents).

Setup

## Two ways to give an agent write access

Both use the X session (cookie) of the agent's account and a proxy.

- Local MCP server

  The open-source twittrapi-mcp server on your machine, over stdio. Set `TWITTRAPI_X_COOKIE` and `TWITTRAPI_X_PROXY` and it adds account tools next to the read tools.

  [Setup guide](https://github.com/twittrapi/twittrapi-mcp#account-tools) [Setup guide](https://github.com/twittrapi/twittrapi-mcp#account-tools)
- SDKs for your own agent (1.1.0)

  The Python, Node.js and Go SDKs have an account API: post, reply, upload media, drafts and DMs, with your own approval step in between.

  [Setup guide](https://github.com/twittrapi/twittrapi-python#account-actions) [Setup guide](https://github.com/twittrapi/twittrapi-python#account-actions)

[Get the cookie and set up a proxy](https://www.twittrapi.com/docs/x-session)

Human in the loop

## You confirm every write

The MCP server marks every tool that writes as not read-only, and deletions also as destructive. MCP clients such as Claude and Cursor then ask you before each call.

- Keep the approval prompts on. Read the text before you allow it.
- The cookie and proxy stay in the server's configuration; the model never sees them.
- Account tools only run over stdio on your machine. The hosted MCP server stays read-only.
- Each tool description tells the model to post only text you asked for. Direct messages also need `TWITTRAPI_X_CHAT_PASSCODE`.

Use your own account or one you're authorised to manage, and follow [X's rules on automation](https://help.x.com/en/rules-and-policies/x-automation).

Tools

## What the agent can do

MCP tool names, and the account action each one calls.

- Post a tweet, a quote or a poll

  create_tweet

  [/client/create](https://www.twittrapi.com/docs/account-actions/client-create)
- Reply to a tweet

  reply_to_tweet

  [/client/reply](https://www.twittrapi.com/docs/account-actions/client-reply)
- Save a draft for you to finish

  create_draft

  [/client/drafts/create](https://www.twittrapi.com/docs/account-actions/client-drafts-create)
- Read the DM inbox

  list_dm_conversations

  [/client/dm/inbox](https://www.twittrapi.com/docs/account-actions/client-dm-inbox)
- Send a direct message

  send_dm

  [/client/dm/send](https://www.twittrapi.com/docs/account-actions/client-dm-send)
- Delete one of its own tweets

  delete_tweet

  [/client/deleteTweet](https://www.twittrapi.com/docs/account-actions/client-deletetweet)

The full list is in the [twittrapi-mcp README](https://github.com/twittrapi/twittrapi-mcp#account-tools); every endpoint is on [Account actions](https://www.twittrapi.com/docs/account-actions).

Your own agent

## The account API in the SDKs

From version 1.1.0, each SDK takes the agent's X session once and exposes the account actions as methods. Let the model propose the text, show it to a person, and only then call the method.

- Python

  client.account.reply("<tweet_id>", "<approved text>")

  [README](https://github.com/twittrapi/twittrapi-python#account-actions)
- Node.js

  client.account({ cookie, proxy })

  [README](https://github.com/twittrapi/twittrapi-node#account-actions)
- Go

  client.Account(twittrapi.XSession{…})

  [README](https://github.com/twittrapi/twittrapi-go#account-actions)

Writes are not retried once the request may have reached the API, so a retry never posts twice. Draft first with `create_draft` when a person should finish the post on x.com.

FAQ

## Questions about agents that post

**Can the agent post without asking me?**

Not through the MCP server's account tools if you keep your client's approval prompts on: every tool that writes is marked as not read-only, so Claude, Cursor and other clients ask before each call. With the SDKs you build the approval step into your own loop.

**Why only the local MCP server?**

The account tools need the X session cookie and a proxy, and those stay in your own machine's configuration. The hosted MCP server and HTTP mode only offer the read tools.

**Does the model see my cookie?**

No. The cookie and proxy are server settings, not tool arguments, so they never reach the model and are never logged or returned in a tool result.

**Which account should the agent post from?**

Its own: a dedicated X account for the agent, labelled as automated in its profile settings, rather than your personal account. That keeps its posts clearly separate and follows X's rules for automated accounts.

**Can a retry post the same reply twice?**

The SDKs do not retry a write once the request may have reached the API, so a retry never posts twice. Reads still retry as usual.

Related

## Read next

- [MCP account tools → Setup, tool list, safety notes https://github.com/twittrapi/twittrapi-mcp#account-tools](https://github.com/twittrapi/twittrapi-mcp#account-tools)
- [Account actions → Every endpoint, with parameters and errors /docs/account-actions](https://www.twittrapi.com/docs/account-actions)
- [X session guide → Cookie and proxy /docs/x-session](https://www.twittrapi.com/docs/x-session)
- [AI agents (read-only) → Hosted MCP server, LangChain, LlamaIndex /use-cases/ai-agents](https://www.twittrapi.com/use-cases/ai-agents)
- [Customer support over DMs → Read and answer the inbox /use-cases/dm-support](https://www.twittrapi.com/use-cases/dm-support)

## Give your agent its own voice on X

Get a key, give the agent its own X account, and approve its first post. New accounts start with $0.50 free credit.

[Get an API key](https://www.twittrapi.com/start) [Set up the MCP account tools →](https://github.com/twittrapi/twittrapi-mcp#account-tools)
