Skip to main content
Glama
Twitter MCP Server

Twitter MCP Server

by serima

Twitter MCP Server

An MCP (Model Context Protocol) server for Claude to accurately count Twitter/X post characters and optimize posts.

Features

  • Accurate Character Counting: Calculate character count based on Twitter/X's official counting method

  • Post Validation: Check character limits and other constraints

  • Post Optimization: Suggestions for optimizing posts that are too long

  • Entity Extraction: Extract and analyze URLs, mentions, and hashtags

Related MCP server: X (Twitter) MCP

Installation

# Clone the repository
git clone <your-repo-url>
cd twitter-mcp-server

# Install dependencies
npm install

# Build
npm run build

Configuration for Claude Desktop

Add the following to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "twitter-mcp-server": {
      "command": "node",
      "args": ["/path/to/twitter-mcp-server/dist/server.js"]
    }
  }
}

Usage

The following tools will be available in Claude:

1. count_tweet_characters

Please count the characters in this Twitter/X post accurately:
"Hello! It's a beautiful day today ☀️ #goodweather https://example.com"

2. validate_tweet

Please validate if this post is valid:
"(long post text)"

3. optimize_tweet

Please optimize this post:
"(post text to optimize)"

4. extract_entities

Please extract entities from this post:
"@user Hello! #hello please check out https://example.com"

Development

# Start in development mode
npm run dev

# Build
npm run build

# Start in production
npm start

API Details

count_tweet_characters

  • Input: text (string) - Text to count

  • Output: Detailed information including character count, remaining characters, validity

validate_tweet

  • Input: text (string) - Text to validate

  • Output: Validity, issues, entity information

optimize_tweet

  • Input:

    • text (string) - Text to optimize

    • maxLength (number, optional) - Maximum character count (default: 280)

  • Output: Optimized text and suggestions

extract_entities

  • Input: text (string) - Text to extract entities from

  • Output: Lists of URLs, mentions, and hashtags

Tech Stack

  • TypeScript: Type safety and better development experience

  • @modelcontextprotocol/sdk: MCP server implementation

  • twitter-text: Official Twitter character counting library

License

MIT License

Contributing

  1. Fork this repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add some amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Create a Pull Request

Support

If you have any issues or questions, please report them in GitHub Issues.

Available Tools

4 tools
count_tweet_charactersA

Twitter/Xの投稿文字数を正確にカウントします。URLや絵文字も考慮します。

Inputs: text (required).

extract_entitiesB

Twitter/Xの投稿からエンティティ(URL、メンション、ハッシュタグ)を抽出します

Inputs: text (required).

optimize_tweetB

Twitter/Xの投稿を最適化します(長すぎる場合は短縮提案など)

Inputs: text (required), maxLength.

validate_tweetA

Twitter/Xの投稿が有効かどうかを検証します(文字数制限、URL、メンションなど)

Inputs: text (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: character counting, entity extraction, optimization, and validation. The descriptions specify unique functions, making it easy for an agent to select the right tool without confusion.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (e.g., count_tweet_characters, extract_entities, optimize_tweet, validate_tweet). This uniformity enhances readability and predictability across the set.

    Tool Count4/5

    With 4 tools, the count is reasonable for a Twitter utility server, though slightly lean. It covers core text processing tasks but could benefit from additional tools like posting or analytics for a more comprehensive scope.

    Completeness3/5

    The tools provide good coverage for tweet analysis and preparation, but there are notable gaps for a Twitter server, such as missing CRUD operations (e.g., create_tweet, get_timeline) or interaction features (e.g., like, retweet). This limits the server's utility for full Twitter workflows.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides 14+ character-level text analysis tools that give LLMs the ability to accurately count letters, analyze individual characters, and work with text at the character level—overcoming tokenization limitations.
      14
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with X (Twitter) to post tweets, threads, and replies while retrieving tweet metrics and account information. It supports core management tasks like deleting tweets and verifying authentication through the Twitter API.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides tools for AI models to count characters and words in text, supporting English and other space-delimited languages.
      1
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Accurately counts characters, bytes, and manuscript paper based on Unicode grapheme clusters, and provides deterministic feedback to help AI meet exact length limits for self-introductions or school records.
      -