Skip to main content
TutorialsJanuary 8, 20268 min read

How to Query Twitter with Claude AI (MCP Guide)

Step-by-step guide to querying Twitter data using Claude AI with MCP integration - from setup to advanced analysis.

How to Query Twitter with Claude AI (MCP Guide)

How to Query Twitter with Claude AI (MCP Guide)

Claude AI can access Twitter data directly through MCP (Model Context Protocol), enabling you to search tweets, analyze accounts, and extract insights using natural language. No coding, no API keys, no complex setup.

This guide walks you through setting up MCP for Twitter access and mastering the query patterns that deliver results.

What You'll Be Able to Do

After setup, you can ask Claude questions like:

"Find tweets about 'machine learning' from the past week"

"Who are the most followed accounts tweeting about cryptocurrency?"

"How many times was our brand mentioned on Twitter this month?"

"Show me the engagement metrics for @competitor's recent tweets"

And get structured, exportable results.

Prerequisites

  • Claude Desktop application (free)
  • Xpoz account (free tier available at xpoz.ai)
  • 5 minutes for setup

Step 1: Install Claude Desktop

If you don't have Claude Desktop:

  1. Visit claude.ai/download
  2. Download for your operating system
  3. Install and sign in with your Anthropic account

Claude Desktop supports MCP integrations that the web version doesn't.

Step 2: Get Your Xpoz API Key

  1. Go to xpoz.ai
  2. Create an account or sign in
  3. Navigate to API settings
  4. Copy your API key

Free tier includes: 100,000 results per month—plenty for getting started.

Step 3: Configure MCP in Claude

macOS/Linux

  1. Open Claude Desktop
  2. Go to Claude → Settings → Developer
  3. Click "Edit Config" to open the configuration file
  4. Add the Xpoz server configuration:
{
  "mcpServers": {
    "xpoz": {
      "command": "npx",
      "args": ["-y", "@xpoz/mcp-server"],
      "env": {
        "XPOZ_API_KEY": "your-api-key-here"
      }
    }
  }
}
  1. Save the file
  2. Restart Claude Desktop

Windows

  1. Open Claude Desktop
  2. Navigate to Settings → Developer
  3. Edit the MCP configuration
  4. Add the same configuration as above
  5. Restart Claude

Verification

After restart, look for the MCP indicator in Claude. You can verify by asking:

"Can you access Twitter data through Xpoz?"

Claude should confirm the connection is active.

Step 4: Your First Query

Start with a simple search:

"Search for tweets about 'artificial intelligence' from the past 7 days"

Claude will return results including:

  • Tweet text
  • Author username
  • Engagement metrics (retweets, likes)
  • Timestamp

Query Patterns for Common Tasks

Basic Tweet Search

Simple keyword search:

"Find recent tweets mentioning 'product launch'"

Phrase search:

"Search for tweets containing the exact phrase 'customer service'"

Multiple keywords:

"Find tweets that mention both 'AI' and 'healthcare'"

Filtering Results

By engagement:

"Show tweets about 'startup funding' with more than 100 retweets"

By follower count:

"Find tweets about 'marketing' from accounts with over 10,000 followers"

By date range:

"Search for tweets about 'election' from the past 30 days"

By verification status:

"Show tweets from verified accounts discussing 'climate change'"

User Analysis

Profile lookup:

"Get the profile information for @username"

Follower analysis:

"Who are the followers of @competitor with more than 50K followers?"

Following analysis:

"Who does @influencer follow in the tech industry?"

Tweet history:

"Show me the last 50 tweets from @brandaccount"

Competitive Intelligence

Brand mentions:

"Compare mentions of 'BrandA' vs 'BrandB' over the past month"

Sentiment comparison:

"What's the sentiment breakdown for tweets mentioning 'CompetitorName'?"

Share of voice:

"How do mentions of our brand compare to our top 3 competitors this week?"

Trend Research

Hashtag analysis:

"What are the most-used hashtags in tweets about 'sustainable fashion'?"

Volume tracking:

"How many tweets mentioned 'cryptocurrency' each day this week?"

Emerging topics:

"What topics are frequently discussed alongside 'remote work'?"

Advanced Query Techniques

Combining Filters

Layer multiple criteria for precise results:

"Find tweets about 'SaaS' from verified accounts with over 5,000 followers,
posted in the last 14 days, with at least 50 retweets"

Engagement Analysis

Most engaging content:

"What were the most-retweeted posts about 'AI' this month?"

Engagement rates:

"Show engagement metrics for tweets from @account over the past 30 days"

Reply analysis:

"Get the replies to this tweet: [tweet URL or ID]"

Network Analysis

Connection mapping:

"Find mutual followers between @accountA and @accountB"

Influencer identification:

"Who are the most-followed accounts that tweeted about 'blockchain' this week?"

Community detection:

"What accounts frequently interact with tweets about 'venture capital'?"

Export and Analysis

CSV export:

"Export these results to CSV"

Structured output:

"Format the results as a table with columns: username, tweet text,
retweet count, like count, date"

Summary statistics:

"Summarize these results: total tweets, average engagement,
top authors, common themes"

Real-World Workflows

Workflow 1: Brand Monitoring

Daily check:

You: "Find all tweets mentioning 'OurBrand' from the past 24 hours"

[Review results]

You: "Of these, which have negative sentiment?"

[Review negative mentions]

You: "Export the negative mentions to CSV for follow-up"

Workflow 2: Influencer Discovery

Finding relevant voices:

You: "Find accounts with 10K-100K followers that tweet about 'fitness tech'"

[Review list]

You: "For the top 10 by follower count, show me their engagement rates"

[Evaluate]

You: "Export the full list with engagement metrics"

Workflow 3: Competitive Analysis

Weekly comparison:

You: "Compare tweet volumes for 'CompetitorA', 'CompetitorB', and
'OurBrand' over the past week"

[Review volumes]

You: "What are the main topics in tweets mentioning CompetitorA?"

[Identify themes]

You: "Show sentiment breakdown for each brand"

Workflow 4: Content Research

Topic exploration:

You: "What were the most-retweeted tweets about 'productivity apps' this month?"

[Review top content]

You: "What formats perform best - threads, single tweets, with images?"

[Identify patterns]

You: "Show me examples of high-performing threads about productivity"

Tips for Better Results

Be Specific

Vague (less useful):

"Show me tweets about technology"

Specific (better):

"Show me tweets about 'artificial intelligence in healthcare'
from accounts with over 5,000 followers, posted this week,
with at least 20 retweets"

Iterate and Refine

Start broad, then narrow:

1. "Find tweets about 'electric vehicles'"
   → Too many results

2. "Focus on tweets from verified accounts only"
   → Better, but still broad

3. "Only show tweets with more than 100 retweets from the past week"
   → Manageable, high-quality set

Use Follow-Up Questions

Claude maintains context:

You: "Find tweets about 'remote work tools' from this week"

Claude: [Returns results]

You: "Which of these are from SaaS companies?"

Claude: [Filters to SaaS company tweets]

You: "What's the average engagement rate for those?"

Claude: [Calculates and returns]

Export Early and Often

Don't lose valuable results:

"Export these results before we move on"

CSV exports work with Excel, Google Sheets, and analysis tools.

Troubleshooting

"I can't access Twitter data"

Check:

  • MCP configuration is correct
  • API key is valid
  • Claude Desktop was restarted after configuration

Fix:

  • Verify configuration JSON syntax
  • Regenerate API key if needed
  • Check Xpoz dashboard for API status

"Results seem limited"

Check:

  • Free tier limits (100K results/month)
  • Query specificity

Fix:

  • Upgrade tier if hitting limits
  • Use more specific queries to get relevant results
  • Add filters to reduce result volume

"No results found"

Check:

  • Keyword spelling
  • Date range (data availability)
  • Filter criteria (too restrictive)

Fix:

  • Try alternative keywords
  • Expand date range
  • Remove some filters

"Results are slow"

Check:

  • Query complexity
  • Result volume requested

Fix:

  • Add filters to reduce scope
  • Request smaller batches
  • Be patient for large queries

What's Possible vs. What's Not

You Can:

  • Search public tweets by keyword, hashtag, user
  • Analyze public user profiles
  • Get engagement metrics
  • Export results to CSV
  • Track mentions over time
  • Analyze follower/following networks

You Cannot:

  • Access private/protected accounts
  • Read direct messages
  • Post tweets or take actions
  • Access real-time streaming (near-real-time available)
  • Get data older than Xpoz's historical archive

Key Takeaways

  • Claude + MCP + Xpoz enables natural language Twitter queries without coding or API management.

  • Setup takes about 5 minutes: Install Claude Desktop, get API key, configure MCP.

  • Start simple, iterate: Begin with basic searches, add filters as needed.

  • Export results for analysis: CSV export integrates with spreadsheets and BI tools.

  • Free tier is generous: 100K results/month covers most research and monitoring needs.

Conclusion

Querying Twitter through Claude AI transforms social media research from a technical exercise into a conversation. Instead of wrestling with APIs, rate limits, and code, you describe what you need and get structured results.

The combination of Claude's natural language understanding and Xpoz's comprehensive Twitter database makes professional-grade social intelligence accessible to anyone. Start with the free tier, learn the query patterns, and scale up as your needs grow.

The questions you can ask are limited only by your curiosity—not by your technical skills.

Share this article

Ready to Get Started?

Start building AI-powered social intelligence workflows today. No API keys required.