Skip to main content
Glama
x-link-fetcher

x-link-fetcher

by tomaitagaki

X Link Fetcher

Transform X/Twitter URLs to Nitter and fetch tweet content without API keys. Works as an MCP server for Poke.

License: MIT

Node.js

Features

✨ No API Keys Required - Works without Twitter/X API authentication

šŸ”„ Automatic URL Transformation - Converts X/Twitter URLs to Nitter instances

šŸ“Š JSON API - Returns structured tweet data in JSON format

šŸš€ MCP Server Support - Compatible with Poke and other MCP clients

ā˜ļø Easy Deployment - Deploy to Vercel, Railway, Render, or any Node.js host

Related MCP server: pyX-MCP

Quick Start

Installation

# Clone the repository
git clone https://github.com/tomaitagaki/x-link-fetcher.git
cd x-link-fetcher

# Install dependencies
npm install

# Start the server
npm start

The server will start on http://localhost:5001

Development Mode

npm run dev

Usage

As a REST API

Fetch Tweet Content:

curl "http://localhost:5001/fetch?url=https://x.com/user/status/1234567890"

Response:

{
  "success": true,
  "originalUrl": "https://x.com/user/status/1234567890",
  "nitterUrl": "https://nitter.poast.org/user/status/1234567890",
  "content": {
    "text": "Tweet content here...",
    "author": "@username",
    "timestamp": "2025-12-27T12:00:00Z"
  }
}

As an MCP Server

Add to your Poke configuration file (file ~/.poke/config.json or similar):

{
  "mcpServers": {
    "x-link-fetcher": {
      "url": "http://localhost:5001/sse",
      "type": "streamable-http"
    }
  }
}

Or if running remotely:

{
  "mcpServers": {
    "x-link-fetcher": {
      "url": "https://your-deployment.vercel.app/sse",
      "type": "streamable-http"
    }
  }
}

Available MCP Tools:

  • fetch_tweet - Fetch and parse tweet content from X/Twitter URL

  • transform_url - Transform X/Twitter URL to Nitter URL

Both tools require a url parameter (e.g., https://x.com/user/status/123).

API Endpoints

GET /fetch

Fetch and parse tweet content.

Query Parameters:

  • url (required) - X/Twitter URL to fetch

Example:

GET /fetch?url=https://x.com/elonmusk/status/1234567890

GET /transform

Transform X/Twitter URL to Nitter URL without fetching.

Query Parameters:

  • url (required) - X/Twitter URL to transform

Example:

GET /transform?url=https://x.com/user/status/123

Response:

{
  "originalUrl": "https://x.com/user/status/123",
  "nitterUrl": "https://nitter.poast.org/user/status/123"
}

GET/POST /sse

MCP Streamable HTTP endpoint for Poke and MCP client integration. This is the recommended endpoint for MCP clients.

Supported MCP Tools:

  • fetch_tweet - Fetch and parse tweet content

  • transform_url - Transform X/Twitter URL to Nitter URL

Tool Parameters:

{
  "url": "https://x.com/user/status/123"
}

POST /mcp (Legacy)

Legacy MCP server endpoint (simple JSON-RPC style).

Body:

{
  "method": "fetch_tweet",
  "params": {
    "url": "https://x.com/user/status/123"
  }
}

GET /health

Health check endpoint.

Response:

{
  "status": "ok",
  "timestamp": "2025-12-27T21:15:00Z"
}

Deployment

Deploy to Vercel

Deploy with Vercel

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel

Deploy to Railway

Deploy on Railway

  1. Connect your GitHub repository

  2. Railway will auto-detect the Node.js app

  3. Deploy!

Deploy to Render

  1. Create a new Web Service

  2. Connect your repository

  3. Set build command: npm install

  4. Set start command: npm start

  5. Deploy

Deploy to Heroku

# Install Heroku CLI and login
heroku login

# Create app
heroku create your-app-name

# Deploy
git push heroku main

Environment Variables

  • PORT - Server port (default: 5001)

  • NITTER_INSTANCE - Nitter instance to use (default: nitter.poast.org)

  • NODE_ENV - Environment (development/production)

Configuration

Custom Nitter Instance

You can specify a custom Nitter instance:

export NITTER_INSTANCE=nitter.net
npm start

Or in your deployment platform's environment variables.

Available Nitter Instances

  • nitter.poast.org (default)

  • nitter.net

  • nitter.it

  • nitter.privacydev.net

  • nitter.unixfox.eu

Note: Nitter instances may have varying reliability. Test which works best for you.

How It Works

  1. URL Transformation: Converts X/Twitter URLs to Nitter URLs

    • x.com → nitter.poast.org

    • twitter.com → nitter.poast.org

  2. Content Fetching: Makes HTTP requests to Nitter (no API needed)

  3. HTML Parsing: Extracts tweet data from HTML using cheerio

  4. JSON Response: Returns structured data

  5. MCP Integration: Provides MCP-compatible endpoint for Poke

Examples

Node.js Client

const axios = require('axios');

async function fetchTweet(url) {
  const response = await axios.get('http://localhost:5001/fetch', {
    params: { url }
  });
  return response.data;
}

fetchTweet('https://x.com/user/status/123')
  .then(data => console.log(data))
  .catch(err => console.error(err));

Python Client

import requests

def fetch_tweet(url):
    response = requests.get('http://localhost:5001/fetch', params={'url': url})
    return response.json()

data = fetch_tweet('https://x.com/user/status/123')
print(data)

cURL

# Fetch tweet
curl "http://localhost:5001/fetch?url=https://x.com/user/status/123"

# Transform URL only
curl "http://localhost:5001/transform?url=https://x.com/user/status/123"

# Health check
curl http://localhost:5001/health

Troubleshooting

Nitter Instance Unreachable

If the default Nitter instance is down, try changing it:

export NITTER_INSTANCE=nitter.net
npm start

Rate Limiting

Nitter instances may rate limit. Consider:

  • Using your own Nitter instance

  • Implementing caching

  • Adding delays between requests

Parsing Errors

If tweet content can't be parsed:

  • The tweet may be deleted or private

  • Nitter's HTML structure may have changed

  • Try a different Nitter instance

Development

Project Structure

x-link-fetcher/
ā”œā”€ā”€ server.js           # Main Express server
ā”œā”€ā”€ package.json        # Dependencies and scripts
ā”œā”€ā”€ README.md          # Documentation
ā”œā”€ā”€ LICENSE            # MIT License
ā”œā”€ā”€ .gitignore         # Git ignore rules
└── .github/
    └── workflows/
        └── deploy.yml  # CI/CD automation

Running Tests

npm test

Code Style

npm run lint

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository

  2. Create your feature branch (git checkout -b feature/AmazingFeature)

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

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

  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This tool is for educational purposes. Be respectful of rate limits and terms of service for both X/Twitter and Nitter instances.

Acknowledgments

  • Nitter - Privacy-focused Twitter frontend

  • Express - Web framework

  • Cheerio - HTML parsing

  • MCP Protocol for inter-application communication

Support


Made with ā¤ļø by Toma Itagaki

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables interacting with Twitter/X through natural language, including searching tweets, posting, sending DMs, and managing timelines via any MCP client.
      8
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to post, search, and manage tweets on X (Twitter) via the MCP protocol.
      10
      2
      -
    • A
      license
      A
      quality
      B
      maintenance
      MCP server to read X (Twitter) posts, threads, replies, quotes, and search using your own logged-in session, no API key required.
      8
      52 PyPI
      4
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      MCP server that allows posting, deleting, and reading X (Twitter) tweets using your own browser session cookie, bypassing the official paid API. Includes tools for auth setup, tweet creation, deletion, timeline reading, and regex search.
      210 PyPI
      19
      MIT