mcpField
T
twitterapi

twitterapi

Local
github.com/pedrot95devSocial Media0Updated 17w ago

About twitterapi

twitterapi is an MCP server that exposes twitterapi.io to AI agents and MCP hosts for reading X mentions and thread context, and creating or deleting tweets. Read actions need an API key; write actions also require account cookies and a proxy.

Key features

  1. 01Fetch and paginate user mentions
  2. 02Retrieve tweet conversation context
  3. 03Create tweets or replies
  4. 04Delete your own tweets

Use cases

  1. 01Review mentions of a user
  2. 02Inspect a tweet's conversation and replies
  3. 03Publish a tweet, quote, or reply
  4. 04Delete a specific owned tweet

MCP support

The MCP server provides clients with tools to fetch mentions and thread context, create tweets, and delete tweets.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"pedrot95dev-twitterapi": {
"command": "npx",
"args": [
"-y",
"@pedrot95dev/twitterapi.mcp"
],
"env": {
"TWITTERAPI_IO_KEY": "<TWITTERAPI_IO_KEY>",
"TWITTERAPI_IO_AUTH_TOKEN": "<TWITTERAPI_IO_AUTH_TOKEN>",
"TWITTERAPI_IO_CT0": "<TWITTERAPI_IO_CT0>",
"TWITTERAPI_IO_PROXY": "<TWITTERAPI_IO_PROXY>"
}
}
}
}
Run commandnpx -y @pedrot95dev/twitterapi.mcp
Environment variables to set
TWITTERAPI_IO_KEYSecrettwitterapi.io API key (x-api-key). Required for all tools.
TWITTERAPI_IO_AUTH_TOKENSecretauth_token cookie from a logged-in X session. Write tools only.
TWITTERAPI_IO_CT0Secretct0 cookie from the same logged-in X session. Write tools only.
TWITTERAPI_IO_PROXYSecretResidential proxy (http://user:pass@ip:port). Write tools only.

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@pedrot95dev/twitterapi.mcp0.1.2

Tools

4

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
limitintegerNoMax tweets to return from this single request (default 50)
cursorstringNoPagination cursor from a previous response's next_cursor
user_namestringYesX username, with or without @
query_typeenumNoSort mode (default Latest)Latest | Relevance
since_timestringNoStart time filter (e.g. 2025-06-01 or ISO datetime)
until_timestringNoEnd time filter

Details

From the project README

twitterapi.mcp

npm

MCP server that exposes twitterapi.io endpoints as tools for AI agents and MCP hosts. Written in TypeScript, distributed on npm, runnable with a single npx command.

Current Tools

ToolDescriptionAPI EndpointAuth
get_user_mentionsFetch tweets mentioning a user.GET /twitter/user/mentionsAPI key
get_tweet_thread_contextFetch a page of the conversation thread around a tweet.GET /twitter/tweet/thread_contextAPI key
create_tweetCreate a tweet or reply.POST /twitter/create_tweet_v2API key + cookies + proxy
delete_tweetDelete one of your tweets.POST /twitter/delete_tweet_v2API key + cookies + proxy

Quick Start

1. Get an API key

Visit https://twitterapi.io/dashboard and obtain your x-api-key.

2. Cookies + proxy for write actions

create_tweet and delete_tweet authenticate with your account's own session cookies. From a browser logged into X, open DevTools → Application → Cookies → https://x.com and copy the auth_token and ct0 values.

VariableRequiredDescription
TWITTERAPI_IO_KEYalwaystwitterapi.io API key
TWITTERAPI_IO_AUTH_TOKENwritesauth_token cookie from a logged-in X session
TWITTERAPI_IO_CT0writesct0 cookie from the same session
TWITTERAPI_IO_PROXYwritesResidential proxy, http://user:pass@ip:port (required by the write endpoints)

The server derives the login_cookies value twitterapi.io expects from auth_token + ct0. These cookies expire over time (typically weeks); when a write starts returning an auth error, refresh them from the browser.

The API key alone is enough for the read tools. Add the cookie/proxy vars only if you need write actions.

3. Add to your MCP host

Claude Desktop (%APPDATA%\Claude\claude_desktop_config.json on Windows, ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "twitterapi": {
      "command": "npx",
      "args": ["-y", "@pedrot95dev/twitterapi.mcp"],
      "env": {
        "TWITTERAPI_IO_KEY": "your_key_here",
        "TWITTERAPI_IO_AUTH_TOKEN": "your_auth_token_cookie",
        "TWITTERAPI_IO_CT0": "your_ct0_cookie",
        "TWITTERAPI_IO_PROXY": "http://user:pass@ip:port"
      }
    }
  }
}

npx -y @pedrot95dev/twitterapi.mcp downloads and runs the latest published version. Only Node.js (>= 18) is required — no global install needed.

Other MCP hosts (e.g. Cursor): add the same npx command + env vars in the host's MCP settings UI or config file.

Tool: get_user_mentions

Fetch tweets that mention or reply to a user. Makes a single request per call; page by passing cursor from a previous response's next_cursor.

ParameterTypeDefaultDescription
user_namestring(required)X username, with or without @
since_timestring—Start time filter (e.g. 2025-06-01 or ISO datetime)
until_timestring—End time filter
cursorstring—Pagination cursor from a previous next_cursor
query_type"Latest" | "Relevance""Latest"Sort mode
limitinteger50Max tweets to return from this single request
{
  "tweets": [ ... ],
  "count": 12,
  "has_next_page": true,
  "next_cursor": "DAADDAAB...",
  "status": "success",
  "msg": null
}

Tool: get_tweet_thread_context

Fetch the conversation thread around a tweet. Returns the original tweet, the intermediate replies up the chain, the tweet itself, and its direct replies. Each returned tweet includes entities.urls with expanded links — useful for scanning a mention's surrounding conversation for URLs.

Makes exactly one request per call (1-to-1 with the endpoint — no internal pagination). Page through longer threads with cursor.

ParameterTypeDefaultDescription
tweet_idstring(required)The tweet ID to get the thread context for
cursorstring—Pagination cursor from a previous next_cursor
{
  "tweets": [ ... ],
  "count": 6,
  "has_next_page": false,
  "next_cursor": "",
  "status": "success",
  "msg": "success"
}

Note: this endpoint paginates unevenly — a page may return few or zero tweets while has_next_page is still true. Follow next_cursor until has_next_page is false to collect the whole thread.

Tool: create_tweet

Post a new tweet or reply. Supports quotes, media, communities, and scheduling. Requires the cookie + proxy env vars (see step 2).

ParameterTypeDefaultDescription
tweet_textstring(required)The text content of the tweet
reply_to_tweet_idstring—Tweet ID to reply to (makes this a reply)
quote_tweet_idstring—Tweet ID to quote
attachment_urlstring—URL for quote (alternative to quote_tweet_id)
community_idstring—Post inside a specific community
is_note_tweetbooleanfalseAllow >280 chars (Premium accounts)
media_idsstring[]—Media IDs from a prior /twitter/upload_media_v2
schedule_forstring—ISO-8601 future time, e.g. 2026-01-20T10:00:00.000Z
{ "tweet_id": "1234567890123456789", "status": "success", "msg": "success" }

Tool: delete_tweet

Delete one of your tweets by ID. Requires the cookie + proxy env vars.

ParameterTypeDefaultDescription
tweet_idstring(required)The ID of the tweet to delete
{ "status": "success", "msg": "success" }

Contributing

Local development, build, and testing instructions are in CONTRIBUTING.md.

License

MIT — see LICENSE.

Credits

Based on the official twitterapi-io agent skill: https://github.com/kaitoInfra/twitterapi-io API service: https://twitterapi.io

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.