Ask your AI

Copy this and paste it into ChatGPT, Claude or another assistant to get an answer based on this site.

How do I connect X to an AI agent? Please use this URL as a reference:
https://agentok.jp/en/services/x.md
SNS

How to connect X to AI agents

TL;DR

Available

There is an official MCP server (https://api.x.com/mcp) and an official API (X API v2), so agents can search, fetch and create posts with your own developer app over OAuth 2.0. Pricing is pay-per-use: creating a post costs $0.015 per request ($0.20 if the post contains a URL) and reading a post costs $0.005 per resource. Browser automation and scraping are prohibited by the terms of service and the automation rules.

Recommended methodOfficial MCP
AuthenticationOAuth 2.0 (an app-only Bearer token is also available. OAuth 1.0a can be used with the API and the self-hosted xmcp)
PricingPay-per-use (no subscription. Buy credits upfront in the Developer Console; they are deducted per request. There is no free plan)
Verified2026.12.05

For AI agents: Markdown ・ JSON

Official MCP and AI guides

Official MCP serverYes

Hosting: Remote and local

A hosted official MCP server from the X Developer Platform (Streamable HTTP, with OAuth discovery). Authentication is OAuth 2.0 or an app-only Bearer token; OAuth 1.0a is not available on the hosted server (it can be used with the API and the self-hosted xmcp). It does not support dynamic client registration, so you need the OAuth 2.0 Client ID of your own X app. For clients without native OAuth support there is an official local bridge, xurl (`npx -y @xdevplatform/xurl mcp https://api.x.com/mcp`). Adding ?read_only=true to the URL makes the connection read-only. A self-hosted version is published in the official xdevplatform/xmcp repository (Python; it generates tools from the X API OpenAPI specification with FastMCP). The tool list below covers the main tools from the xmcp list; there are more than 100 tools in total. The hosted server's full tool list is only published inside an authenticated session, and whether it matches the xmcp list exactly is Unverified.

https://api.x.com/mcp

Official guide for AI agentsYes

There is an official Docs MCP (https://docs.x.com/mcp, hosted) for searching and reading the developer documentation itself. The MCP setup steps are also collected on the documentation's MCP page.

https://docs.x.com/mcp

Tools of the official MCP server

ToolTypeWhat it does
searchPostsRecentReadSearch recent posts
searchPostsAllReadSearch the full archive of posts
getPostsByIdReadFetch a post by its ID
getPostsLikingUsersReadFetch the users who liked a post
createPostsWriteCreate a post
deletePostsWriteDelete a post
getUsersByUsernameReadFetch a user by username
getUsersMeReadFetch the authenticated user
searchUsersReadSearch users
getUsersPostsReadFetch a user's posts
getUsersTimelineReadFetch a user's home timeline
getUsersMentionsReadFetch mentions
getUsersBookmarksReadFetch bookmarks
createUsersBookmarkWriteBookmark a post
getTrendsByWoeidReadFetch trends for a location (WOEID)
getNewsReadFetch news stories
searchNewsReadSearch news
likePostWriteLike a post
repostPostWriteRepost a post
createDirectMessagesByParticipantIdWriteSend a direct message

Connectors

Official connectors from AI services

  • Microsoft Copilot

    There is an X connector (Standard) for Copilot Studio, and also for Power Automate, Power Apps and Logic Apps. However, the shared application maintained by Microsoft is no longer available; only Bring your own application is supported, and Microsoft Learn states that a paid Enterprise tier application is required.

Not supported: Claude, ChatGPT, Gemini

Third-party integration services

  • n8n

    There is a built-in X node. It can create, reply to, delete, search, like and repost tweets, create direct messages, fetch users and add members to lists. It can also be used as a tool by AI agents. Your own X developer app (Client ID / Client Secret) is required.

  • Power Automate

    There is an X connector (Standard), but as with Copilot Studio only Bring your own application is supported, and Microsoft Learn states that a paid Enterprise tier application is required.

  • IFTTT

    The X (Twitter) service is still available, with 17 triggers, queries and actions in total (triggers such as a new post by you, a new mention, a new follower, and posts matching a search; queries for account stats and profiles; and a post-a-tweet action). Triggers poll: every hour on Free, every 15 minutes on Starter, and every 5 minutes on Pro and Pro+.

  • Composio

    There is a Twitter toolkit with 87 tools (creating and deleting posts, search, direct messages, lists, bookmarks, follows, media uploads, and more), usable from agents through Composio's MCP / Tool Router. Composio-managed OAuth has been discontinued, so registering your own X developer app's Client ID, Client Secret and app-only Bearer token is required (per Composio's official documentation).

  • Yoom

    X (Twitter) appears in the integration app list, and Yoom states that it connects to the X API without code to automate actions such as posting.

Not supported: Zapier, Make

Unverified: Pipedream

Security assessment

For each available connection method: who provides it, the permissions it requires, how the terms treat it, and the data path. Items we could not confirm are marked Unverified.

Official MCPOfficial MCP serverThe service provider
Permissions requiredRead and write

Determined by the OAuth 2.0 scopes of your own X app (tweet.read, tweet.write, users.read, media.write, like.write, and others; adding offline.access gives a refresh token). Access tokens last two hours. An app-only Bearer token is read-only and cannot act as a user. ?read_only=true removes write tools on the server side

Terms of serviceNo issues

An official connection method, used within the Developer Agreement and Developer Policy. The Developer Policy prohibits using X content to train foundation models

Source: relevant section of the terms

Data pathThe MCP client connects directly to X's servers (api.x.com). With the xurl bridge, access and refresh tokens are stored locally in ~/.xurl, so the machine's file permissions and device management apply. Fetched content, such as posts, is passed to the connected MCP client (the AI provider). Separately check that the AI client is on a setting or plan where the data is not used for training.
Official connectorMicrosoft CopilotOfficial from the integration service
Permissions requiredRead and write

Limited to the permissions of your own X app that you bring. Connections are not shareable; each user creates their own connection

Terms of serviceNo issues

The route uses the official API and raises no terms issue. However, Microsoft Learn states that a paid Enterprise tier application is required (a pricing and contract condition).

Source: relevant section of the terms

Data pathConnects to the X API through Microsoft's cloud (Power Platform)
Third-party integrationn8nOfficial from the integration service
Permissions requiredRead and write

Limited to the OAuth permissions of your own X app. API usage is billed to your own developer account's credits

Terms of serviceNo issues

A route that uses the official API with your own app

Source: relevant section of the terms

Data pathWhen self-hosted, your own n8n connects directly to X. With n8n Cloud, requests go through n8n's servers
Third-party integrationPower AutomateOfficial from the integration service
Permissions requiredRead and write

Limited to the permissions of your own X app that you bring. Connections are not shareable

Terms of serviceNo issues

The route uses the official API and raises no terms issue. However, Microsoft Learn states that a paid Enterprise tier application is required (a pricing and contract condition).

Source: relevant section of the terms

Data pathConnects to the X API through Microsoft's cloud
Third-party integrationIFTTTOfficial from the integration service
Permissions requiredRead and write

The permissions of the X account connected to IFTTT. Scope details are unverified

Terms of serviceUnverified

What form of API agreement IFTTT connects under is Unverified from public information

Source: relevant section of the terms

Data pathGoes through IFTTT's servers. The storage region is unverified
Third-party integrationComposioOfficial from the integration service
Permissions requiredRead and write

Limited to the OAuth 2.0 scopes of your own X developer app. API usage is billed to your own developer account's credits

Terms of serviceNo issues

A route that uses the official API with your own developer app. Composio-managed authentication was discontinued in February 2026, and bringing your own app is now required

Source: relevant section of the terms

Data pathGoes through Composio's servers. You register your app's Client Secret and Bearer token with Composio
Third-party integrationYoomOfficial from the integration service
Permissions requiredRead and write

The permissions of the X account connected to Yoom. Details are Unverified

Terms of serviceUnverified

What form of API agreement Yoom connects under is Unverified

Source: relevant section of the terms

Data pathGoes through Yoom's servers. Details are Unverified

Data you can fetch within the terms of service

Posts, users, lists, direct messages, trends and more are available through the official API and the official MCP server. Taking data that only exists on web screens, which the API does not offer, by scraping or browser automation is not permitted.

ScrapingProhibited

The Terms of Service (Misuse of the Services) prohibit accessing the services other than through the published interfaces, and state that crawling or scraping the Services in any form, for any purpose without prior written consent is expressly prohibited. The Automation Rules also prohibit non-API automation such as scripting the X website, and violations can result in permanent suspension of the account. robots.txt also returns Disallow: / for User-agent: *.

Source: relevant section of the terms of service

Fetching with the agent's own browser

There is an official API or MCP server, so we do not recommend having an agent sign in and operate the site in a browser on your behalf.

Usage

How to connect

  1. Create a developer account in the X Developer Console (console.x.com), agree to the Developer Agreement, and create an app.
  2. Buy credits in the Developer Console (pay-per-use; the API cannot be used with a zero balance). A spending limit can also be set.
  3. Enable OAuth 2.0 in the app's authentication settings, register the callback URI of the MCP client you will use, and note the Client ID.
  4. Configure the MCP client with https://api.x.com/mcp and the Client ID, and in the browser consent screen grant only the scopes you need (such as tweet.read, tweet.write, users.read and offline.access). For read-only use, use https://api.x.com/mcp?read_only=true as the URL.
  5. For clients without native OAuth support, set the CLIENT_ID and CLIENT_SECRET environment variables (from your own X app), start the local bridge with npx -y @xdevplatform/xurl mcp https://api.x.com/mcp, and complete the first browser sign-in (the callback http://localhost:8080/callback must be registered on the app).

Look up posts by keyword

Instruction to the agent

Search recent posts about "agent connections" and show me the ones with the most engagement

searchPostsRecent searches recent posts. Reads cost $0.005 per resource, and the same resource is not charged twice within the same UTC day.

Check your own account

Instruction to the agent

Tell me the name and username of the connected X account

getUsersMe fetches the authenticated account. Reads of your own data are Owned Reads at $0.001 per resource.

Create a post

Instruction to the agent

Post this text: I published today's article

createPosts creates a post. Creating a post costs $0.015 per request, and $0.20 if it contains a URL. Automated replies and automated likes are restricted by the automation rules.

Pitfalls and tips

Pitfalls

  • Pricing is pay-per-use, and reads are billed per resource returned. If a search returns 100 posts, the post reads alone cost $0.50. Letting an agent repeat broad searches consumes credits quickly.
  • A post containing a URL costs $0.20 per request, more than 13 times a regular post ($0.015). Watch the cost of automating link posts.
  • Pay-per-use post reads are capped at 3 million per billing cycle. Beyond that, an Enterprise plan is required.
  • Only one live OAuth grant exists per app and user. Signing in from a second client with the same app revokes the first client's tokens. Use a separate app per client.
  • X's automation rules state that AI-powered automated reply bots require X's prior written approval.
  • Using X content to train foundation or frontier models is prohibited by the Developer Policy.
  • The Zapier and Make integrations for X have been discontinued. Old integration articles and templates that remain online no longer work.
  • Many unofficial MCP servers for X also circulate, but scraping-based ones and ones routed through third-party proxies may breach the terms' prohibition on scraping. Do not use them where the official MCP server is sufficient.

Tips

  • For read-only use, add ?read_only=true so write tools are removed from the tool list.
  • Your own data, such as your posts and bookmarks, costs $0.001 per resource as Owned Reads. Analyzing your own account is cheaper than regular reads.
  • Set a spending limit in the Developer Console to prevent unexpected charges if an agent runs away.

Related articles

How to connect kintone to AI agents

Available

How to connect Backlog to AI agents

Available

How to connect note to AI agents

Conditional

How to connect Money Forward ME to AI agents

Available1 agent check