twitter-mcp
MCP server for automating Twitter actions like tweeting, liking, retweeting, and replying via browser automation, supporting multiple accounts without API keys.
README
🐦 twitter-mcp
Playwright ile geliştirilmiş X (Twitter) tarayıcı otomasyon aracı. Birden fazla hesapla tweet atma, beğenme, retweet, yanıtlama ve daha fazlasını otomatikleştirin.
✨ Özellikler
- 🔐 Kalıcı oturumlarla çoklu hesap yönetimi
- 📝 Metin ve görsel ile tweet atma
- ❤️ Tweet beğenme
- 🔄 Retweet yapma
- 💬 Tweet'lere yanıt verme
- 🎯 Alıntı tweet atma
- 🚀 Otomasyon için REST API
- 🔔 Webhook bildirimleri
- 🌐 Tarayıcı tabanlı otomasyon (API anahtarı gerektirmez)
📋 Gereksinimler
- Node.js >= 20
- npm veya yarn
🚀 Hızlı Başlangıç
Kurulum
npm install
Kurulum
İlk profilinizi yapılandırmak için kurulum scriptini çalıştırın:
npm run setup
Bu komut, profil oluşturma ve X'e giriş yapma sürecinde size rehberlik edecektir.
API Sunucusunu Başlatma
npm run server
Sunucu http://localhost:4000 adresinde başlayacaktır.
🔧 API Endpoint'leri
POST /api/login
Yeni profil oluştur ve giriş yap
{
"username": "kullanici_adiniz",
"password": "sifreniz"
}
GET /api/profiles
Tüm kimlik doğrulaması yapılmış profilleri listele
POST /api/retweet
Birden fazla hesaptan retweet yap
{
"tweetUrl": "https://x.com/user/status/123456",
"profiles": ["profil1", "profil2"]
}
POST /api/like
Birden fazla hesaptan tweet beğen
{
"tweetUrl": "https://x.com/user/status/123456",
"profiles": ["profil1", "profil2"]
}
POST /api/reply
Birden fazla hesaptan tweet'e yanıt ver
{
"tweetUrl": "https://x.com/user/status/123456",
"content": "Harika tweet!",
"profiles": ["profil1", "profil2"],
"imagePaths": ["resim/yolu/image.jpg"]
}
DELETE /api/profile/:name
Profil sil
📜 Script'ler
Script'leri doğrudan da kullanabilirsiniz:
# Tweet at
echo '{"content":"Merhaba Dünya!","profile":"profilim"}' | npx tsx scripts/post.ts
# Tweet beğen
echo '{"tweetUrl":"https://x.com/user/status/123","profile":"profilim"}' | npx tsx scripts/like.ts
# Retweet yap
echo '{"tweetUrl":"https://x.com/user/status/123","profile":"profilim"}' | npx tsx scripts/retweet.ts
# Tweet'e yanıt ver
echo '{"tweetUrl":"https://x.com/user/status/123","content":"Güzel!","profile":"profilim"}' | npx tsx scripts/reply.ts
# Alıntı tweet at
echo '{"tweetUrl":"https://x.com/user/status/123","content":"Buna bakın","profile":"profilim"}' | npx tsx scripts/quote.ts
# Profilleri listele
npx tsx scripts/list-profiles.ts
🔔 Webhook Bildirimleri
Bildirim almak için WEBHOOK_URL ortam değişkenini ayarlayın:
export WEBHOOK_URL=https://webhook-url-iniz.com/endpoint
npm run server
Gönderilen olaylar:
login_success/login_failedretweet_completedlike_completedreply_completedprofile_deleted
🗂️ Proje Yapısı
twitter-mcp/
├── api-server.ts # REST API sunucusu
├── scripts/
│ ├── setup.ts # İlk kurulum sihirbazı
│ ├── auto-login.ts # Otomatik giriş
│ ├── post.ts # Tweet atma
│ ├── like.ts # Tweet beğenme
│ ├── retweet.ts # Retweet yapma
│ ├── reply.ts # Tweet'e yanıt verme
│ ├── quote.ts # Alıntı tweet atma
│ └── list-profiles.ts # Tüm profilleri listele
├── lib/ # Paylaşılan yardımcı araçlar
└── data/
└── profiles/ # Kullanıcı profilleri (gitignore'da)
🔒 Güvenlik
- Tüm profil verileri yerel olarak
data/profiles/dizininde saklanır - Kimlik bilgileri ve çerezler asla git'e commit edilmez
- Hassas yapılandırma için ortam değişkenlerini kullanın
- Her profil izole tarayıcı oturumlarına sahiptir
⚙️ Ortam Değişkenleri
PORT=4000 # API sunucu portu
WEBHOOK_URL=https://webhook-url-iniz.com # Webhook endpoint'i
🛠️ Geliştirme
# Tip kontrolü
npm run typecheck
# İzleme modu (değişikliklerde otomatik yeniden başlatma)
npm run dev
📝 Lisans
MIT
🤖 MCP Server Kullanımı
Bu proje aynı zamanda bir MCP (Model Context Protocol) server olarak da çalışır. AI asistanları (Kiro, Claude Desktop, vb.) doğrudan Twitter işlemlerini yapabilir.
MCP Server Kurulumu
- Gerekli paketi yükle:
npm install
- MCP config dosyasını düzenle (
.kiro/settings/mcp.jsonveya~/.kiro/settings/mcp.json):
{
"mcpServers": {
"twitter-automation": {
"command": "npx",
"args": ["tsx", "/tam/yol/twitter-mcp/mcp-server.ts"],
"env": {
"API_BASE_URL": "https://your-ngrok-url.ngrok-free.dev"
},
"disabled": false,
"autoApprove": []
}
}
}
- Kiro'yu yeniden başlat veya MCP Server view'dan reconnect yap
Kullanılabilir MCP Tool'ları
twitter_health_check- API sunucu durumunu kontrol ettwitter_list_profiles- Kayıtlı hesapları listeletwitter_add_account- Yeni hesap ekletwitter_retweet- Retweet attwitter_like- Tweet beğentwitter_reply- Tweet'e yanıt vertwitter_delete_profile- Hesap sil
Örnek Kullanım (AI ile)
Sen: "Twitter hesaplarımı listele"
AI: twitter_list_profiles tool'unu kullanır
Sen: "Bu tweet'i tüm hesaplarımdan retweet et: https://x.com/user/status/123"
AI: twitter_retweet tool'unu kullanır
Sen: "hesap1 ve hesap2 ile bu tweet'e 'Harika!' diye yanıt ver"
AI: twitter_reply tool'unu kullanır
⚠️ Sorumluluk Reddi
Bu araç eğitim amaçlıdır. Sorumlu bir şekilde ve X'in Hizmet Şartları'na uygun olarak kullanın. Otomatik işlemler platform politikalarını ihlal edebilir.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.