add run_mcp instructions and new requirements
Browse files- owl/run_mcp.py +73 -2
- owl/utils/mcp/mcp_servers_config.json +6 -1
- requirements.txt +2 -1
owl/run_mcp.py
CHANGED
@@ -1,3 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import asyncio
|
2 |
from pathlib import Path
|
3 |
from typing import List
|
@@ -9,7 +80,7 @@ from camel.toolkits import FunctionTool
|
|
9 |
from camel.types import ModelPlatformType, ModelType
|
10 |
from camel.logger import set_log_level
|
11 |
|
12 |
-
from utils.
|
13 |
|
14 |
from utils.mcp.mcp_toolkit_manager import MCPToolkitManager
|
15 |
|
@@ -71,7 +142,7 @@ async def main():
|
|
71 |
|
72 |
question = (
|
73 |
"I'd like a academic report about Guohao Li, including his research "
|
74 |
-
"direction, published papers (
|
75 |
"Then organize the report in Markdown format and save it to my desktop"
|
76 |
)
|
77 |
|
|
|
1 |
+
"""MCP Multi-Agent System Example
|
2 |
+
|
3 |
+
This example demonstrates how to use MCP (Model Context Protocol) with CAMEL agents
|
4 |
+
for advanced information retrieval and processing tasks.
|
5 |
+
|
6 |
+
Environment Setup:
|
7 |
+
1. Configure the required dependencies of owl library.
|
8 |
+
|
9 |
+
2. Go Environment (v1.23.2+):
|
10 |
+
```bash
|
11 |
+
# Verify Go installation
|
12 |
+
go version
|
13 |
+
|
14 |
+
# Add Go binary path to PATH
|
15 |
+
export PATH=$PATH:~/go/bin
|
16 |
+
# Note: Add to ~/.bashrc or ~/.zshrc for persistence
|
17 |
+
```
|
18 |
+
|
19 |
+
3. Playwright Setup:
|
20 |
+
```bash
|
21 |
+
# Install Node.js and npm first
|
22 |
+
npm install -g @executeautomation/playwright-mcp-server
|
23 |
+
npx playwright install-deps
|
24 |
+
|
25 |
+
# Configure in mcp_servers_config.json:
|
26 |
+
{
|
27 |
+
"mcpServers": {
|
28 |
+
"playwright": {
|
29 |
+
"command": "npx",
|
30 |
+
"args": ["-y", "@executeautomation/playwright-mcp-server"]
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
```
|
35 |
+
|
36 |
+
4. MCP Filesystem Server Setup:
|
37 |
+
```bash
|
38 |
+
# Install MCP filesystem server
|
39 |
+
go install github.com/mark3labs/mcp-filesystem-server@latest
|
40 |
+
npm install -g @modelcontextprotocol/server-filesystem
|
41 |
+
|
42 |
+
# Configure mcp_servers_config.json in owl/utils/mcp/
|
43 |
+
{
|
44 |
+
"mcpServers": {
|
45 |
+
"filesystem": {
|
46 |
+
"command": "mcp-filesystem-server",
|
47 |
+
"args": [
|
48 |
+
"/home/your_path",
|
49 |
+
"/home/your_path"
|
50 |
+
],
|
51 |
+
"type": "filesystem"
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
```
|
56 |
+
|
57 |
+
Usage:
|
58 |
+
1. Ensure all MCP servers are properly configured in mcp_servers_config.json
|
59 |
+
2. Run this script to create a multi-agent system that can:
|
60 |
+
- Access and manipulate files through MCP filesystem server
|
61 |
+
- Perform web automation tasks using Playwright
|
62 |
+
- Process and generate information using GPT-4o
|
63 |
+
3. The system will execute the specified task while maintaining security through
|
64 |
+
relative paths and controlled access
|
65 |
+
|
66 |
+
Note:
|
67 |
+
- All file operations are restricted to configured directories
|
68 |
+
- System uses GPT-4o for both user and assistant roles
|
69 |
+
- Supports asynchronous operations for efficient processing
|
70 |
+
"""
|
71 |
+
|
72 |
import asyncio
|
73 |
from pathlib import Path
|
74 |
from typing import List
|
|
|
80 |
from camel.types import ModelPlatformType, ModelType
|
81 |
from camel.logger import set_log_level
|
82 |
|
83 |
+
from utils.enhanced_role_playing import OwlRolePlaying, run_society
|
84 |
|
85 |
from utils.mcp.mcp_toolkit_manager import MCPToolkitManager
|
86 |
|
|
|
142 |
|
143 |
question = (
|
144 |
"I'd like a academic report about Guohao Li, including his research "
|
145 |
+
"direction, published papers (At least 3), institutions, etc."
|
146 |
"Then organize the report in Markdown format and save it to my desktop"
|
147 |
)
|
148 |
|
owl/utils/mcp/mcp_servers_config.json
CHANGED
@@ -7,10 +7,15 @@
|
|
7 |
"/Users/username/Downloads"
|
8 |
]
|
9 |
},
|
|
|
|
|
|
|
|
|
10 |
"simple-arxiv": {
|
11 |
"command": "python",
|
12 |
"args": ["-m", "mcp_simple_arxiv"]
|
13 |
}
|
14 |
},
|
15 |
"mcpWebServers": {}
|
16 |
-
}
|
|
|
|
7 |
"/Users/username/Downloads"
|
8 |
]
|
9 |
},
|
10 |
+
"playwright": {
|
11 |
+
"command": "npx",
|
12 |
+
"args": ["-y", "@executeautomation/playwright-mcp-server"]
|
13 |
+
},
|
14 |
"simple-arxiv": {
|
15 |
"command": "python",
|
16 |
"args": ["-m", "mcp_simple_arxiv"]
|
17 |
}
|
18 |
},
|
19 |
"mcpWebServers": {}
|
20 |
+
}
|
21 |
+
|
requirements.txt
CHANGED
@@ -3,4 +3,5 @@ chunkr-ai>=0.0.41
|
|
3 |
docx2markdown>=0.1.1
|
4 |
gradio>=3.50.2
|
5 |
mcp==1.3.0
|
6 |
-
mcp-simple-arxiv==0.2.2
|
|
|
|
3 |
docx2markdown>=0.1.1
|
4 |
gradio>=3.50.2
|
5 |
mcp==1.3.0
|
6 |
+
mcp-simple-arxiv==0.2.2
|
7 |
+
mcp-server-fetch==2025.1.17
|