- Home
- MCP servers
- Twitter API
Twitter API
- typescript
0
GitHub Stars
typescript
Language
5 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"jing-yilin-twitterapi-mcp-server": {
"command": "npx",
"args": [
"-y",
"twitterapi-mcp-server"
],
"env": {
"PROXY_URL": "http://proxy.company.com:8080",
"HTTP_PROXY": "http://proxy.example.com:8080",
"HTTPS_PROXY": "https://proxy.example.com:8443",
"TWITTERAPI_API_KEY": "your_api_key_here"
}
}
}
}You can access Twitter data through TwitterAPI.io using this MCP server. It exposes user information, tweets, and write actions via a stable MCP interface, enabling clients like Claude to interact with Twitter data without needing Twitter developer approval. This guide shows practical steps to use, install, configure, and troubleshoot the server so you can start querying and posting content through MCP clients.
How to use
You will connect an MCP client to the TwitterAPI MCP Server to perform common actions such as fetching user details, reading timelines, searching tweets, and posting tweets when you are logged in. Use the available tools to request data like user profiles, followers, and timelines, or to create new tweets and engage with content. All list endpoints support cursor-based pagination, so you can navigate large result sets step by step.
How to install
Prerequisites: you need Node.js (version 18 or newer) and npm or an alternative package manager. You will run the MCP server using npx or a local installation.
# Quick Start with npx (recommended)
npx twitterapi-mcp-server
# Global installation
npm install -g twitterapi-mcp-server
# Local installation
npm install twitterapi-mcp-server
Configuration
To authenticate with the TwitterAPI.io service, you must provide your API key. The server reads configuration from environment variables. Set the required API key and optional proxy settings as shown.
{
"mcpServers": {
"twitterapi": {
"command": "npx",
"args": ["-y", "twitterapi-mcp-server"],
"env": {
"TWITTERAPI_API_KEY": "your_api_key_here"
}
}
}
}
Usage configuration for clients
You can configure your MCP client to connect to the server using either a local npx-based command or a direct Node.js invocation. The examples below show two common approaches that you can adapt to your environment.
{
"mcpServers": {
"twitterapi": {
"command": "npx",
"args": ["-y", "twitterapi-mcp-server"],
"env": {
"TWITTERAPI_API_KEY": "your_api_key_here"
}
}
}
}
Examples of common actions
After you have the server running and your client configured, you can perform typical actions such as retrieving user details, listing followers, searching tweets, and posting content when you are logged in.
When you are ready to start the server via Node directly, you can point to the built entry point as shown.
Security and best practices
Store your API keys as environment variables and never hard-code them. Use HTTPS for all requests. If you operate within an enterprise network, you can enable a proxy by setting the appropriate proxy environment variables.
Troubleshooting
If you encounter authentication or quota issues, verify that your TWITTERAPI_API_KEY is correctly set. For proxy-related problems, ensure the proxy URL is valid and reachable.
Pagination and pricing notes
List endpoints return paginated results with a next_cursor field. Use the cursor you receive to fetch the next page. Pricing is handled through TwitterAPI.io with per-call charges; monitor credits on your dashboard and plan requests accordingly.
Development and testing
If you develop or test locally, you can build and run tests as part of your workflow. Ensure you have Node.js 18+ installed, then install dependencies, build, and run tests as described in your project workflow.
Available tools
get_user_by_username
Fetch detailed user information by username
get_user_by_id
Fetch detailed user information by user ID
get_user_followers
Retrieve a user's followers with pagination
get_user_following
Retrieve users followed by a specific user with pagination
search_users
Search users by keyword
get_user_tweets
Get tweets from a user, with optional replies
search_tweets
Search tweets by keywords with optional type (Latest/Top)
get_tweet_by_id
Get details for specific tweets by their IDs
get_tweet_replies
Get replies to a specific tweet
login_user
Authenticate a user to enable write actions
create_tweet
Post new tweets or replies