Solutions · AI agents that post
AI agents that post and reply on X, with your approval
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.
For agents that only read X data, see 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.
- Setup guide
Local MCP server
The open-source twittrapi-mcp server on your machine, over stdio. SetTWITTRAPI_X_COOKIEandTWITTRAPI_X_PROXYand it adds account tools next to the read tools. - Setup guide
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.
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.
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
Reply to a tweet
reply_to_tweet
Save a draft for you to finish
create_draft
Read the DM inbox
list_dm_conversations
Send a direct message
send_dm
Delete one of its own tweets
delete_tweet
The full list is in the twittrapi-mcp README; every endpoint is on 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.
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 noteshttps://github.com/twittrapi/twittrapi-mcp#account-tools
- Account actions →Every endpoint, with parameters and errors/docs/account-actions
- X session guide →Cookie and proxy/docs/x-session
- AI agents (read-only) →Hosted MCP server, LangChain, LlamaIndex/use-cases/ai-agents
- Customer support over DMs →Read and answer the inbox/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.