🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
usecase: Camel ACI with MCP + Toolkit and Cloudfare MCP usecase (#2490)
Parth Sharma9c36faa50c07
diff --git a/examples/usecases/aci_mcp/README.md b/examples/usecases/aci_mcp/README.mdnew file mode 100644index 000000000..650e411a3--- /dev/null+++ b/examples/usecases/aci_mcp/README.md@@ -0,0 +1,128 @@+<!--+Copyright 2023-2025 @ CAMEL-AI.org. All Rights Reserved.+Licensed under the Apache License, Version 2.0 (the "License");+you may not use this file except in compliance with the License.+You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++Unless required by applicable law or agreed to in writing, software+distributed under the License is distributed on an "AS IS" BASIS,+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+See the License for the specific language governing permissions and+limitations under the License.+-->+# CAMEL AI with ACI Integration Examples++This repository contains two different approaches to integrate ACI (AI Compute Infrastructure) with CAMEL AI agents:++1. **Direct ACI Toolkit Integration** (`aci_toolkit_camel.py`)+2. **MCP Server Integration** (`camel_mcp_aci.py`)++## 🚀 Features++- **Two Integration Approaches**: Choose between direct ACI toolkit usage or MCP server integration+- **Multiple AI Services**: Access to BRAVE_SEARCH, GITHUB, and ARXIV through ACI+- **Gemini Model Integration**: Uses Google's Gemini 2.5 Pro model for AI responses+- **Error Handling**: Comprehensive error handling with detailed traceback information++## 📁 Project Structure++```+.+├── aci_toolkit_camel.py # Direct ACI Toolkit integration+├── camel_mcp_aci.py # MCP server integration approach+├── create_config.py # MCP configuration generator+├── README.md # This file+└── env.example # Environment variables template+```++## 🛠️ Setup++### Prerequisites++- Python 3.10++- ACI API access+- Google Gemini API access++### Installation++1. **Clone the repository**:+ ```bash+ git clone <repository-url>+ cd camel-ai-aci-examples+ ```++2. **Install dependencies**:+ ```bash+ pip install camel-ai[all] rich aci-mcp+ ```++3. **Set up environment variables**:+ ```bash+ cp env.example .env+ # Edit .env with your API keys and configuration+ ```++## 🔧 Configuration++### Environment Variables++Create a `.env` file with the following variables:++- `ACI_API_KEY`: Your ACI API key+- `GOOGLE_API_KEY`: Your Google Gemini API key+- `LINKED_ACCOUNT_OWNER`: Your linked account owner ID (e.g., GitHub username)++You can get these from:+- **ACI API Key**: Configure your apps and get your key at [ACI Platform](https://platform.aci.dev/apps)+- **Google API Key**: Get your Gemini API key from [Google AI Studio](https://aistudio.google.com/)++## 🎯 Usage++### Approach 1: Direct ACI Toolkit Integration++This approach uses the ACI toolkit directly within the CAMEL AI framework:++```bash+python aci_toolkit_camel.py+```++**Features**:+- Direct integration with ACI toolkit+- Simpler setup and configuration+- Immediate access to ACI tools+- Rich console output with progress indicators++### Approach 2: MCP Server Integration++This approach uses MCP (Model Context Protocol) servers to provide ACI functionality:++```bash+python camel_mcp_aci.py+```++**Features**:+- Uses MCP protocol for tool integration+- More modular and extensible architecture+- Interactive user input for queries+- Automatic configuration generation+- Support for multiple MCP servers++## 🔧 Troubleshooting++### Common Issues++1. **Missing API Keys**: Ensure all required environment variables are set in your `.env` file+2. **ACI MCP Installation**: Make sure `aci-mcp` is properly installed for MCP approach+3. **Network Issues**: Check internet connectivity for API calls+4. **Permission Issues**: Ensure proper permissions for file creation (config.json)++### Debug Mode++Both scripts include comprehensive error handling with traceback information for debugging.++## Links++- [CAMEL-AI](https://github.com/camel-ai/camel) - Multi-agent framework+- [ACI](https://github.com/aci-labs) - AI Compute Infrastructurediff --git a/examples/usecases/aci_mcp/aci_toolkit_camel.py b/examples/usecases/aci_mcp/aci_toolkit_camel.pynew file mode 100644index 000000000..8ac5d8264--- /dev/null+++ b/examples/usecases/aci_mcp/aci_toolkit_camel.py@@ -0,0 +1,74 @@+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+#!/usr/bin/env python3+import os++from dotenv import load_dotenv+from rich import print as rprint++from camel.agents import ChatAgent+from camel.models import ModelFactory+from camel.toolkits import ACIToolkit+from camel.types import ModelPlatformType, ModelType++load_dotenv()+++def main():+ rprint("[green]CAMEL AI with ACI Toolkit[/green]")++ # get the linked account from env or use default+ linked_account = os.getenv("LINKED_ACCOUNT_OWNER", "parthshr370")+ rprint(f"Using account: [cyan]{linked_account}[/cyan]")++ # setup aci toolkit+ aci_toolkit = ACIToolkit(linked_account_owner_id=linked_account)+ tools = aci_toolkit.get_tools()+ rprint(f"Loaded [cyan]{len(tools)}[/cyan] tools")++ # setup gemini model+ model = ModelFactory.create(+ model_platform=ModelPlatformType.GEMINI,+ model_type=ModelType.GEMINI_2_5_PRO_PREVIEW,+ api_key=os.getenv("GOOGLE_API_KEY"),+ model_config_dict={"temperature": 0.5, "max_tokens": 4000},+ )++ # create agent with tools+ agent = ChatAgent(model=model, tools=tools)+ rprint("[green]Agent ready[/green]")++ # get user query+ query = input("\nEnter your query: ")++ rprint("\n[yellow]Processing...[/yellow]")+ response = agent.step(query)++ # show raw response+ rprint(f"\n[dim]{response.msg}[/dim]")++ rprint(f"\n[dim]Raw response type: {type(response)}[/dim]")+ rprint(f"[dim]Response: {response}[/dim]")++ # try to get the actual content+ if hasattr(response, 'msgs') and response.msgs:+ rprint(f"\nFound [cyan]{len(response.msgs)}[/cyan] messages:")+ for i, msg in enumerate(response.msgs):+ rprint(f"Message {i + 1}: {msg.content}")++ rprint("\n[green]Done[/green]")+++if __name__ == "__main__":+ main()diff --git a/examples/usecases/aci_mcp/camel_mcp_aci.py b/examples/usecases/aci_mcp/camel_mcp_aci.pynew file mode 100644index 000000000..394b11ef6--- /dev/null+++ b/examples/usecases/aci_mcp/camel_mcp_aci.py@@ -0,0 +1,99 @@+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+#!/usr/bin/env python3+import asyncio+import os++from dotenv import load_dotenv+from rich import print as rprint++from camel.agents import ChatAgent+from camel.messages import BaseMessage+from camel.models import ModelFactory+from camel.toolkits import MCPToolkit+from camel.types import ModelPlatformType, ModelType++load_dotenv()++async def main():+ try:+ from create_config import create_config++ rprint("[green]CAMEL AI Agent with MCP Toolkit[/green]")++ # create config for mcp server+ create_config()++ # connect to mcp server+ rprint("Connecting to MCP server...")+ mcp_toolkit = MCPToolkit(config_path="config.json")+ await mcp_toolkit.connect()+ tools = mcp_toolkit.get_tools()++ rprint(f"Connected successfully. Found [cyan]{len(tools)}[/cyan] tools available")++ # setup gemini model+ model = ModelFactory.create(+ model_platform=ModelPlatformType.GEMINI,+ model_type=ModelType.GEMINI_2_5_PRO_PREVIEW,+ api_key=os.getenv("GOOGLE_API_KEY"),+ model_config_dict={"temperature": 0.7, "max_tokens": 4000},+ )++ system_message = BaseMessage.make_assistant_message(+ role_name="Assistant",+ content="You are a helpful assistant with access to search, GitHub, and arXiv tools.",+ )++ # create camel agent+ agent = ChatAgent(+ system_message=system_message,+ model=model,+ tools=tools,+ )++ rprint("[green]Agent ready[/green]")++ # get user query+ user_query = input("\nEnter your query: ")+ user_message = BaseMessage.make_user_message(role_name="User", content=user_query)++ rprint("\n[yellow]Processing...[/yellow]")+ response = await agent.astep(user_message)++ # show raw response for debugging+ rprint(f"\n[dim]Raw response type: {type(response)}[/dim]")+ rprint(f"[dim]Response: {response}[/dim]")++ # try to get actual content+ if response and hasattr(response, "msgs") and response.msgs:+ rprint(f"\nFound [cyan]{len(response.msgs)}[/cyan] messages:")+ for i, msg in enumerate(response.msgs):+ rprint(f"Message {i+1}: {msg.content}")+ elif response:+ rprint(f"Response content: {response}")+ else:+ rprint("[red]No response received[/red]")++ # disconnect from mcp+ await mcp_toolkit.disconnect()+ rprint("\n[green]Done[/green]")++ except Exception as e:+ rprint(f"[red]Error: {e}[/red]")+ import traceback+ rprint(f"[dim]{traceback.format_exc()}[/dim]")++if __name__ == "__main__":+ asyncio.run(main())\ No newline at end of filediff --git a/examples/usecases/aci_mcp/create_config.py b/examples/usecases/aci_mcp/create_config.pynew file mode 100644index 000000000..600380ac4--- /dev/null+++ b/examples/usecases/aci_mcp/create_config.py@@ -0,0 +1,53 @@+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+import json+import os++from dotenv import load_dotenv+++def create_config():+ """Create MCP config with proper environment variable substitution"""+ load_dotenv()++ aci_api_key = os.getenv("ACI_API_KEY")+ if not aci_api_key:+ raise ValueError("ACI_API_KEY environment variable is required")++ config = {+ "mcpServers": {+ "aci_apps": {+ "command": "uvx",+ "args": [+ "aci-mcp",+ "apps-server",+ "--apps=BRAVE_SEARCH,GITHUB,ARXIV",+ "--linked-account-owner-id",+ "<YOUR_LINKED_ACCOUNT_ID>",+ ],+ "env": {"ACI_API_KEY": aci_api_key},+ }+ }+ }++ # Write to config.json+ with open("config.json", "w") as f:+ json.dump(config, f, indent=2)++ print("✓ Config created successfully with API key")+ return config+++if __name__ == "__main__":+ create_config()diff --git a/examples/usecases/aci_mcp/env.example b/examples/usecases/aci_mcp/env.examplenew file mode 100644index 000000000..bc36866e8--- /dev/null+++ b/examples/usecases/aci_mcp/env.example@@ -0,0 +1,25 @@+# CAMEL-AI and ACI Environment Configuration Template++# How to use:+# 1. Make a copy of this file and name it .env (e.g., `cp .env.template .env`)+# 2. Fill in the values for each variable below.+# 3. Ensure the .env file is in the same directory as your main scripts (e.g., aci-portia/)+# or that your scripts load it correctly if it's located elsewhere.+#+# Add .env to your .gitignore file.++# --- Google Generative AI Configuration ---+# Required for CAMEL-AI to use Google's language models (e.g., Gemini).+# Paste your gemini api key here and configure the model in the config.py+GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY_HERE"++# --- ACI aipolabs app mcp server ---+# Required for using ACI tools via the MCP (Model Contex Protocol) server.+# How to get:+# configure your apps and get your aci key at - https://platform.aci.dev/apps+# Notes:+# - Replace <YOUR_ACI_API_KEY> with the API key from Project Settings.+# - Replace <YOUR_LINKED_ACCOUNT_OWNER_ID> with the ID you set during the OAuth flow.+# - Ensure 'uv' is installed: pip install uv+ACI_API_KEY="YOUR_ACI_API_KEY_HERE"+diff --git a/examples/usecases/cloudfare_mcp_camel/README.md b/examples/usecases/cloudfare_mcp_camel/README.mdnew file mode 100644index 000000000..674b082d8--- /dev/null+++ b/examples/usecases/cloudfare_mcp_camel/README.md@@ -0,0 +1,112 @@+<!--+Copyright 2023-2025 @ CAMEL-AI.org. All Rights Reserved.+Licensed under the Apache License, Version 2.0 (the "License");+you may not use this file except in compliance with the License.+You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++Unless required by applicable law or agreed to in writing, software+distributed under the License is distributed on an "AS IS" BASIS,+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+See the License for the specific language governing permissions and+limitations under the License.+-->+# Cloudflare MCP with Camel-ai++This project provides a Streamlit-based web interface to interact with public Cloudflare MCP (Model-Controlled Proxy) servers. It allows users to easily query Cloudflare's documentation, get internet traffic insights from Cloudflare Radar, and perform browser actions like fetching web pages or taking screenshots, all powered by CAMEL AI.++## Features++- **Interactive UI**: A user-friendly interface built with Streamlit.+- **Tabbed Navigation**: Separate tabs for different Cloudflare services:+ - 📚 **Documentation Server**: Ask questions and get information from Cloudflare's official documentation.+ - 📊 **Radar Server**: Access insights on global internet traffic trends, URL analysis, DNS analytics, and HTTP protocol analysis.+ - 🌐 **Browser Server**: Fetch web page content, take screenshots of URLs, or convert web pages to Markdown.+- **Powered by CAMEL AI**: Leverages the CAMEL AI library to interact with the MCP servers and process language queries.+- **Easy Configuration**: Uses a `mcp_config.json` file to define accessible MCP servers.++## Prerequisites++- Python 3.10++- Node.js and npm (for `npx mcp-remote` if your `mcp_config.json` uses it)+- A Gemini API Key (or another compatible model API key supported by CAMEL AI)++## Setup++1. **Clone the repository (if applicable):**+ ```bash+ # git clone <repository-url>+ # cd <repository-name>+ ```++2. **Create and activate a virtual environment (recommended):**+ ```bash+ python -m venv venv+ source venv/bin/activate # On Windows use `venv\Scripts\activate`+ ```++3. **Install dependencies:**+ ```bash+ pip install -r requirements.txt+ ```+ If `mcp-remote` is used by your `mcp_config.json` (as in the default configuration for this project), ensure it can be executed. You might need to install it globally or ensure `npx` can run it:+ ```bash+ npm install -g mcp-remote+ ```++4. **Set up your API Key:**+ Create a `.env` file in the root directory of the project and add your Gemini API key:+ ```env+ GEMINI_API_KEY="YOUR_GEMINI_API_KEY_HERE"+ ```++5. **Configure MCP Servers:**+ The `mcp_config.json` file lists the MCP servers the application will connect to. The default configuration includes public Cloudflare servers:+ ```json+ {+ "servers": [+ {+ "name": "cloudflare_docs",+ "url": "https://docs.mcp.cloudflare.com/sse"+ },+ {+ "name": "cloudflare_radar",+ "url": "https://radar.mcp.cloudflare.com/sse"+ },+ {+ "name": "cloudflare_browser",+ "url": "https://browser.mcp.cloudflare.com/sse"+ }+ ]+ }+ ```+ If your `mcp_config.json` uses the `mcpServers` block with `command: "npx"` and `args: ["mcp-remote", "..."]`, ensure `npx` and `mcp-remote` are correctly installed and accessible in your system's PATH.++## Running the Application++Once the setup is complete, run the Streamlit application using:++```bash+streamlit run app.py+```++The application will open in your default web browser, usually at `http://localhost:8501`.++## Project Structure++- `app.py`: The main Streamlit application script.+- `mcp_config.json`: Configuration file for MCP servers.+- `requirements.txt`: Python dependencies.+- `.env`: (You create this) Stores your API key.+- `README.md`: This file.++## Troubleshooting++- **`openai.InternalServerError: Error code: 500`**: This usually indicates a temporary issue with the backend LLM service (e.g., Gemini). Try again after a few moments. If persistent, check the status of the LLM provider.+- **`AttributeError: 'ChatAgentResponse' object has no attribute 'content'`**: Ensure your `app.py` correctly parses the response from `agent.step()`. It should typically be `response.msgs[0].content`.+- **`mcp-remote` not found**: If your `mcp_config.json` uses `mcp-remote`, ensure it's installed (`npm install -g mcp-remote`) and `npx` is in your system's PATH.++## Contributing++Feel free to open issues or submit pull requests if you have suggestions for improvements or bug fixes.diff --git a/examples/usecases/cloudfare_mcp_camel/app.py b/examples/usecases/cloudfare_mcp_camel/app.pynew file mode 100644index 000000000..e5a5284f6--- /dev/null+++ b/examples/usecases/cloudfare_mcp_camel/app.py@@ -0,0 +1,176 @@+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+import os++import dotenv+import streamlit as st++from camel.agents import ChatAgent+from camel.messages import BaseMessage+from camel.models import ModelFactory+from camel.toolkits import MCPToolkit+from camel.types import ModelPlatformType, ModelType++# Load environment variables+dotenv.load_dotenv()++# Initialize the model+model = ModelFactory.create(+ model_platform=ModelPlatformType.GEMINI,+ model_type=ModelType.GEMINI_2_5_PRO_PREVIEW,+ api_key=os.getenv("GEMINI_API_KEY"),+ model_config_dict={"temperature": 0.5, "max_tokens": 4096},+)++# Initialize MCP toolkit+mcp_toolkit = MCPToolkit(config_path="mcp_config.json")++# Create the ChatAgent+agent = ChatAgent(+ system_message=BaseMessage(+ role_name="cloudflare assistant",+ role_type="assistant",+ meta_dict={},+ content="You are a helpful assistant that can access Cloudflare's services via MCP"+ ),+ model=model,+ tools=mcp_toolkit.get_tools(),+)++# Set page config+st.set_page_config(+ page_title="Cloudflare MCP Interface",+ page_icon="☁️",+ layout="wide"+)++# Title and description+st.title("☁️ Cloudflare MCP Interface")+st.markdown("""+This interface allows you to interact with Cloudflare's public MCP servers:+- 📚 Documentation Server+- 📊 Radar Server (Internet Traffic Insights)+- 🌐 Browser Server (Web Page Analysis)+""")++# Create tabs for different services+tab1, tab2, tab3 = st.tabs(["📚 Documentation", "📊 Radar", "🌐 Browser"])++# Documentation Tab+with tab1:+ st.header("Cloudflare Documentation")+ st.markdown("Ask questions about Cloudflare's documentation and services.")++ doc_query = st.text_area("Enter your documentation query:", height=100)+ if st.button("Search Documentation", key="doc_search"):+ if doc_query:+ with st.spinner("Searching documentation..."):+ response = agent.step(doc_query)+ st.markdown("### Response:")+ # Access the message content from the response+ if hasattr(response, 'msgs') and response.msgs:+ st.markdown(response.msgs[0].content)+ else:+ st.error("No response content available")+ else:+ st.warning("Please enter a query.")++# Radar Tab+with tab2:+ st.header("Cloudflare Radar")+ st.markdown("Get insights about internet traffic and trends.")++ radar_options = st.selectbox(+ "Select Radar Query Type:",+ ["Traffic Trends", "URL Analysis", "DNS Analytics", "HTTP Protocol Analysis"]+ )++ if radar_options == "Traffic Trends":+ st.markdown("Get insights about global internet traffic trends.")+ trend_query = st.text_input("Enter your trend query (e.g., 'Show me traffic trends for the last week'):")+ elif radar_options == "URL Analysis":+ st.markdown("Analyze a specific URL's traffic and performance.")+ url = st.text_input("Enter URL to analyze:")+ trend_query = f"Analyze traffic and performance for {url}"+ elif radar_options == "DNS Analytics":+ st.markdown("Get DNS-related insights and analytics.")+ domain = st.text_input("Enter domain name:")+ trend_query = f"Show DNS analytics for {domain}"+ else: # HTTP Protocol Analysis+ st.markdown("Get insights about HTTP protocol usage.")+ trend_query = "Show HTTP protocol analysis and trends"++ if st.button("Get Radar Insights", key="radar_search"):+ if trend_query:+ with st.spinner("Fetching radar insights..."):+ response = agent.step(trend_query)+ st.markdown("### Radar Insights:")+ if hasattr(response, 'msgs') and response.msgs:+ st.markdown(response.msgs[0].content)+ else:+ st.error("No response content available")+ else:+ st.warning("Please enter required information.")++# Browser Tab+with tab3:+ st.header("Cloudflare Browser")+ st.markdown("Fetch and analyze web pages.")++ browser_options = st.selectbox(+ "Select Browser Action:",+ ["Fetch Page", "Take Screenshot", "Convert to Markdown"]+ )++ url = st.text_input("Enter URL:")++ if browser_options == "Fetch Page":+ action = "Fetch and analyze the content of"+ elif browser_options == "Take Screenshot":+ action = "Take a screenshot of"+ else: # Convert to Markdown+ action = "Convert to markdown the content of"++ if st.button("Execute Browser Action", key="browser_action"):+ if url:+ with st.spinner("Processing..."):+ query = f"{action} {url}"+ response = agent.step(query)+ st.markdown("### Result:")+ if hasattr(response, 'msgs') and response.msgs:+ st.markdown(response.msgs[0].content)+ else:+ st.error("No response content available")+ else:+ st.warning("Please enter a URL.")++# Add a sidebar with information+with st.sidebar:+ st.header("About")+ st.markdown("""+ This interface provides access to Cloudflare's public MCP servers, powered by CAMEL AI:++ - **Documentation Server**: Access Cloudflare's documentation+ - **Radar Server**: Get internet traffic insights+ - **Browser Server**: Fetch and analyze web pages++ Select a tab above to interact with each service.+ """)++ st.header("Tips")+ st.markdown("""+ - Be specific in your queries+ - For Radar insights, try different query types+ - For Browser actions, ensure URLs are complete+ """)\ No newline at end of filediff --git a/examples/usecases/cloudfare_mcp_camel/mcp_config.json b/examples/usecases/cloudfare_mcp_camel/mcp_config.jsonnew file mode 100644index 000000000..d64273781--- /dev/null+++ b/examples/usecases/cloudfare_mcp_camel/mcp_config.json@@ -0,0 +1,50 @@+{+ "servers": [+ {+ "name": "cloudflare_docs",+ "url": "https://docs.mcp.cloudflare.com/sse"+ },+ {+ "name": "cloudflare_radar",+ "url": "https://radar.mcp.cloudflare.com/sse"+ },+ {+ "name": "cloudflare_browser",+ "url": "https://browser.mcp.cloudflare.com/sse"+ }+ ],+ "mcpServers": {+ "cloudflare-docs": {+ "command": "npx",+ "args": ["mcp-remote", "https://docs.mcp.cloudflare.com/sse"]+ },+ "cloudflare-bindings": {+ "command": "npx",+ "args": ["mcp-remote", "https://bindings.mcp.cloudflare.com/sse"]+ },+ "cloudflare-observability": {+ "command": "npx",+ "args": ["mcp-remote", "https://observability.mcp.cloudflare.com/sse"]+ },+ "cloudflare-radar": {+ "command": "npx",+ "args": ["mcp-remote", "https://radar.mcp.cloudflare.com/sse"]+ },+ "cloudflare-browser": {+ "command": "npx",+ "args": ["mcp-remote", "https://browser.mcp.cloudflare.com/sse"]+ },+ "cloudflare-logs": {+ "command": "npx",+ "args": ["mcp-remote", "https://logs.mcp.cloudflare.com/sse"]+ },+ "cloudflare-ai-gateway": {+ "command": "npx",+ "args": ["mcp-remote", "https://ai-gateway.mcp.cloudflare.com/sse"]+ },+ "cloudflare-dns-analytics": {+ "command": "npx",+ "args": ["mcp-remote", "https://dns-analytics.mcp.cloudflare.com/sse"]+ }+ }+}\ No newline at end of filediff --git a/examples/usecases/cloudfare_mcp_camel/requirements.txt b/examples/usecases/cloudfare_mcp_camel/requirements.txtnew file mode 100644index 000000000..531af0b66--- /dev/null+++ b/examples/usecases/cloudfare_mcp_camel/requirements.txt@@ -0,0 +1,3 @@+streamlit>=1.32.0+camel-ai[all]==0.2.59+python-dotenv>=1.0.0\ No newline at end of filediff --git a/examples/usecases/cloudfare_mcp_camel/run_cloudflare_mcp_with_camel_ai.py b/examples/usecases/cloudfare_mcp_camel/run_cloudflare_mcp_with_camel_ai.pynew file mode 100644index 000000000..364b6a196--- /dev/null+++ b/examples/usecases/cloudfare_mcp_camel/run_cloudflare_mcp_with_camel_ai.py@@ -0,0 +1,55 @@+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+from camel.agents import ChatAgent+from camel.messages import BaseMessage+from camel.models import ModelFactory+from camel.toolkits import MCPToolkit+import dotenv+import os++dotenv.load_dotenv()++sys_msg = BaseMessage(+ role_name="cloudfare assistant",+ role_type="assistant",+ meta_dict={},+ content="You are a helpful assistant that can access Cloudflare's documentation via MCP"+)+++# Initialize the model (using Anthropic's Claude as an example)+model = ModelFactory.create(+ model_platform="gemini",+ model_type="gemini-2.5-pro-preview-05-06",+ api_key=os.getenv("GEMINI_API_KEY"),+ model_config_dict={"temperature": 0.5, "max_tokens": 4096},+ )++#configure the mcp camel toolkit with the path of the config file+mcp_toolkit = MCPToolkit(config_path="mcp_config.json")++# Get the tools from the toolkit+mcp_tools = mcp_toolkit.get_tools()++# Create the ChatAgent with the system message, model, and toolkit+agent = ChatAgent(+ system_message=sys_msg,+ model=model,+ tools=mcp_tools,+)++# Example interaction with the agent+user_msg = "list me the index of the documentation?"+response = agent.step(user_msg)+print(response)\ No newline at end of file