Bee Agent Framework Integration with MCP Gateway¶
The Bee Agent Framework is an open-source platform developed by IBM for building, deploying, and managing AI agents at scale. Integrating Bee with the Model Context Protocol (MCP) allows agents to dynamically discover and utilize tools hosted on MCP servers, enhancing their capabilities and flexibility.
π§° Key Features¶
- Dynamic Tool Discovery: Agents can fetch available tools from MCP servers in real-time.
- Standardized Communication: Utilizes the open MCP standard for consistent tool integration.
- Multi-Server Support: Interact with tools defined on multiple MCP servers simultaneously.
- Human-in-the-Loop: Incorporate human feedback into agent workflows for improved decision-making.
π Installation¶
To use MCP tools in the Bee Agent Framework, follow these steps:
- Clone the Bee Agent Framework Repository:
bash git clone https://github.com/i-am-bee/bee-agent-framework.git cd bee-agent-framework
- Install Dependencies:
- Set Up the Environment:
Ensure you have Node.js and Yarn installed. You may also need to set environment variables for your MCP server:
π Connecting to MCP Gateway¶
Bee provides a native MCPTool
class to simplify integration with MCP servers. Here's how to set it up:
- Import the MCPTool Class:
- Configure the MCPTool:
const mcpTool = new MCPTool({
baseUrl: process.env.MCP_GATEWAY_BASE_URL,
auth: {
username: process.env.MCP_AUTH_USER,
password: process.env.MCP_AUTH_PASS,
},
});
- Register the Tool with Your Agent:
This setup allows your Bee agent to discover and invoke tools from the specified MCP server dynamically.
π€ Creating an Agent¶
After setting up the MCPTool, you can create a Bee agent:
import { Agent } from 'bee-agent-framework';
const agent = new Agent({
name: 'Data Analyst',
tools: [mcpTool],
});
π§ͺ Using the Agent¶
Once the agent is created, you can assign tasks and execute them:
The agent will utilize tools from the MCP server to accomplish the task.
π Additional Resources¶
- Bee Agent Framework Documentation
- Bee Agent Framework GitHub Repository
- Model Context Protocol Overview