Twitter MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Twitter MCP ServerCheck the character count for this: 'Hello world! 🌍 #excited https://glama.ai'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 buildConfiguration 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 startAPI Details
count_tweet_characters
Input:
text(string) - Text to countOutput: Detailed information including character count, remaining characters, validity
validate_tweet
Input:
text(string) - Text to validateOutput: Validity, issues, entity information
optimize_tweet
Input:
text(string) - Text to optimizemaxLength(number, optional) - Maximum character count (default: 280)
Output: Optimized text and suggestions
extract_entities
Input:
text(string) - Text to extract entities fromOutput: 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
Fork this repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Create a Pull Request
Support
If you have any issues or questions, please report them in GitHub Issues.
Available Tools
4 toolscount_tweet_charactersA
Twitter/Xの投稿文字数を正確にカウントします。URLや絵文字も考慮します。
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | カウントしたいTwitter/Xの投稿テキスト |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It successfully mentions important Twitter-specific handling (URLs and emojis), but lacks disclosure of what the function returns (integer count vs object), whether it has side effects, or rate limiting details.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description consists of two efficiently structured sentences with zero waste. The first states the core function, while the second provides essential behavioral context (URL/emoji handling) that modifies how the counting works.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter tool with no nested objects, the description adequately covers the input requirements. However, without an output schema, the description should ideally mention what value is returned (e.g., character count number), which is absent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage for the single 'text' parameter. The description does not add semantic details beyond what the schema already provides ('カウントしたいTwitter/Xの投稿テキスト'), warranting the baseline score of 3 for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('カウントします'/counts) with a clear resource ('Twitter/Xの投稿文字数'/Twitter/X post characters). It effectively distinguishes from siblings (extract_entities, optimize_tweet, validate_tweet) by focusing specifically on character counting rather than extraction, optimization, or validation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
While the function is clear from the name and context, there is no explicit guidance on when to use this versus validate_tweet (which likely also checks length constraints). The description relies on implication rather than stating 'use this when you need to check length before posting' or contrasting with alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
extract_entitiesB
Twitter/Xの投稿からエンティティ(URL、メンション、ハッシュタグ)を抽出します
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | エンティティを抽出したいTwitter/Xの投稿テキスト |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the burden of behavioral disclosure. It successfully specifies which entity types are extracted (URLs, mentions, hashtags), but lacks information about output format, idempotency, or whether the operation is read-only, which would be especially helpful given the absence of an output schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficiently structured sentence that front-loads the essential information without redundancy. Every element (platform, action, entity types) earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (1 simple parameter) and clear purpose, the description is minimally adequate. However, it lacks return value documentation, which is a notable gap since no output schema exists to explain what the extraction returns (e.g., arrays, positions, formatted strings).
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage for its single 'text' parameter. The description does not add additional semantic details (e.g., length limits, encoding requirements) beyond what the schema already provides, warranting the baseline score of 3.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action (抽出します/extract), resource (Twitter/Xの投稿/posts), and specific scope (entities: URLs, mentions, hashtags). However, it does not explicitly differentiate from siblings like count_tweet_characters or validate_tweet, which would be needed for a 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. While the extraction purpose is distinct from counting or validating, there is no explicit 'use this when...' or 'instead of X, use this for entity extraction' guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
optimize_tweetB
Twitter/Xの投稿を最適化します(長すぎる場合は短縮提案など)
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | 最適化したいTwitter/Xの投稿テキスト | |
| maxLength | No | 最大文字数(デフォルト: 280) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the shortening behavior but does not clarify whether the operation preserves meaning, returns multiple options, requires specific permissions, or explain the output format.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single efficient sentence with the main verb front-loaded ('optimizes') and a helpful parenthetical clarifying the specific use case. There is no extraneous text or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (2 parameters, no nested objects) and complete schema documentation, the description is minimally adequate. However, it lacks description of the return value since no output schema exists, and could clarify whether the optimization is automatic or provides suggestions.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage for both parameters (text and maxLength with default), so the schema adequately documents the inputs. The description adds no additional parameter semantics beyond what the schema already provides, which warrants the baseline score.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool optimizes Twitter/X posts and specifically mentions shortening suggestions for long text, providing a concrete example of the optimization behavior. However, it does not explicitly differentiate from sibling tools like validate_tweet or count_tweet_characters.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no explicit guidance on when to use this tool versus alternatives (count_tweet_characters, validate_tweet). The user must infer that this is for content modification while siblings are for analysis or validation only.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate_tweetA
Twitter/Xの投稿が有効かどうかを検証します(文字数制限、URL、メンションなど)
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | 検証したいTwitter/Xの投稿テキスト |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It adds valuable behavioral context by specifying validation criteria (character limits, URLs, mentions), but lacks critical disclosure about whether this requires Twitter API authentication, consumes rate limits, or what the return format is (boolean vs. detailed error object).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single, efficient sentence with purpose front-loaded and specific validation domains parenthesized. No redundant words; the 'など' (etc.) appropriately suggests additional validation rules without over-specifying. Every element earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the low complexity (single string parameter, 100% schema coverage), the description adequately covers the tool's purpose and validation scope. However, without an output schema, it should ideally mention the return format (e.g., validation result structure) to be fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 100% schema description coverage, the baseline is 3. The description implies the text parameter should be tweet content potentially containing URLs/mentions, but does not add syntax requirements, examples, or constraints beyond what the schema already states ('検証したいTwitter/Xの投稿テキスト').
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb (検証/validate) with a clear resource (Twitter/X posts) and explicitly scopes the validation to character limits, URLs, and mentions. This effectively distinguishes it from siblings: count_tweet_characters (counting), extract_entities (extraction), and optimize_tweet (optimization/fixing).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by listing validation aspects (character limits, URLs, mentions), suggesting it's for pre-posting validation. However, it lacks explicit when-to-use guidance versus alternatives (e.g., 'use this to check validity before posting; use optimize_tweet to automatically fix issues').
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
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.
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.
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.
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.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
X / Twitter public post, comment, reply, user, and search tools.
Count occurrences of any character in your text instantly. Specify the character and get precise c…
Stop guessing what works on X/Twitter. Analyze your history, draft in your voice, schedule posts.
X (Twitter) profiles, tweets and single-tweet lookup by handle or URL. No login. Pay per result.
Related MCP Servers
- AlicenseAqualityCmaintenanceProvides 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.14163MIT
- AlicenseNot gradedqualityDmaintenanceEnables 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
- AlicenseNot gradedqualityDmaintenanceProvides tools for AI models to count characters and words in text, supporting English and other space-delimited languages.1MIT
- FlicenseNot gradedqualityCmaintenanceAccurately 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.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/serima/twitter-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server