Skip to main content
Cover Image Enhance your AutoGen 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 AutoGen agents
  • 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 AutoGen 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 AutoGen 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

Initialize your model client

Set up your language model client:
4

Create your Membit-powered agent

Use McpWorkbench to connect Membit tools to your AutoGen agent:
5

Run your agent

Execute your agent with a social media analysis task:
Your AutoGen 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 is correct
  • Ensure Node.js is properly installed and accessible
  • Increase read_timeout_seconds if experiencing timeouts
Problem: McpWorkbench fails to load toolsSolutions:
  • Verify MCP server parameters are correct
  • Check network connectivity and firewall settings
  • Ensure your Membit API credentials are valid
  • Try listing tools first to verify connection: await workbench.list_tools()
Problem: Agents don’t use Membit tools effectivelySolutions:
  • Make system messages more explicit about tool usage
  • Enable reflect_on_tool_use=True for better tool reasoning
  • Use model_client_stream=True for real-time feedback
  • Test with simpler, more direct task descriptions