TwitterViewer MCP Server
# twitterviewer-mcp
MCP server that lets AI agents read public X (Twitter) posts, threads, profiles and replies as Markdown. Three read-only tools, hosted by [TwitterViewer](https://twitterviewer.ai) at `https://twitterviewer.ai/mcp`. Independent service, not affiliated with X.
Using the tools needs a [Plus](https://twitterviewer.ai/pricing) subscription, on either connection. There are two ways to connect:
| | Use it when | Sign-in |
| --- | --- | --- |
| **[Remote server](#remote-server-recommended)** (recommended) | Your client supports remote (Streamable HTTP) MCP servers | Browser sign-in (OAuth), or an API key |
| **[Local stdio](#local-stdio-server)** (`npx -y twitterviewer-mcp`) | Your client only starts local servers | API key |
## Remote server (recommended)
Nothing to install or update. The first time you connect, your client opens the browser to sign in to your TwitterViewer account (Plus). No API key needed.
### Claude Code
```bash
claude mcp add --transport http twitterviewer https://twitterviewer.ai/mcp
```
Then run `/mcp` inside Claude Code to sign in.
### Claude Desktop and claude.ai
Open **Settings → Connectors → Add custom connector** and enter `https://twitterviewer.ai/mcp`.
### Cursor
`~/.cursor/mcp.json`:
```json
{
"mcpServers": {
"twitterviewer": { "url": "https://twitterviewer.ai/mcp" }
}
}
```
### Codex
```bash
codex mcp add twitterviewer --url https://twitterviewer.ai/mcp
codex mcp login twitterviewer
```
Or add it to `~/.codex/config.toml` and run the login command:
```toml
[mcp_servers.twitterviewer]
url = "https://twitterviewer.ai/mcp"
```
### VS Code (GitHub Copilot)
`~/.copilot/mcp-config.json`, or `.mcp.json` in the workspace root:
```json
{
"mcpServers": {
"twitterviewer": {
"type": "http",
"url": "https://twitterviewer.ai/mcp",
"tools": ["*"]
}
}
}
```
### Windsurf (Devin Desktop)
`~/.config/devin/mcp_config.json`:
```json
{
"mcpServers": {
"twitterviewer": {
"url": "https://twitterviewer.ai/mcp",
"transport": "http"
}
}
}
```
### With an API key instead
For servers, CI and clients that cannot open a browser, create a key at <https://twitterviewer.ai/account/api> and send it as `Authorization: Bearer <key>`.
```bash
claude mcp add --transport http twitterviewer https://twitterviewer.ai/mcp \
--header "Authorization: Bearer $TWITTERVIEWER_API_KEY"
```
Cursor:
```json
{
"mcpServers": {
"twitterviewer": {
"url": "https://twitterviewer.ai/mcp",
"headers": { "Authorization": "Bearer ${env:TWITTERVIEWER_API_KEY}" }
}
}
}
```
Codex:
```toml
[mcp_servers.twitterviewer]
url = "https://twitterviewer.ai/mcp"
bearer_token_env_var = "TWITTERVIEWER_API_KEY"
```
## Local stdio server
The `twitterviewer-mcp` package runs on your machine and forwards every request to the remote server, so the tools are always the same as the hosted ones. It needs Node.js 20 or newer. Tool calls need an API key from <https://twitterviewer.ai/account/api> (Plus).
### Claude Desktop, Cursor and other JSON configs
```json
{
"mcpServers": {
"twitterviewer": {
"command": "npx",
"args": ["-y", "twitterviewer-mcp"],
"env": { "TWITTERVIEWER_API_KEY": "tv_live_..." }
}
}
}
```
### Claude Code
```bash
claude mcp add --env TWITTERVIEWER_API_KEY=tv_live_... --transport stdio twitterviewer -- npx -y twitterviewer-mcp
```
### Codex
```toml
[mcp_servers.twitterviewer]
command = "npx"
args = ["-y", "twitterviewer-mcp"]
env = { TWITTERVIEWER_API_KEY = "tv_live_..." }
```
### Docker
```bash
docker build -t twitterviewer-mcp .
docker run -i --rm -e TWITTERVIEWER_API_KEY twitterviewer-mcp
```
### Environment variables
| Variable | Required | Description |
| --- | --- | --- |
| `TWITTERVIEWER_API_KEY` | for tool calls | API key. Without it the server still starts and lists the tools; a tool call explains how to create one. With a key whose account has no Plus plan, requests fail with a message saying Plus is required. |
| `TWITTERVIEWER_BASE_URL` | no | Site that hosts `/mcp`. Default `https://twitterviewer.ai`. |
## Tools
All tools are read-only: they never post, like or follow, and they never ask for your X account.
### `convert_x_url`
Turn an X (Twitter) post, thread, or profile link into clean Markdown (or text / JSON). Costs 1 credit per post returned (quoted posts count too); author profile data is free; errors are free. A repeated call for the same link and options within 10 minutes is free. Profile links return recent posts (default 20, up to 200).
| Argument | Required | Description |
| --- | --- | --- |
| `url` | yes | X post, thread or profile URL, or an @handle |
| `scope` | no | `thread` (default): the author's whole thread; `post`: only this post; `conversation`: thread plus the first page of replies |
| `format` | no | `markdown` (default), `obsidian` (with YAML frontmatter), `text`, or `json` |
| `stats` | no | Engagement numbers: `all` (default), `root` (first post only), `off` |
| `max` | no | Profile links only: how many recent posts (default 20) |
### `get_x_replies`
Replies to one X post. Costs 1 credit per reply returned; repeating the same call within 10 minutes returns the same result for free.
| Argument | Required | Description |
| --- | --- | --- |
| `url` | yes | X post URL |
| `max` | no | How many replies (default 20, up to 100) |
### `get_credits`
Remaining TwitterViewer credits: plan credits for the current cycle plus any that never expire. Calling it costs no credits. No arguments.
## Try it
- "Read https://x.com/jack/status/20 as Markdown."
- "Summarize the recent posts from @NASA."
- "What are people replying to this post?" followed by the link.
## Credits
- **1 credit = 1 post returned.** A quoted post counts as one more post.
- [Plus](https://twitterviewer.ai/pricing) includes the MCP server, the API and the CLI, with 3,000 credits a month.
- Errors and empty results are free.
- Repeating a conversion or replies call with the same parameters on the same account within 10 minutes returns the first result and is not charged again. If your balance cut that result short and you have credits again, the repeat counts as a new call.
- Requests are limited per account: 30 a minute.
## Links
- [TwitterViewer MCP Server](https://twitterviewer.ai/twitterviewer-mcp-server): setup and overview
- [API docs](https://twitterviewer.ai/docs/api): authentication, tool arguments and the REST API
- [`twitterviewer`](https://www.npmjs.com/package/twitterviewer): TypeScript SDK and command line client
## Development
```bash
bun install
bun run typecheck
bun run test
bun run build
```
Tool definitions live only on the remote server; this package does not declare any. Integration tests are skipped unless both `TWITTERVIEWER_BASE_URL` (for example `http://localhost:3400`) and `TWITTERVIEWER_API_KEY` are set; they need a Plus account's key and use only calls that cost no credits.
## License
[MIT](LICENSE)
TDQS
Scored across 3 tools
Each tool targets a clearly different operation: URL-to-Markdown conversion for posts/threads/profiles, fetching replies to a single post, and checking account credits. The boundary between convert_x_url and get_x_replies is explicit (whole post/thread content vs. reply list), so an agent can select correctly without guessing.
All three names follow a consistent snake_case verb_noun pattern (convert_x_url, get_x_replies, get_credits) with the same 'x' domain prefix on content tools. No mixed conventions or vague verbs.
Three tools is lean but each maps to a distinct, necessary capability for a read-only X content viewer, and the credit-check tool is a sensible inclusion. It sits slightly on the thin side, but nothing feels redundant or missing at the structural level.
The surface covers single posts, threads, profiles, and replies, which are the core read paths, but there is no search capability, no access to engagement metrics or liker/retweeter lists, and no way to enumerate more replies beyond what one post exposes. Agents can handle typical content-extraction tasks but will hit dead ends for discovery-style workflows.