Skip to main content
Glama
TwitterAPI.io MCP Server

TwitterAPI.io MCP Server

Official
README.md
# TwitterAPI.io MCP Server

[![npm version](https://img.shields.io/npm/v/@twitterapi_io/mcp-server.svg)](https://www.npmjs.com/package/@twitterapi_io/mcp-server)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![MCP Compatible](https://img.shields.io/badge/MCP-Streamable%20HTTP%20%26%20stdio-green)](https://modelcontextprotocol.io)

**Official TwitterAPI.io MCP Server — Independent real-time X data API by [twitterapi.io](https://twitterapi.io/?utm_source=github_mcp).**

Connect **Cursor**, **Claude Code**, **Claude Desktop**, **Windsurf**, or **VS Code Copilot** to real-time X/Twitter data — search tweets with advanced operators, look up user profiles, inspect followers, read reply threads, quote-tweets, retweeters, and regional trends directly from natural language.

> **Disclaimer**: TwitterAPI.io is an independent third-party real-time data API and is not affiliated with, endorsed by, or sponsored by X Corp.

---

## Quick Start (30 Seconds)

### 1. Get a Free API Key

Sign up at **[twitterapi.io](https://twitterapi.io/?utm_source=github_mcp)** — new accounts include starter trial credits with pay-as-you-go pricing (`$0.15 / 1,000 tweets`, no monthly minimum).

### 2. Connect Your Client

#### Option A — Hosted Remote MCP (Streamable HTTP, Zero Install)

**Claude Code:**
```bash
claude mcp add --transport http twitterapi-io https://mcp.twitterapi.io/mcp \
  --header "Authorization: Bearer YOUR_TWITTERAPI_IO_API_KEY"
```

**Cursor (`~/.cursor/mcp.json`):**
```json
{
  "mcpServers": {
    "twitterapi-io": {
      "url": "https://mcp.twitterapi.io/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_TWITTERAPI_IO_API_KEY"
      }
    }
  }
}
```

#### Option B — Local stdio MCP via `npx`

**Claude Code:**
```bash
claude mcp add -e TWITTERAPI_IO_API_KEY=YOUR_TWITTERAPI_IO_API_KEY \
  twitterapi-io -- npx -y @twitterapi_io/mcp-server
```

**Cursor / Claude Desktop:**
```json
{
  "mcpServers": {
    "twitterapi-io": {
      "command": "npx",
      "args": ["-y", "@twitterapi_io/mcp-server"],
      "env": {
        "TWITTERAPI_IO_API_KEY": "YOUR_TWITTERAPI_IO_API_KEY"
      }
    }
  }
}
```

See [docs/client-setup.md](docs/client-setup.md) for Windsurf, VS Code Copilot, and MCP Inspector setup.

---

## Available Tools (12 Read-Only Endpoints)

Responses are compacted (~25x smaller than raw payloads) so 20-tweet pages fit cleanly inside LLM context windows while preserving `has_next_page` and `next_cursor`.

| Tool | REST Endpoint | Description |
|---|---|---|
| `search_tweets` | `GET /twitter/tweet/advanced_search` | Advanced search with full operators (`from:`, `since:`, `until:`, `lang:`, `has:`, `min_faves:`) |
| `get_user_info` | `GET /twitter/user/info` | Basic user profile, bio, verification, and follower counts |
| `get_user_about` | `GET /twitter/user_about` | Extended profile metadata |
| `get_user_followers` | `GET /twitter/user/followers` | Paginated followers list with compact profile metadata (up to 200/page) |
| `get_user_followings` | `GET /twitter/user/followings` | Paginated following list (up to 200/page) |
| `get_user_last_tweets` | `GET /twitter/user/last_tweets` | Most recent tweets from a user by handle or numeric ID |
| `get_user_mentions` | `GET /twitter/user/mentions` | Tweets mentioning `@userName` with optional Unix timestamp bounds |
| `get_tweets_by_ids` | `GET /twitter/tweets` | Batch lookup up to **50** tweets by comma-separated IDs |
| `get_tweet_replies` | `GET /twitter/tweet/replies/v2` | Replies to a tweet (`Latest` or `Top`) |
| `get_tweet_quotes` | `GET /twitter/tweet/quotes` | Quote-tweets referencing a tweet ID |
| `get_tweet_retweeters` | `GET /twitter/tweet/retweeters` | Users who retweeted a specific tweet |
| `get_trends` | `GET /twitter/trends` | Current trending topics by Yahoo WOEID (`1` = Worldwide) |

Full parameter schemas, response shapes, and `curl`/Python/TypeScript examples:
- [docs/endpoints.md](docs/endpoints.md)
- [docs/search-operators.md](docs/search-operators.md)
- [docs/client-setup.md](docs/client-setup.md)

---

## Example Prompts

- *"Search for original English tweets about Model Context Protocol with at least 25 likes since 2026-11-01."*
- *"Fetch profile metrics and the 20 most recent posts for @openai, excluding replies."*
- *"Pull top replies and quote-tweets for tweet ID `1850000000000000001` and summarize developer sentiment."*
- *"What are the top 10 trending topics in Japan (`woeid=23424856`) right now?"*

---

## Security & Scope

- **Read-only by design**: Write operations (posting, liking, following, DMs, account settings) are intentionally excluded for safe autonomous agent use.
- **No key persistence**: `TWITTERAPI_IO_API_KEY` is read strictly from environment variables (or Bearer auth on Remote MCP) and sent directly to `https://api.twitterapi.io`.
- **Automatic resiliency**: Exponential backoff retries (`1s` / `2s` / `4s`) on `429` and `5xx` responses with `30s` per-request timeout.

## Local Development

```bash
git clone https://github.com/twitterapi-io/twitterapi-mcp.git
cd twitterapi-mcp
npm install
npm test
npm run build
```

## Links

- [TwitterAPI.io Homepage & Free Trial](https://twitterapi.io/?utm_source=github_mcp)
- [TwitterAPI.io Hosted MCP Overview](https://twitterapi.io/twitter-mcp-server?utm_source=github_mcp)
- [Full REST API Documentation](https://docs.twitterapi.io/?utm_source=github_mcp)
- Support: `hello@twitterapi.io`

## License

MIT © 2026 TwitterAPI.io

TDQS

A3.8/5.0

Scored across 12 tools

Disambiguation4/5

Each tool targets a distinct resource+action (tweet retweeters, replies, quotes, user followers, trends, batch tweet lookup). The potentially overlapping pair search_tweets/get_user_last_tweets is explicitly disambiguated in descriptions, and get_user_info vs get_user_about is clarified (basic vs extended metadata), though 'about' remains slightly vague.

Naming Consistency5/5

All twelve tools follow a uniform 'get_<resource>' snake_case pattern with consistent verb-noun structure. Resources are clearly named (tweet, user, trends), making the read-only nature predictable throughout.

Tool Count5/5

Twelve tools is well-scoped for a Twitter read API, with each tool covering a meaningful endpoint (search, retweeters, replies, quotes, followers, trends). No redundant or filler tools are present.

Completeness4/5

The read-only surface is thorough: tweet search/batch/replies/quotes/retweeters, user profiles/followers/followings/mentions, and trends. Minor gaps exist (e.g., single user search by keyword, list-membership retrieval), but core read workflows are fully covered.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues