Skip to main content
Cover Image Enhance your LlamaIndex applications with real-time social media context from Membit. This integration allows your AI agents to access up-to-the-minute discussions, trends, and insights from platforms like X (Twitter), Farcaster, and more.

Prerequisites

Before you begin, ensure you have:
  • Python 3.10 or higher installed
  • A Membit account with API access
  • Basic familiarity with LlamaIndex agents
You’ll need valid Membit API credentials. If you don’t have access yet, get your API key to get started.

Installation

Install the required LlamaIndex MCP tools package:
We recommend using a virtual environment to manage your dependencies and avoid conflicts.

Quick Start

1

Import the required modules

First, import the necessary components from LlamaIndex:
2

Get Membit tools from MCP server

Connect to Membit’s MCP server to retrieve available tools:
Replace <your-api-key> with your actual Membit API key. Keep this credential secure and don’t share it with unauthorized users.
3

Create and configure your agent

Set up a LlamaIndex ReAct agent with Membit tools:
Your agent is now ready to access real-time social media context through Membit!
4

Query your agent

Start asking questions that leverage real-time social data:

Complete Example

Here’s a full working example that demonstrates the integration:

Troubleshooting

Problem: Cannot connect to Membit MCP serverSolutions:
  • Verify your Membit MCP URL is correct
  • Check your network connection and firewall settings
  • Ensure your API credentials are valid and not expired
  • Try the synchronous method if async isn’t working
Problem: Queries return empty or limited resultsSolutions:
  • Make your search terms more general or use synonyms
  • Check if the topic is currently being discussed on social media
  • Verify your search timeframe isn’t too restrictive
  • Try different query phrasings
Problem: Slow response times or timeoutsSolutions:
  • Use async methods for better performance
  • Implement caching for frequently requested data
  • Optimize your query complexity
  • Check your internet connection stability