MCP server for posting tweets via X API v2
npm install x-post-mcpA minimal MCP server for posting tweets to X (Twitter) via API v2. Zero runtime dependencies.
``bash`
npm install -g x-post-mcpor
npx x-post-mcp
Add to your MCP client configuration:
`json`
{
"mcpServers": {
"x-post-mcp": {
"command": "npx",
"args": ["x-post-mcp"],
"env": {
"X_BEARER_TOKEN": "
}
}
}
}
1. Go to X Developer Portal
2. Create a project and app
3. Generate a User Authentication Token with tweet.read, tweet.write, users.read scopes
Post a new tweet to X.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| text | string | ✓ | Tweet content |
| reply_to_tweet_id | string | | Tweet ID to reply to |
| quote_tweet_id | string | | Tweet ID to quote |
You can create a skill file to help AI agents use this MCP. Save as .claude/skills/post-tweet.md:
`markdownPost Tweet Skill
Post a tweet to X (Twitter) using the x-post-mcp server.
1. Confirm the tweet content with the user before posting
2. Call the send_tweet tool with the user's message
3. Report the result back to the user
Simple tweet:
User: 帮我发一条推文:Hello World!
Assistant: [calls send_tweet with text: "Hello World!"]
Reply to a tweet:
User: 回复这条推文 1234567890:感谢分享!
Assistant: [calls send_tweet with text: "感谢分享!", reply_to_tweet_id: "1234567890"]
Quote tweet:
User: 引用推文 1234567890 并评论:这个观点很有意思
Assistant: [calls send_tweet with text: "这个观点很有意思", quote_tweet_id: "1234567890"]
``
MIT