mcpField
T
Twitter Client MCP

Twitter Client MCP

Local
github.com/mzkrasnerSocial Media6Updated 72w ago

About Twitter Client MCP

A Model Context Protocol server that gives clients access to Twitter operations through the `agent-twitter-client` library. It covers profile and tweet actions, search, and follower relationships, with credential-handling protections.

Key features

  1. 01Retrieve profiles and tweets
  2. 02Post, like, and retweet
  3. 03Search tweets and profiles
  4. 04List followers and following
  5. 05Follow users
  6. 06Isolate and sanitize credentials

Use cases

  1. 01Search for tweets or Twitter profiles
  2. 02Post a tweet or interact with a tweet
  3. 03Review a user's followers and following

MCP support

Exposes Twitter profile, tweet, search, and relationship tools to MCP clients. Twitter credentials are loaded by the server and protected from logging and LLM access.

Configuration

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

mcp.json · Universal config
{
"mcpServers": {
"twitter-client": {
"command": "npx",
"args": [
"-y",
"github:mzkrasner/twitter-client-mcp"
],
"env": {
"TWITTER_USERNAME": "<TWITTER_USERNAME>",
"TWITTER_PASSWORD": "<TWITTER_PASSWORD>",
"TWITTER_EMAIL": "<TWITTER_EMAIL>"
}
}
}
}
Run commandnpx -y github:mzkrasner/twitter-client-mcp
Environment variables to set
TWITTER_USERNAME
TWITTER_PASSWORDSecret
TWITTER_EMAIL

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
npmgithub:mzkrasner/twitter-client-mcp

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Twitter Client MCP

A Model Context Protocol (MCP) server that provides secure access to Twitter functionality through the agent-twitter-client library.

Features

The Twitter Client MCP provides the following capabilities:

  • Profile Operations

    • Get profile information by username
    • Get the authenticated user's profile
  • Tweet Operations

    • Get a specific tweet by ID
    • Get tweets from a user
    • Send new tweets
    • Like tweets
    • Retweet tweets
  • Search Operations

    • Search for tweets
    • Search for profiles
  • Relationship Operations

    • Get followers of a user
    • Get users that a user is following
    • Follow a user

Security ⚠️

IMPORTANT: TWITTER CREDENTIAL PROTECTION

This MCP server requires Twitter credentials to operate. To protect these sensitive credentials:

  1. NEVER share your credentials
  2. NEVER run commands that display your credentials
  3. NEVER allow the LLM to execute shell commands directly without your approval
Multiple Layers of Protection

This server implements several layers of security to keep your credentials safe:

1. Credential Isolation
  • Your credentials are only loaded during initialization
  • After loading, credentials are immediately removed from environment variables
  • Credentials are never logged or transmitted to the LLM
2. Memory Protection
  • Secure memory allocation using sodium-native
  • Memory locking to prevent swapping to disk
  • Zero-out memory buffers after use
3. Access Prevention
  • Secure environment variable handling
  • Strict validation of required environment variables
  • Console output sanitization to prevent leaking secrets

Setup

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Build the project:
    npm run build
    

Required Environment Variables

The Twitter Client MCP requires the following environment variables:

TWITTER_USERNAME=your_username
TWITTER_PASSWORD=your_password
[email protected]

Optionally, you can add Twitter API v2 credentials for advanced functionality:

TWITTER_API_KEY=your_api_key
TWITTER_API_SECRET_KEY=your_api_secret
TWITTER_ACCESS_TOKEN=your_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_access_secret

Tools

The server exposes the following MCP tools:

Tool NameDescriptionParameters
profileByUsernameGet a Twitter profile by usernameusername: String
myProfileGet the authenticated user's profilecheck: Boolean
getTweetGet a specific tweet by IDtweetId: String
getUserTweetsGet tweets from a Twitter userusername: String, count?: Number
sendTweetPost a new tweettext: String, inReplyToId?: String
likeTweetLike a tweettweetId: String
retweetRetweet a tweettweetId: String
searchTweetsSearch for tweetsquery: String, count?: Number, searchMode?: String ('top', 'latest', 'photos', 'videos')
searchProfilesSearch for Twitter profilesquery: String, count?: Number
getFollowersGet a list of users following a Twitter userusername: String, count?: Number
getFollowingGet a list of users that a Twitter user is followingusername: String, count?: Number
followUserFollow a Twitter userusername: String

Usage

Running Locally
# Start the server with environment variables
TWITTER_USERNAME=your_username TWITTER_PASSWORD=your_password [email protected] npm start
Adding to Cursor

To add this MCP server to Cursor:

  1. In Cursor, go to Settings > MCP Servers
  2. Click "Add Server"
  3. Configure the server with the following settings:
    • Name: Twitter Client MCP (or any name you prefer)
    • Type: command
    • Command: node
    • Arguments: /path/to/twitter-client-mcp/dist/index.js (replace with your actual path)
    • Environment Variables:
      • TWITTER_USERNAME: Your Twitter username
      • TWITTER_PASSWORD: Your Twitter password
      • TWITTER_EMAIL: Your Twitter email
      • Any other variables you want to set
  4. Click "Save"
Using NPX (Recommended)

You can also use npx to run the MCP server directly from GitHub:

TWITTER_USERNAME=your_username TWITTER_PASSWORD=your_password [email protected] npx -y github:mzkrasner/twitter-client-mcp
Using Environment Variables in Cursor Configuration

For more security and ease of use, configure Cursor via the .cursor/mcp.json file in your home directory:

{
  "mcpServers": {
    "twitter-client-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "github:mzkrasner/twitter-client-mcp"
      ],
      "env": {
        "TWITTER_USERNAME": "your_username",
        "TWITTER_PASSWORD": "your_password",
        "TWITTER_EMAIL": "[email protected]"
      }
    }
  }
}

Development

Important Note for Development

When developing the MCP server, use console.error() instead of console.log() for all debugging and logging statements. The MCP protocol communicates with the client via stdout, so any console.log() statements will interfere with this communication.

License

MIT

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.