Twitter mcp server

From NaveedTechLab/skills-library · View interactive version

Twitter mcp server is an AI agent skill from the GitHub repository NaveedTechLab/skills-library. Integrate with the X (Twitter) API v2 via MCP to create tweets, post threads, and manage media with HITL approval workflows. Use when automating Twitter/X account management from Claude Code.

How to use this skill

Skill file

Twitter (X) MCP Server

Description

The Twitter MCP Server provides Model Context Protocol integration with the X API v2 (formerly Twitter API), enabling Claude Code to create tweets, post threads, and manage media with HITL (Human-in-the-Loop) approval workflows.

Purpose

This skill enables Claude Code to manage Twitter/X accounts while maintaining strict approval workflows for all tweet operations. It handles OAuth 2.0 authentication, rate limiting, and provides comprehensive audit logging.

Key Features

Tweet Operations

Rate Limiting

Built-in rate limit handling with automatic tracking:

Human-in-the-Loop Controls

| Operation | HITL Required |

|-----------|---------------|

| Get tweet | No |

| Get rate limits | No |

| Upload media | No |

| Create tweet | Yes |

| Create thread | Yes |

| Delete tweet | Yes |

OAuth 2.0 with PKCE

Secure authentication flow:

Configuration

Environment Variables

TWITTER_CLIENT_ID=your_client_id
TWITTER_CLIENT_SECRET=your_client_secret
TWITTER_ACCESS_TOKEN=your_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret
TWITTER_BEARER_TOKEN=your_bearer_token

Default Configuration

{
  "twitter": {
    "client_id": "",
    "client_secret": "",
    "access_token": "",
    "access_token_secret": "",
    "bearer_token": "",
    "api_version": "2",
    "timeout_seconds": 30
  },
  "approval": {
    "require_approval_for_tweets": true,
    "require_approval_for_threads": true,
    "require_approval_for_delete": true,
    "approval_timeout_hours": 24
  },
  "rate_limiting": {
    "enable_tracking": true,
    "warn_at_percentage": 80,
    "block_at_percentage": 95
  }
}

MCP Tools

twitter_create_tweet

Create a single tweet.

Parameters:

HITL: Required

twitter_create_thread

Post a thread of connected tweets.

Parameters:

HITL: Required

twitter_upload_media

Upload media for use in tweets.

Parameters:

HITL: Not required

twitter_delete_tweet

Delete a tweet.

Parameters:

HITL: Required

twitter_get_tweet

Get tweet details and metrics.

Parameters:

HITL: Not required

twitter_get_rate_limits

Check current API rate limit status.

HITL: Not required

Usage Scenarios

Create Simple Tweet

result = await twitter_create_tweet(
    text="Hello Twitter! This is my first automated tweet."
)
# Returns approval_request_id - human must approve

Create Thread

result = await twitter_create_thread(
    tweets=[
        "1/5 Here's an important thread about AI safety...",
        "2/5 First, let's discuss the key principles...",
        "3/5 Second, implementation considerations...",
        "4/5 Third, monitoring and oversight...",
        "5/5 In conclusion, safety requires constant vigilance."
    ]
)

Tweet with Media

# First upload media
media_result = await twitter_upload_media(
    media_url="https://example.com/image.jpg",
    media_type="image",
    alt_text="A beautiful sunset"
)

# Then create tweet with media
tweet_result = await twitter_create_tweet(
    text="Check out this amazing view!",
    media_ids=[media_result["media_id"]]
)

Rate Limits

| Endpoint | Limit | Window |

|----------|-------|--------|

| POST /2/tweets | 200 | 15 min |

| POST /2/media/upload | 615 | 15 min |

| GET /2/tweets/:id | 300 | 15 min |

| DELETE /2/tweets/:id | 50 | 15 min |

The server tracks rate limits automatically and:

Integration Points

With Vault System

With Audit Logger

All operations logged with:

With Safety Enforcer

Security Considerations

Dependencies

When NOT to Use This Skill

Common Mistakes

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.