X MCP server for AI agents and assistants

Securely connect your AI agents and chatbots (Claude, ChatGPT, Cursor, etc) with X MCP or direct API to search posts, find users and trends, manage bookmarks and lists, and create Article drafts through natural language.

X MCP logoX MCP
Oauth2

X MCP is X's hosted MCP server for searching posts, users, news, trends, Spaces, and communities. It provides a ready-to-use bridge for working with X data and account features.

96 Tools

Try X MCP now

Type what you want done — sign in and watch it run live in the Tool Router playground.

TOOL ROUTER PLAYGROUND
X MCP
Try asking
TOOLS

Supported Tools

Every X MCP action and event your agent gets out of the box.

Accept chat message request

Accept a Chat message request

Add chat moderator

Add a chat moderator

Add conversation keys

Add Conversation Keys

Add lists member

Add Lists Member

Archive chat conversation

Archive a Chat conversation

Article create draft

Create draft Article

Cancel scheduled call

Cancel a scheduled call

Chat media download

Download Chat Media.

Chat media upload append

Append Chat Media Upload.

Chat media upload finalize

Finalize Chat Media Upload.

Chat media upload initialize

Initialize Chat Media Upload.

Create lists

Create Lists

Create scheduled broadcast

Create a scheduled broadcast

Create source

Create a stream source

Create users bookmark

Create Bookmark

Create users bookmark folder

Create Bookmark Folder

Delete scheduled broadcast

Delete a scheduled broadcast

Delete source

Delete a stream source

Delete users bookmark

Delete Bookmark

Follow list

Follow List

Get broadcast

Get a broadcast

Get broadcast chat

Get broadcast chat history

Get chat conversation

Get Chat Conversation; unread state via chat_conversation.

Get chat conversation events

Get Chat Conversation Events, newest first; unread ones have an id above last_read_event_id

Get chat conversations

Get Chat Conversations; unread state via chat_conversation.

Get chat message request

Get Chat Message Request

Get chat message requests

Get Chat Message Requests

Get chat moderators

Get chat moderators

Get communities by

Get Communities by ID

Get lists by

Get Lists by ID

Get lists followers

Get Lists Followers

Get lists members

Get Lists Members

Get lists posts

Get Lists Posts

Get news

Get news stories by ID Each returned story includes a `url` deeplinking to its x.

Get posts by

Get Posts by ID Each returned post includes a `url` deeplinking to it on x.

Get posts by ids

Get Posts by IDs Each returned post includes a `url` deeplinking to it on x.

Get posts counts recent

Get Posts Counts Recent

Get posts liking users

Get Posts Liking Users

Get posts quoted posts

Get Posts Quoted Posts Each returned post includes a `url` deeplinking to it on x.

Get posts reposted by

Get Posts Reposted by

Get scheduled broadcast

Get a scheduled broadcast

Get scheduled call

Get a scheduled call

Get source

Get a stream source

Get spaces by creator ids

Get Spaces by Creator IDs

Get spaces by

Get Spaces by ID

Get spaces by ids

Get Spaces by IDs

Get spaces posts

Get Space Posts

Get trends by woeid

Get Trends by Woeid Each returned trend includes a `url` deeplinking to its x.

Get usage credits

Get usage credits

Get users bookmark folders

Get Users Bookmark Folders

Get users bookmarks

Get Users Bookmarks Each returned post includes a `url` deeplinking to it on x.

Get users bookmarks by folder

Get Users Bookmarks by Folder ID Each returned post includes a `url` deeplinking to it on x.

Get users by

Get Users by ID

Get users by username

Get Users by Username

Get users by usernames

Get Users by Usernames

Get users followed lists

Get Users Followed Lists

Get users liked posts

Get Users Liked Posts Each returned post includes a `url` deeplinking to it on x.

Get users list memberships

Get Users List Memberships

Get users me

Get Users Me

Get users me followers

Get the authenticated user's followers

Get users me following

Get the users the authenticated user follows

Get users mentions

Get Users Mentions Each returned post includes a `url` deeplinking to it on x.

Get users owned lists

Get Users Owned Lists

Get users pinned lists

Get Users Pinned Lists

Get users posts

Get Users Posts Each returned post includes a `url` deeplinking to it on x.

Get users public key

Get public keys

Get users public keys

Get public keys

Get users timeline

Get Users Timeline Each returned post includes a `url` deeplinking to it on x.

Go live scheduled broadcast

Go live on a scheduled broadcast

List broadcasts

List broadcasts

List scheduled broadcasts

List scheduled broadcasts

List scheduled calls

List scheduled calls

List sources

List stream sources

Mark chat conversation read

Mark Conversation as Read

Mark chat conversation unread

Mark Conversation as Unread

Mute broadcast chat user

Mute or time out a user in a broadcast chat

Pin list

Pin List

Remove chat moderator

Remove a chat moderator

Remove lists member by user

Remove a List member

Respond to scheduled call

Respond to a scheduled call

Schedule call

Schedule a call

Search communities

Search Communities

Search news

Search News Each returned story includes a `url` deeplinking to its x.

Search posts all

Search Posts All Each returned post includes a `url` deeplinking to it on x.

Search spaces

Search Spaces

Search users

Search Users

Send chat message

Send Chat Message

Send chat typing indicator

Send Typing Indicator

Unarchive chat conversation

Unarchive a Chat conversation

Unfollow list

Unfollow a List

Unmute broadcast chat user

Unmute a user in a broadcast chat

Unpin list

Unpin a List

Update lists

Update List

Update scheduled broadcast

Update a scheduled broadcast

Update scheduled call

Update a scheduled call

Update source

Rename a stream source

SETUP GUIDE

Connect X MCP Tool with your Agent

1

Install Composio

typescript
npm install @composio/core ai @ai-sdk/mcp @ai-sdk/openai
Install the Composio SDK and your agent framework
2

Create a session with MCP enabled

typescript
import { Composio } from "@composio/core";

const composio = new Composio();
const { mcp } = await composio.create("your-user-id", {
  toolkits: ["x_mcp"],
  mcp: true,
});
Create a session scoped to X MCP and read its MCP URL and headers
3

Connect your agent to the MCP server

typescript
import { createMCPClient } from "@ai-sdk/mcp";
import { openai } from "@ai-sdk/openai";
import { generateText, stepCountIs } from "ai";

const client = await createMCPClient({
  transport: { type: "http", url: mcp.url, headers: mcp.headers },
});

const { text } = await generateText({
  model: openai("gpt-5.6-sol"),
  tools: await client.tools(),
  prompt: "Search X for recent posts about AI agents from the past week.",
  stopWhen: stepCountIs(10),
});

console.log(text);
await client.close();
Pass the session's MCP URL and headers to your agent and run a X MCP request
SETUP GUIDE

Connect X MCP API Tool with your Agent

1

Install Composio

typescript
npm install @composio/core @composio/openai openai
Install the Composio SDK, the OpenAI provider, and the OpenAI SDK
2

Create a Composio session

typescript
import OpenAI from "openai";
import { Composio } from "@composio/core";
import { OpenAIResponsesProvider } from "@composio/openai";

const composio = new Composio({ provider: new OpenAIResponsesProvider() });
const client = new OpenAI();

const session = await composio.create("your-user-id", { toolkits: ["x_mcp"] });
const tools = await session.tools();
Initialize Composio with the OpenAI Responses provider and create a session scoped to X MCP
3

Run X MCP tools with your agent

typescript
let response = await client.responses.create({
  model: "gpt-5.6-sol",
  tools,
  input: [{ role: "user", content: "Search X for recent posts about AI agents from the past week." }],
});

while (response.output.some((o) => o.type === "function_call")) {
  const outputs = await composio.provider.handleToolCalls(session, response.output);
  response = await client.responses.create({
    model: "gpt-5.6-sol",
    tools,
    previous_response_id: response.id,
    input: outputs,
  });
}

console.log(response.output_text);
Send a request, execute the X MCP tool calls through the session, and print the final answer

Why Use Composio?

AI Native X MCP Integration

  • Supports X MCP and direct API-based integrations
  • Structured, LLM-friendly schemas for reliable X tool execution
  • Rich coverage for searching posts, users, news, trends, Spaces, and communities

Managed Auth

  • Built-in OAuth handling with automatic token refresh and rotation
  • Central place to manage, scope, and revoke X MCP access
  • Per-user and per-environment credentials instead of hard-coded keys

Agent Optimized Design

  • Tools are tuned using real error and success rates to improve reliability over time
  • Comprehensive execution logs so you always know what ran, when, and on whose behalf

Enterprise Grade Security

  • Fine-grained RBAC so you control which agents and users can access X MCP
  • Scoped, least-privilege access to X posts, accounts, lists, bookmarks, chats, and drafts
  • Full audit trail of agent actions to support review and compliance
FRAMEWORKS

Use X MCP with any AI Agent Framework

Choose a Framework you want to connect X MCP with

Rolling this out across your team?

Give your team centralized access control across every framework with Composio’s MCP Gateway.

EXPLORE MCP GATEWAY
FAQ

Frequently asked questions

X requires connections to go through your own OAuth app. You register it once with X, add its client ID and secret in the Composio dashboard, and from then on everyone connects by signing in to X as usual. Composio handles the rest of the flow and the token refresh.

Yes! Composio's Tool Router enables agents to use multiple toolkits. Learn more.

Yes. Composio is SOC 2 Type II compliant and is built to keep your X connection and credentials secure. OAuth tokens and API keys are encrypted, and sensitive customer data is protected at rest and in transit.

Composio also undergoes independent security testing and continuously monitors its systems for security threats. You can review the latest reports and policies in the Composio Trust Center.

Composio maintains and updates all toolkit integrations automatically, so your agents always work with the latest API versions.

When you connect a X account through Composio, every action runs under that account, so anything the agent creates, sends, or changes shows up in X as done by you. Keep an approval step in your prompt for actions with side effects, such as sending or deleting, and have the agent draft first.

Exactly the ones X lists on its consent screen when you connect. Review that screen before approving. If you connect a work account, your X administrator may need to approve the app first, and you can revoke the access inside X whenever you want.

Yes. Composio supports multiple connected accounts for the same app, and that works in Claude, ChatGPT, or any other assistant you connect through Composio. Give each X connection a name such as work or personal, and the assistant uses the one you mention in the request. Each account keeps its own credentials and nothing is merged.

Composio refreshes X tokens automatically, so day to day you do nothing. If you revoke access inside X, or X invalidates the session, the connection shows as expired in Composio and the agent stops acting on that account until you reconnect it, which is a single sign-in.

Composio's free Hobby plan includes 100,000 tool calls per month with no credit card, which covers most personal X use. Paid plans add higher limits and team features. Your X plan and its API limits still apply as usual.

Built-in connectors usually give one AI access to a limited set of apps. Many people use Composio because it lets their AI connect to more apps than it normally supports, or connect to multiple accounts for the same app (e.g. connect Claude to multiple X accounts).

With Composio, you connect X once and then use it across different AI assistants without setting it up separately in each one. Connect your apps to Composio once, then connect Composio to whichever AI you use, whether that's Claude, ChatGPT, Hermes, or your own custom assistant.

Start with X MCP.It takes 30 seconds.

Managed auth, hosted MCP servers, and every X MCP tool your agent needs.Free to start.

Start building