add run_mcp instructions and new requirements

This commit is contained in:
jjyaoao
2025-03-13 11:09:18 +08:00
parent 3e25766f00
commit 40574fb0b9
3 changed files with 81 additions and 4 deletions

View File

@@ -1,3 +1,74 @@
"""MCP Multi-Agent System Example
This example demonstrates how to use MCP (Model Context Protocol) with CAMEL agents
for advanced information retrieval and processing tasks.
Environment Setup:
1. Configure the required dependencies of owl library.
2. Go Environment (v1.23.2+):
```bash
# Verify Go installation
go version
# Add Go binary path to PATH
export PATH=$PATH:~/go/bin
# Note: Add to ~/.bashrc or ~/.zshrc for persistence
```
3. Playwright Setup:
```bash
# Install Node.js and npm first
npm install -g @executeautomation/playwright-mcp-server
npx playwright install-deps
# Configure in mcp_servers_config.json:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["-y", "@executeautomation/playwright-mcp-server"]
}
}
}
```
4. MCP Filesystem Server Setup:
```bash
# Install MCP filesystem server
go install github.com/mark3labs/mcp-filesystem-server@latest
npm install -g @modelcontextprotocol/server-filesystem
# Configure mcp_servers_config.json in owl/utils/mcp/
{
"mcpServers": {
"filesystem": {
"command": "mcp-filesystem-server",
"args": [
"/home/your_path",
"/home/your_path"
],
"type": "filesystem"
}
}
}
```
Usage:
1. Ensure all MCP servers are properly configured in mcp_servers_config.json
2. Run this script to create a multi-agent system that can:
- Access and manipulate files through MCP filesystem server
- Perform web automation tasks using Playwright
- Process and generate information using GPT-4o
3. The system will execute the specified task while maintaining security through
relative paths and controlled access
Note:
- All file operations are restricted to configured directories
- System uses GPT-4o for both user and assistant roles
- Supports asynchronous operations for efficient processing
"""
import asyncio
from pathlib import Path
from typing import List
@@ -9,7 +80,7 @@ from camel.toolkits import FunctionTool
from camel.types import ModelPlatformType, ModelType
from camel.logger import set_log_level
from utils.async_role_playing import OwlRolePlaying, run_society
from utils.enhanced_role_playing import OwlRolePlaying, run_society
from utils.mcp.mcp_toolkit_manager import MCPToolkitManager
@@ -71,7 +142,7 @@ async def main():
question = (
"I'd like a academic report about Guohao Li, including his research "
"direction, published papers (up to 20), institutions, etc."
"direction, published papers (At least 3), institutions, etc."
"Then organize the report in Markdown format and save it to my desktop"
)

View File

@@ -7,10 +7,15 @@
"/Users/username/Downloads"
]
},
"playwright": {
"command": "npx",
"args": ["-y", "@executeautomation/playwright-mcp-server"]
},
"simple-arxiv": {
"command": "python",
"args": ["-m", "mcp_simple_arxiv"]
}
},
"mcpWebServers": {}
}
}

View File

@@ -3,4 +3,5 @@ chunkr-ai>=0.0.41
docx2markdown>=0.1.1
gradio>=3.50.2
mcp==1.3.0
mcp-simple-arxiv==0.2.2
mcp-simple-arxiv==0.2.2
mcp-server-fetch==2025.1.17