
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
MCP Connection Issues
MCP Connection Issues
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
Workbench Tool Loading
Workbench Tool Loading
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()
Agent Tool Usage Issues
Agent Tool Usage Issues
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