Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to the Twitter MCP server

Vendor MCP
Open markdown

The Twitter MCP connector routes your AI agent's tool calls to Twitter's own MCP server through Scalekit. Each user signs in to Twitter once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 100 tools.

Tools
100
What they doRead · write · destructive
59 · 27 · 1459 read27 write14 destructive
Users sign in with
OAuth app
Your own Twitter MCP server app

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Twitter MCP connection

    In AgentKit > Connections, create a Twitter MCP connection and copy its redirect URI. The name you give it is the connection_name your code passes. See Configure connections.

  4. Register an OAuth app

    Twitter MCP server connections use your own OAuth app. Register one with Twitter MCP server and add the redirect URI you copied.

    Then enter the app's Client ID and Client Secret on the Twitter MCP connection.

    Console steps with screenshots

    Twitter MCP uses your own X app. Register the app’s OAuth 2.0 credentials with Scalekit so it can run the authorization flow and manage token refresh for your users. You’ll need a Client ID and Client Secret from an app in the X Developer Console.

    1. Create a Twitter MCP connection in Scalekit

      • In the Scalekit dashboard, go to AgentKit > Connections > Create Connection. Search for Twitter MCP and click Create.

      • In the Configure Twitter MCP Connection panel, copy the Redirect URI. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback. You’ll paste it into your X app in the next step.

    2. Choose or create an app in the X Developer Console

      • Go to the X Developer Console and sign in.

      • Under Access > Apps, select an existing app or click + Create App.

        X Developer Console Create New Client Application dialog

    3. Configure user authentication settings

      • Open your app, go to Settings, and find User authentication settings.

      • Set the following values:

        SettingValue
        App permissionsRead and Write. Needed to post and manage content on behalf of users
        Type of AppWeb App, Automated App or Bot
        Callback URI / Redirect URLThe Redirect URI from Scalekit
        Website URLYour application’s public homepage

        X app authentication settings showing App permissions, Type of App, and Callback URI fields

      • Click Save.

    4. Copy the OAuth 2.0 credentials

      • In your app, open the Keys & Tokens tab.

      • Under OAuth 2.0 Keys, copy the Client ID. If you haven’t generated a Client Secret yet, click Regenerate next to it, then copy it.

        X app Keys and Tokens tab with the key values redacted

    5. Add the credentials in Scalekit

      • In the Scalekit dashboard, go to AgentKit > Connections and open the Twitter MCP connection you created.

      • Enter your credentials:

        • Client ID: from the OAuth 2.0 Keys section

        • Client Secret: copied in the previous step

        • Scopes: select the permissions your agent needs. Twitter MCP supports these scopes:

          ScopeAllows
          tweet.readRead posts
          tweet.writePost and delete posts
          users.readRead user profiles
          follows.readRead followers and following
          space.readRead Spaces information
          mute.readRead muted accounts
          like.readRead liked posts
          list.readRead Lists
          list.writeCreate and manage Lists
          block.readRead blocked accounts
          block.writeBlock and unblock users
          bookmark.readRead bookmarked posts
          bookmark.writeBookmark and unbookmark posts
          dm.readRead direct messages
          dm.writeSend direct messages
          calls.readRead calls
          calls.writeCreate and manage calls
          broadcast.readRead broadcasts
          broadcast.writeCreate and manage broadcasts
          media.writeUpload media
          developer.writeManage developer account resources
          developer.billing.writeManage developer account billing
          offline.accessGet refresh tokens for long-term access
      • Click Save.

  5. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'twittermcp'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Twitter MCP:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'twittermcp_get_users_me',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user signs in once. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • twittermcp_chat_media_downloadDownloads encrypted media bytes from an XChat conversation.Read-only

    Chat Media Download

    Downloads encrypted media bytes from an XChat conversation. The response body contains raw binary bytes. Returns JSON with the response bytes base64-encoded in `data`, plus `content_type` and `size_bytes`. Needs the OAuth2 scope `media.write`.

    Inputs

    idstringrequired
    No description.
    media_hash_keystringrequired
    No description.
  • twittermcp_get_broadcastReturns a broadcast owned by the authenticated user.Read-only

    Get Broadcast

    Returns a broadcast owned by the authenticated user.

    Inputs

    idstringrequired
    The ID of the broadcast to retrieve.
    broadcast.fieldsstring
    A comma separated list of Broadcast fields to display.
  • twittermcp_get_broadcast_chatReturns newest-first chat messages for a broadcast owned by the authenticated user.Read-only

    Get Broadcast Chat

    Returns newest-first chat messages for a broadcast owned by the authenticated user.

    Inputs

    idstringrequired
    ID of the broadcast whose chat messages to return. The broadcast must be owned by the authenticated user.
    broadcast_chat_message.fieldsstring
    A comma separated list of BroadcastChatMessage fields to display.
    expansionsstring
    A comma separated list of fields to expand.
    max_resultsinteger
    Maximum number of chat messages to return.
    pagination_tokenstring
    A 64-bit signed integer.
    user.fieldsstring
    A comma separated list of User fields to display.
  • twittermcp_get_chat_conversationReturns metadata for a Chat conversation including type, muted status, group details, and your unread state.Read-only

    Get Chat Conversation

    Returns metadata for a Chat conversation including type, muted status, group details, and your unread state. For the unread state, request chat_conversation.fields=unread,last_read_event_id,newest_event_id: those fields give your read state, computed from your latest read receipt and the conversation's latest notifying message. Use chat_conversation.fields to select which fields are returned. Use expansions to hydrate member, admin, or participant user objects. Use user.fields to control which profile fields are returned for expanded users.

    Inputs

    idstringrequired
    ID of the Chat conversation to retrieve metadata for.
    chat_conversation.fieldsstring
    A comma separated list of ChatConversation fields to display.
    expansionsstring
    A comma separated list of fields to expand.
    user.fieldsstring
    A comma separated list of User fields to display.
  • twittermcp_get_chat_conversation_eventsRetrieves the events of a specific Chat conversation, newest first, with pagination support: messages, key changes, group changes, and read receipts.Read-only

    Get Chat Conversation Events

    Retrieves the events of a specific Chat conversation, newest first, with pagination support: messages, key changes, group changes, and read receipts. Events with an id above the conversation's last_read_event_id are unread: they come after the point you read up to. To collect them, page until an event's id is at or below it. Only `id` and `encoded_event` are always present. Events are either end-to-end encrypted or unencrypted, such as messages sent before the conversation was encrypted. Encrypted events carry `conversation_key_version`, and usually `conversation_token` and `message_event_signature`; treat an encrypted event without `message_event_signature` as unverified. An event without `conversation_key_version` is unencrypted. Decode each `encoded_event` client-side, and decrypt it with the conversation key named by `conversation_key_version` when that is present. A page holds up to `max_results` events and can hold fewer while `has_more` is true. For 1:1 conversations, provide the recipient's user ID; the server constructs the canonical conversation ID from the authenticated user and recipient.

    Inputs

    idstringrequired
    No description.
    chat_message_event.fieldsstring
    A comma separated list of ChatMessageEvent fields to display.
    max_resultsinteger
    The maximum number of events to return.
    pagination_tokenstring
    The next_token from a previous response, to fetch the next page.
  • twittermcp_get_chat_conversationsRetrieves a list of Chat conversations for the authenticated user's inbox, newest first: the most recently active conversation comes first.Read-only

    Get Chat Conversations

    Retrieves a list of Chat conversations for the authenticated user's inbox, newest first: the most recently active conversation comes first. The unread, last_read_event_id and newest_event_id fields give your read state, computed from your latest read receipt and each conversation's latest notifying message. Request them with chat_conversation.fields=unread,last_read_event_id,newest_event_id. The filters unread_only, type, is_archived, is_muted, participant_ids, participant_query, start_time and end_time are optional, and all filters must match (AND). participant_query keeps conversations where another participant's username, or a word of their display name, starts with the query, ignoring case and accents; with a leading @ it matches usernames only. It considers the 100 people who best match the query, uses only public profile information, and never matches group names, nicknames or messages. start_time and end_time apply to the time of each conversation's latest message. Each page covers max_results conversations and returns those that match, so a page can hold fewer than max_results, or none, while meta.next_token is set and has_more is true: keep paging, passing meta.next_token as pagination_token. Once a page reaches a conversation whose latest message is older than start_time, has_more is false. A pagination_token only works with the same filters as the request that returned it; with other filters, the request fails with a 400. When both are provided, `start_time` must be earlier than `end_time`.

    Inputs

    chat_conversation.fieldsstring
    A comma separated list of ChatConversation fields to display.
    end_timestring
    ISO 8601, e.g. 2026-10-17T00:00:00Z. Chats whose latest message is before this time.
    expansionsstring
    A comma separated list of fields to expand.
    is_archivedboolean
    true: only archived; false: only not archived. Omit for both.
    is_mutedboolean
    true: only muted; false: only not muted. Omit for both.
    max_resultsinteger
    Conversations covered per page (1-1000, default 200). Filtered pages can return fewer.
    pagination_tokenstring
    meta.next_token from the previous page. Send the same filters with it, or the request fails.
    participant_idsstring
    Comma-separated numeric user IDs (1-10), all in the chat. Names or @handles: use participant_query.
    participant_querystring
    Name or @username prefix (1-50 chars); keeps chats where any other participant matches it.
    start_timestring
    ISO 8601, e.g. 2026-10-16T00:00:00Z. Chats whose latest message is at or after this time.
    typestring
    Only direct (1:1) or only group conversations. Omit for both.one of directgroup
    unread_onlyboolean
    Return only unread conversations. A page can be short; keep paging while has_more.
    user.fieldsstring
    A comma separated list of User fields to display.
  • twittermcp_get_chat_message_requestRetrieves the message request state of a 1:1 Chat conversation and its newest message events.Read-only

    Get Chat Message Request

    Retrieves the message request state of a 1:1 Chat conversation and its newest message events. Like opening the request in an X app, reading it marks the returned messages as delivered and updates the unread badge.

    Inputs

    idstringrequired
    The other user's ID, or both user IDs joined by a hyphen.
    chat_message_request_detail.fieldsstring
    A comma separated list of ChatMessageRequestDetail fields to display.
  • twittermcp_get_chat_message_requestsRetrieves the authenticated user's pending Chat message requests from one inbox.Read-only

    Get Chat Message Requests

    Retrieves the authenticated user's pending Chat message requests from one inbox. Message contents are end-to-end encrypted unless the conversation is unencrypted. Accepting or deleting requests between pages can skip or repeat requests, and a page can be empty while `next_token` is set.

    Inputs

    chat_message_request.fieldsstring
    A comma separated list of ChatMessageRequest fields to display.
    inbox_typestring
    Which message request inbox to list: `you_may_know` (the apps' Priority tab) or `low_quality` (th...one of you_may_knowlow_quality
    max_resultsinteger
    The maximum number of message requests to return.
    pagination_tokenstring
    The next_token from a previous response, to fetch the next page.