StackMCP

Set up Twitter/X MCP in Windsurf

Post tweets, search timelines, manage followers, and analyze engagement on Twitter/X from your AI editor.

1

Locate the config file

Windsurf reads MCP server configuration from the following file:

~/.codeium/windsurf/mcp_config.json

Create this file if it does not already exist.

2

Add the configuration

Add the following to your Windsurf config file:

json
{
  "mcpServers": {
    "twitter-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "twitter-mcp"
      ],
      "env": {
        "TWITTER_API_KEY": "YOUR_TWITTER_API_KEY",
        "TWITTER_API_SECRET": "YOUR_TWITTER_API_SECRET",
        "TWITTER_ACCESS_TOKEN": "YOUR_TWITTER_ACCESS_TOKEN",
        "TWITTER_ACCESS_SECRET": "YOUR_TWITTER_ACCESS_SECRET"
      }
    }
  }
}
3

Set up environment variables

Twitter/X MCP requires the following environment variables:

TWITTER_API_KEYRequired

Twitter API key

TWITTER_API_SECRETRequired

Twitter API secret

TWITTER_ACCESS_TOKENRequired

Twitter access token

TWITTER_ACCESS_SECRETRequired

Twitter access token secret

4

Verify it works

Restart Windsurf. Twitter/X MCP should appear in your MCP server list with 8 tools available.

This server adds approximately 4,120 tokens to your context window for tool definitions.

Set up Twitter/X MCP in other editors