
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)
Installation
Install the required packages for AutoGen and MCP integration: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.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-remoteis installed:npm list -g mcp-remote - Check your API key is correct
- Ensure Node.js is properly installed and accessible
- Increase
read_timeout_secondsif 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=Truefor better tool reasoning - Use
model_client_stream=Truefor real-time feedback - Test with simpler, more direct task descriptions