
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:
- Async
- Sync
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
Connection Issues
Connection Issues
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
No Results Returned
No Results Returned
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
Performance Issues
Performance Issues
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