A URL does not cost what it looks like it costs, and an emoji can count as two — which is why drafts written by a model routinely come back over the limit despite looking short. Running the platform's own counting library locally removes the guesswork entirely, with no credential to manage because nothing leaves the machine. Pair the count with the optimiser: knowing a draft is over the limit is only half of what you need.
A text tool for X and Twitter posts. It counts characters using the platform's own counting method rather than string length, validates a draft against the limits, suggests how to shorten one that is too long, and extracts the URLs, mentions and hashtags it contains.
- `count_tweet_characters` takes `text` and returns the count, the remaining characters and whether the post is valid
- `validate_tweet` checks a draft against the constraints and reports the specific issues
- `optimize_tweet` suggests how to shorten a post, with an optional `maxLength` defaulting to 280
- `extract_entities` returns the URLs, mentions and hashtags separately
- Counting runs on twitter-text, the official character-counting library, so emoji and URLs weigh what the platform says they weigh
Node.js. Clone the repository, `npm install` and `npm run build`, then point the client at the built server. The published package is `mcp-x-post-optimizer`, version 1.0.2. There is nothing to authenticate — no account, no key, no network call, because the counting happens locally.
One command — npx -y mcp-x-post-optimizer
