Skip to main content
Cover Image Enhance your CrewAI 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 CrewAI agents and crews
  • Node.js installed (for MCP remote client)
You’ll need valid Membit API credentials and the MCP remote URL. If you don’t have access yet, get your API key to get started.

Installation

Install the required packages for CrewAI and MCP integration:
We recommend using a virtual environment to manage your Python dependencies and avoid conflicts.

Quick Start

1

Import required modules

Import the necessary components for CrewAI and MCP integration:
2

Configure MCP server parameters

Set up the connection to Membit’s MCP server:
Make sure you have mcp-remote installed globally via npm for this to work.
Replace <your-api-key> with your actual Membit API key. Keep this credential secure and don’t share it with unauthorized users.
3

Create your Membit-powered agent

Use the MCPServerAdapter to connect Membit tools to your CrewAI agent:
4

Define your analysis task

Create a task that leverages Membit’s real-time data:
5

Execute your crew

Create and run your CrewAI crew:
Your CrewAI agent is now powered by real-time social media context from Membit!

Complete Example

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

Troubleshooting

Problem: Cannot connect to Membit MCP serverSolutions:
  • Verify mcp-remote is installed: npm list -g mcp-remote
  • Check your API key
  • Ensure Node.js is properly installed and accessible
  • Test connectivity with npx mcp-remote directly
Problem: MCPServerAdapter fails to load toolsSolutions:
  • Ensure the MCP server parameters are correct
  • Check network connectivity and firewall settings
  • Verify your Membit API credentials are valid
  • Try running the MCP server manually to test connection
Problem: Agents fail to use Membit tools effectivelySolutions:
  • Be explicit in task descriptions about which tools to use
  • Set allow_code_execution=False unless specifically needed
  • Use verbose mode to see tool usage during execution
  • Ensure agents have clear, specific roles and goals