Skip to main content
Glama
twitterapi-io-mcp-server

twitterapi-io-mcp-server

by kaitoInfra

twitterapi.io MCP Server

npm version MIT License MCP Spec 2025-11-25

Official Model Context Protocol server for twitterapi.io — Twitter / X data API for AI agents and applications.

Connect Claude Desktop, Cursor, VS Code Copilot, or any MCP client to twitterapi.io and search tweets, fetch user profiles, get followers, replies, trends, and more — all from natural language.

Features

12 read-only tools mapped 1:1 to twitterapi.io's verified production endpoints:

Tool

What it does

search_tweets

Advanced search with Twitter operators (from:, since:, lang:, has:, …)

get_user_info

User profile basics by screen name

get_user_about

Extended profile / about page

get_user_followers

Followers with full profile metadata (paginated)

get_user_followings

Following list with profile metadata (paginated)

get_user_last_tweets

A user's recent tweets (timeline)

get_user_mentions

Tweets that mention a user

get_tweets_by_ids

Batch fetch tweets by ID (up to 100)

get_tweet_replies

Replies to a tweet

get_tweet_quotes

Quote-tweets of a tweet

get_tweet_retweeters

Users who retweeted a tweet

get_trends

Trending topics by location (WOEID)

Related MCP server: X MCP Server

Quick Start

1. Get an API key

Sign up at twitterapi.io — free tier available.

2. Configure your MCP client

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "twitterapi-io": {
      "command": "npx",
      "args": ["-y", "@twitterapi_io/mcp-server"],
      "env": {
        "TWITTERAPI_IO_API_KEY": "your_key_here"
      }
    }
  }
}

Restart Claude Desktop. The 12 tools will be available in any chat — Claude will pick the right one based on your prompt.

Cursor

Open Settings → MCP → Add new MCP Server:

{
  "mcpServers": {
    "twitterapi-io": {
      "command": "npx",
      "args": ["-y", "@twitterapi_io/mcp-server"],
      "env": {
        "TWITTERAPI_IO_API_KEY": "your_key_here"
      }
    }
  }
}

VS Code (Copilot Chat with MCP)

Add to your MCP servers config — same shape as Claude Desktop / Cursor.

Claude Code

claude mcp add twitterapi-io npx -- -y @twitterapi_io/mcp-server -e TWITTERAPI_IO_API_KEY=your_key_here

3. Use it

In any MCP-enabled chat:

"Find recent tweets from @elonmusk about AI in the last week"

"Get the follower list of @sama and show me the top 20 by follower count"

"What are the current trending topics in Japan?"

Claude (or your client) will automatically pick search_tweets / get_user_followers / get_trends and call them with the right parameters.

Authentication

Authentication is via the TWITTERAPI_IO_API_KEY environment variable, injected by your MCP client. The server never stores or logs the key. Each tool call sends the key in the X-API-Key header to https://api.twitterapi.io.

Pagination

Tools that return lists (followers, replies, search results, etc.) return a next_cursor field. Pass it back as the cursor argument on the next call to page through. Each page is typically ~20 items.

Error handling

  • 429 / 5xx responses are automatically retried with exponential backoff (3 attempts, 1s/2s/4s)

  • Network timeouts: 30s per request

  • 4xx errors (other than 429) surface immediately to the LLM with the original message

Tools — full spec

Each tool's input schema is exposed via MCP's tools/list and follows JSON Schema. Run npx @twitterapi_io/mcp-server with mcp-inspector to browse interactively:

npx @modelcontextprotocol/inspector npx -y @twitterapi_io/mcp-server

What's NOT included

By design, this server exposes read-only endpoints. The following are intentionally excluded to keep the server safe for autonomous agent use:

  • ❌ Posting tweets, likes, retweets, follows, DMs

  • ❌ Account login / 2FA

  • ❌ Profile / banner / avatar editing

  • ❌ Media upload

  • ❌ Account deletion

  • ❌ Realtime stream / webhook setup (does not fit the MCP request/response model)

These features are available in the full twitterapi.io REST API — use it directly if you need write access.

Spec compliance

  • Built on @modelcontextprotocol/sdk v1

  • Targets MCP spec 2025-11-25 (latest)

  • Transport: stdio (Streamable HTTP planned for v0.2+ for remote/hosted use)

  • Tested with: mcp-inspector, Claude Desktop, Cursor, Claude Code

Development

git clone https://github.com/kaitoInfra/twitterapi-io-mcp-server.git
cd twitterapi-io-mcp-server
npm install
npm run build
TWITTERAPI_IO_API_KEY=xxx npm run inspect  # opens mcp-inspector

License

MIT © twitterapi.io

Available Tools

12 tools
get_tweet_quotesAInspect

Fetch quote-tweets (tweets that quote the given tweetId). Useful for finding commentary on a tweet, measuring reach beyond direct replies. Supports time bounds (sinceTime/untilTime, Unix seconds). Paginates via cursor (~20 per page).

Inputs: tweetId (required), sinceTime, untilTime, includeReplies, +1 more.

get_tweet_repliesAInspect

Fetch replies to a specific tweet. Pass the numeric tweetId of the root tweet; returns top-level replies (about 20 per page) with full tweet objects. Use this for thread analysis, sentiment on a viral post, or building reply trees.

Inputs: tweetId (required), cursor, queryType.

get_tweet_retweetersAInspect

Fetch users who retweeted a specific tweet (the simple 'retweet' action, not quote-tweets — for those use get_tweet_quotes). Returns user profiles with metadata. Paginates via cursor (~100 per page).

Inputs: tweetId (required), cursor.

get_tweets_by_idsAInspect

Batch-fetch full tweet objects by their numeric tweet IDs. Pass a comma-separated string of up to 100 IDs. Use this when you already have specific tweet IDs (e.g., from a search result, a URL, or a webhook event) and need the full tweet data — author, text, engagement counts, media, etc.

Inputs: tweet_ids (required).

get_user_aboutAInspect

Fetch the extended 'about' / profile page data for a Twitter/X user by screen name. Returns extra profile metadata beyond what get_user_info gives (when available). Use get_user_info first; only call this if you need additional about-page fields.

Inputs: userName (required).

get_user_followersAInspect

Fetch followers of a Twitter/X user in reverse chronological order (newest first), each with full profile metadata (name, bio, follower count, verified status, etc.). Paginates via cursor. Use this to analyze who follows an account, build follower audiences, or sample for competitive analysis. For large accounts use pagination; you will not get all followers in one call.

Inputs: userName (required), cursor, pageSize.

get_user_followingsAInspect

Fetch the accounts a Twitter/X user follows, with full profile metadata. Paginates via cursor. Use this to map a user's interest graph (who they follow signals what they care about).

Inputs: userName (required), cursor, pageSize.

get_user_infoAInspect

Fetch basic profile info for a Twitter/X user by their screen name (handle). Returns user ID, display name, bio, follower/following counts, verified status, profile picture, banner, location, website, and account creation date. Use this as the starting point for any user analysis.

Inputs: userName (required).

get_user_last_tweetsAInspect

⚠️ ONLY for 'latest / recent / what's new' queries about a user. DO NOT use for date-range queries (e.g. 'tweets from January 2026', 'tweets last week', 'tweets between X and Y', 'tweets in 2025'). For specific dates / older tweets, use search_tweets with query like 'from:elonmusk since:2026-01-01 until:2026-02-01'.

Fetch the MOST RECENT tweets posted by a Twitter/X user, sorted by created_at descending (newest first). Provide EITHER userName (screen name, no @) OR userId (numeric). Use userId when known — handles can change. Set includeReplies=true to include the user's reply tweets in addition to top-level tweets. Paginates via cursor (~20 per page).

Inputs: userName, userId, cursor, includeReplies.

get_user_mentionsAInspect

Fetch tweets that mention a specific Twitter/X user (i.e. tweets containing @userName). Useful for brand monitoring, sentiment tracking on a public figure, or finding conversations involving an account. Supports time-bound queries via sinceTime/untilTime (Unix seconds). Paginates via cursor.

Inputs: userName (required), sinceTime, untilTime, cursor.

search_tweetsAInspect

🎯 PRIMARY CHOICE for date-range / historical / keyword-based tweet queries. Use this (NOT get_user_last_tweets) whenever user asks about a SPECIFIC TIME RANGE or historical tweets: • 'tweets from January 2026' → query='from:elonmusk since:2026-01-01 until:2026-02-01' • 'tweets between X and Y' → 'from:USER since:X until:Y' • 'tweets last week / last month' → translate to since:/until: dates • 'tweets containing keyword X by user Y' → 'from:Y X' • 'older tweets' / 'archive' / 'in 2025' → use date range, not pagination

Date format: YYYY-MM-DD (UTC midnight). 'until:' is exclusive (until:2026-02-01 = up to Jan 31).

General: Search Twitter/X for tweets matching a query. Supports the full Twitter advanced search syntax (from:, to:, since:, until:, lang:, filter:, has:, -, OR, etc). Returns ~20 tweets per page in reverse chronological order ('Latest') or by engagement ('Top'). Use this for keyword research, monitoring mentions of a brand/topic, finding tweets in a date range, or any open-ended tweet discovery.

Inputs: query (required), queryType (required), cursor.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 12 tools

    Disambiguation5/5

    Each tool targets a distinct entity and action: trends, tweet interactions (quotes, replies, retweeters, batch fetch), user details (info, about, followers, followings, last tweets, mentions), and search. Descriptions explicitly clarify boundaries, e.g., get_user_last_tweets vs. search_tweets for date queries.

    Naming Consistency5/5

    All tools follow the verb_noun pattern with prefixes 'get_' or 'search_'. The naming is predictable and clear: get_<entity>_<detail> for most, with search_tweets as a minor but acceptable variation.

    Tool Count5/5

    12 tools cover a comprehensive set of Twitter read operations without excess. The count is well-balanced, each tool serves a clear purpose, and the scope fits a focused Twitter data retrieval server.

    Completeness4/5

    The surface covers essential read operations: trends, tweet data, user profiles, followers/followings, mentions, and search. Minor gaps exist (e.g., no dedicated single tweet fetch or reply threading), but workarounds like get_tweets_by_ids and get_tweet_replies suffice.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A local MCP server that exposes the X API (formerly Twitter API) as tools, enabling operations like posting, searching, user management, and more via natural language commands.
      870
      -
    • A
      license
      A
      quality
      F
      maintenance
      A Model Context Protocol (MCP) server that provides access to Twitter data through the TwitterAPI.io service, enabling Claude and other MCP clients to interact with Twitter's ecosystem without requiring Twitter developer account approval.
      11
      4
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      MCP server for the Twitter/X API, enabling search, user profiles, tweets, followers, and more via natural language.
      94
      716 npm
      7
      MIT