update run_mcp and requirements
Browse files- owl/mcp_servers_config.json +5 -14
- owl/run_mcp.py +52 -42
- requirements.txt +0 -2
owl/mcp_servers_config.json
CHANGED
@@ -1,25 +1,16 @@
|
|
1 |
{
|
2 |
"mcpServers": {
|
3 |
-
"
|
4 |
-
"command": "
|
5 |
"args": [
|
6 |
-
"
|
7 |
-
"/
|
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 |
-
"fetch": {
|
19 |
-
"command": "python",
|
20 |
-
"args": ["-m", "mcp_server_fetch"]
|
21 |
}
|
22 |
-
}
|
23 |
-
"mcpWebServers": {}
|
24 |
}
|
25 |
|
|
|
1 |
{
|
2 |
"mcpServers": {
|
3 |
+
"desktop-commander": {
|
4 |
+
"command": "npx",
|
5 |
"args": [
|
6 |
+
"-y",
|
7 |
+
"@wonderwhy-er/desktop-commander"
|
8 |
]
|
9 |
},
|
10 |
"playwright": {
|
11 |
"command": "npx",
|
12 |
"args": ["-y", "@executeautomation/playwright-mcp-server"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
+
}
|
|
|
15 |
}
|
16 |
|
owl/run_mcp.py
CHANGED
@@ -4,21 +4,33 @@ This example demonstrates how to use MCP (Model Context Protocol) with CAMEL age
|
|
4 |
for advanced information retrieval and processing tasks.
|
5 |
|
6 |
Environment Setup:
|
7 |
-
1. Configure the required dependencies of owl library
|
|
|
8 |
|
9 |
-
2.
|
|
|
|
|
|
|
10 |
```bash
|
11 |
-
#
|
12 |
-
|
|
|
13 |
|
14 |
-
#
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
```
|
18 |
|
19 |
-
|
20 |
```bash
|
21 |
-
# Install
|
22 |
npm install -g @executeautomation/playwright-mcp-server
|
23 |
npx playwright install-deps
|
24 |
|
@@ -33,22 +45,17 @@ Environment Setup:
|
|
33 |
}
|
34 |
```
|
35 |
|
36 |
-
|
37 |
```bash
|
38 |
-
# Install MCP
|
39 |
-
|
40 |
-
npm install -g @modelcontextprotocol/server-filesystem
|
41 |
|
42 |
-
# Configure mcp_servers_config.json
|
43 |
{
|
44 |
"mcpServers": {
|
45 |
-
"
|
46 |
-
"command": "
|
47 |
-
"args": [
|
48 |
-
"/home/your_path",
|
49 |
-
"/home/your_path"
|
50 |
-
],
|
51 |
-
"type": "filesystem"
|
52 |
}
|
53 |
}
|
54 |
}
|
@@ -57,11 +64,12 @@ Environment Setup:
|
|
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
|
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 |
-
|
65 |
|
66 |
Note:
|
67 |
- All file operations are restricted to configured directories
|
@@ -135,27 +143,29 @@ async def construct_society(
|
|
135 |
|
136 |
async def main():
|
137 |
config_path = Path(__file__).parent / "mcp_servers_config.json"
|
138 |
-
|
139 |
mcp_toolkit = MCPToolkit(config_path=str(config_path))
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
159 |
|
160 |
if __name__ == "__main__":
|
161 |
asyncio.run(main())
|
|
|
4 |
for advanced information retrieval and processing tasks.
|
5 |
|
6 |
Environment Setup:
|
7 |
+
1. Configure the required dependencies of owl library
|
8 |
+
Refer to: https://github.com/camel-ai/owl for installation guide
|
9 |
|
10 |
+
2. MCP Server Setup:
|
11 |
+
|
12 |
+
2.1 MCP Desktop Commander (File System Service):
|
13 |
+
Prerequisites: Node.js and npm
|
14 |
```bash
|
15 |
+
# Install MCP service
|
16 |
+
npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude
|
17 |
+
npx @wonderwhy-er/desktop-commander setup
|
18 |
|
19 |
+
# Configure in owl/mcp_servers_config.json:
|
20 |
+
{
|
21 |
+
"desktop-commander": {
|
22 |
+
"command": "npx",
|
23 |
+
"args": [
|
24 |
+
"-y",
|
25 |
+
"@wonderwhy-er/desktop-commander"
|
26 |
+
]
|
27 |
+
}
|
28 |
+
}
|
29 |
```
|
30 |
|
31 |
+
2.2 MCP Playwright Service:
|
32 |
```bash
|
33 |
+
# Install MCP service
|
34 |
npm install -g @executeautomation/playwright-mcp-server
|
35 |
npx playwright install-deps
|
36 |
|
|
|
45 |
}
|
46 |
```
|
47 |
|
48 |
+
2.3 MCP Fetch Service (Optional - for better retrieval):
|
49 |
```bash
|
50 |
+
# Install MCP service
|
51 |
+
pip install mcp-server-fetch
|
|
|
52 |
|
53 |
+
# Configure in mcp_servers_config.json:
|
54 |
{
|
55 |
"mcpServers": {
|
56 |
+
"fetch": {
|
57 |
+
"command": "python",
|
58 |
+
"args": ["-m", "mcp_server_fetch"]
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
}
|
61 |
}
|
|
|
64 |
Usage:
|
65 |
1. Ensure all MCP servers are properly configured in mcp_servers_config.json
|
66 |
2. Run this script to create a multi-agent system that can:
|
67 |
+
- Access and manipulate files through MCP Desktop Commander
|
68 |
- Perform web automation tasks using Playwright
|
69 |
- Process and generate information using GPT-4o
|
70 |
+
- Fetch web content (if fetch service is configured)
|
71 |
3. The system will execute the specified task while maintaining security through
|
72 |
+
controlled access
|
73 |
|
74 |
Note:
|
75 |
- All file operations are restricted to configured directories
|
|
|
143 |
|
144 |
async def main():
|
145 |
config_path = Path(__file__).parent / "mcp_servers_config.json"
|
|
|
146 |
mcp_toolkit = MCPToolkit(config_path=str(config_path))
|
147 |
|
148 |
+
try:
|
149 |
+
await mcp_toolkit.connect()
|
150 |
+
|
151 |
+
question = (
|
152 |
+
"I'd like a academic report about Andrew Ng, including his research "
|
153 |
+
"direction, published papers (At least 3), institutions, etc."
|
154 |
+
"Then organize the report in Markdown format and save it to my desktop"
|
155 |
+
)
|
156 |
+
|
157 |
+
# Connect to all MCP toolkits
|
158 |
+
tools = [*mcp_toolkit.get_tools()]
|
159 |
+
society = await construct_society(question, tools)
|
160 |
+
answer, chat_history, token_count = await run_society(society)
|
161 |
+
print(f"\033[94mAnswer: {answer}\033[0m")
|
162 |
+
|
163 |
+
finally:
|
164 |
+
# Make sure to disconnect safely after all operations are completed.
|
165 |
+
try:
|
166 |
+
await mcp_toolkit.disconnect()
|
167 |
+
except Exception as e:
|
168 |
+
print(f"Warning: Error during disconnect: {e}")
|
169 |
|
170 |
if __name__ == "__main__":
|
171 |
asyncio.run(main())
|
requirements.txt
CHANGED
@@ -2,5 +2,3 @@ camel-ai[all]==0.2.28
|
|
2 |
chunkr-ai>=0.0.41
|
3 |
docx2markdown>=0.1.1
|
4 |
gradio>=3.50.2
|
5 |
-
mcp-simple-arxiv==0.2.2
|
6 |
-
mcp-server-fetch==2025.1.17
|
|
|
2 |
chunkr-ai>=0.0.41
|
3 |
docx2markdown>=0.1.1
|
4 |
gradio>=3.50.2
|
|
|
|