Skip to content

armgit / camel

Public Imported from GitHub
0

๐Ÿซ CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

feat: Add Airbnb MCP integration use case for CAMEL Agents as MCP Client (#2393)

Sarthak Bhardwaj056802005870
diff --git a/apps/Airbnb-MCP/README.md b/apps/Airbnb-MCP/README.md
new file mode 100644
index 000000000..773af87ca
--- /dev/null
+++ b/apps/Airbnb-MCP/README.md
@@ -0,0 +1,118 @@
+# ๐Ÿก Airbnb Listings Search (Streamlit + CAMEL-AI + MCP)
+
+A Streamlit app that leverages the [CAMEL-AI OWL framework](https://github.com/camel-ai/owl) and **MCP (Model Context Protocol)** to automatically search Airbnb listings via a custom MCP server. The app displays search parameters and returns the top 5 listings in a clean, responsive card-grid UI.
+
+---
+
+## โœจ Features
+
+- **Interactive UI**: Sidebar for entering city, check-in/out dates and number of adults.
+- **Session state**: Remembers your last chosen dates.
+- **Agent-driven search**: Uses a CAMEL-AI `ChatAgent` + MCPToolkit to query Airbnb via `@openbnb/mcp-server-airbnb`.
+- **Responsive cards**: Displays each listing in its own styled card.
+![Airbnb Listings Search UI](assets/screenshot.png)
+---
+
+## ๐Ÿ“‹ Prerequisites
+
+- Python >=3.10,<3.13
+- Node.js & npm (for the MCP server plugin)
+- A valid OpenAI API key set in your environment:
+ ```bash
+ export OPENAI_API_KEY="your_api_key_here"
+ ```
+
+---
+
+## ๐Ÿ› ๏ธ Setup
+
+1. **Clone the repo**
+
+ ```bash
+ git clone https://github.com/your-org/your-repo.git
+ cd your-repo/owl/community_usecase/Airbnb-MCP
+ ```
+
+2. **Create a virtual environment**
+
+ ```bash
+ python -m venv venv
+ source venv/bin/activate # macOS/Linux
+ venv\\Scripts\\activate # Windows
+ ```
+
+3. **Install Python dependencies**
+
+ ```bash
+ pip install -r requirements.txt
+ ```
+
+---
+
+## โš™๏ธ Configuration
+
+1. **Environment variables**
+ Create a `.env` file in the project root with:
+ ```ini
+ OPENAI_API_KEY=your_openai_key_here
+ ```
+
+2. **MCP Server config**
+ Ensure `mcp_servers_config.json` (next to `app.py`) contains:
+ ```json
+ {
+ "mcpServers": {
+ "airbnb": {
+ "command": "npx",
+ "args": ["-y", "@openbnb/mcp-server-airbnb", "--ignore-robots-txt"]
+ }
+ }
+ }
+ ```
+
+---
+
+## ๐Ÿš€ Running the App
+
+From the `Airbnb-MCP` folder, run:
+
+```bash
+streamlit run app.py
+```
+
+This will launch the Streamlit UI in your browser. Use the sidebar to choose your city, dates and number of guests, then click **Search Listings**.
+
+---
+
+## ๐Ÿ”ง Customization
+
+- **Prompt**: Edit the search prompt inside `app.py` if you want to tweak wording or number of results.
+- **Styling**: Modify the CSS in the header section of `app.py` to change colors, fonts or card layout.
+- **Logging**: Change `set_log_level("DEBUG")` to `INFO` in production.
+
+---
+
+## ๐Ÿ“‚ Project Structure
+
+```
+Airbnb-MCP/
+โ”œโ”€โ”€ assets/
+โ”‚ โ”œโ”€โ”€ logo_camel_ai.png
+โ”‚ โ””โ”€โ”€ logo_airbnb_mcp.png
+โ”œโ”€โ”€ mcp_servers_config.json
+โ”œโ”€โ”€ app.py # Main Streamlit application
+โ”œโ”€โ”€ requirements.txt # Python deps
+โ””โ”€โ”€ .env # Env file with OPENAI_API_KEY
+```
+
+---
+
+## ๐Ÿ“š References
+
+- [CAMEL-AI OWL Framework](https://github.com/camel-ai/owl)
+- [Anthropic MCP Docs](https://docs.anthropic.com/en/docs/agents-and-tools/mcp)
+- [@openbnb/mcp-server-airbnb (npm)](https://www.npmjs.com/package/@openbnb/mcp-server-airbnb)
+
+---
+
+*Happy listing searches!*
diff --git a/apps/Airbnb-MCP/app.py b/apps/Airbnb-MCP/app.py
new file mode 100644
index 000000000..1f998f39e
--- /dev/null
+++ b/apps/Airbnb-MCP/app.py
@@ -0,0 +1,136 @@
+# ========= 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 asyncio
+import base64
+import datetime
+from pathlib import Path
+
+import streamlit as st
+from dotenv import load_dotenv
+
+from camel.agents import ChatAgent
+from camel.logger import set_log_level
+from camel.models import ModelFactory
+from camel.toolkits import MCPToolkit
+from camel.types import ModelPlatformType, ModelType
+
+# โ€”โ€”โ€” Page config โ€”โ€”โ€”
+st.set_page_config(page_title="Airbnb Listings Search", layout="wide")
+
+
+# โ€”โ€”โ€” Load & encode logos โ€”โ€”โ€”
+with open("assets/logo_camel_ai.png", "rb") as f:
+ camel_bytes = f.read()
+with open("assets/logo_airbnb_mcp.png", "rb") as f:
+ airbnb_bytes = f.read()
+
+camel_b64 = base64.b64encode(camel_bytes).decode()
+airbnb_b64 = base64.b64encode(airbnb_bytes).decode()
+
+# โ€”โ€”โ€” Header with Logos โ€”โ€”โ€”
+st.markdown(
+ f"""
+ <div style="text-align: center; margin-bottom: 2rem;">
+ <h1>Airbnb Listings Search</h1>
+ <img src="data:image/png;base64,{camel_b64}" width="80" alt="Camel-AI logo" style="margin:0 20px;" />
+ <img src="data:image/png;base64,{airbnb_b64}" width="80" alt="Airbnb MCP logo" style="margin:0 20px;" />
+ <p style="font-size:14px; color:gray; margin-top:0.5rem;">
+ Powered by Camel-AI &amp; Airbnb MCP
+ </p>
+ </div>
+ """, # noqa: E501
+ unsafe_allow_html=True,
+)
+
+# โ€”โ€”โ€” Load env & logging โ€”โ€”โ€”
+load_dotenv()
+set_log_level("DEBUG")
+
+# โ€”โ€”โ€” Persist defaults โ€”โ€”โ€”
+if "checkin" not in st.session_state:
+ st.session_state.checkin = datetime.date.today()
+if "checkout" not in st.session_state:
+ st.session_state.checkout = datetime.date.today() + datetime.timedelta(
+ days=1
+ )
+
+# โ€”โ€”โ€” Sidebar inputs โ€”โ€”โ€”
+st.sidebar.header("Search parameters")
+city = st.sidebar.text_input("City", "")
+checkin = st.sidebar.date_input("Check-in", value=st.session_state.checkin)
+checkout = st.sidebar.date_input("Check-out", value=st.session_state.checkout)
+adults = st.sidebar.number_input("Adults", min_value=1, value=2)
+
+# โ€”โ€”โ€” Main: show parameters & run search โ€”โ€”โ€”
+if st.sidebar.button("Search Listings"):
+ # Save for next time
+ st.session_state.checkin = checkin
+ st.session_state.checkout = checkout
+
+ # Quick summary on the main page
+ st.subheader("๐Ÿ” You are searching for")
+ cols = st.columns(4)
+ cols[0].metric("City", city)
+ cols[1].metric("Check-in", checkin.strftime("%Y-%m-%d"))
+ cols[2].metric("Check-out", checkout.strftime("%Y-%m-%d"))
+ cols[3].metric("Adults", adults)
+
+ # Build prompt
+ prompt = f"""
+ Find me the best Airbnb in {city} with a check-in date
+ of {checkin:%Y-%m-%d} and a check-out date of
+ {checkout:%Y-%m-%d} for {adults} adults.
+ Return the top 5 listings with their names, prices, and locations.
+ """
+
+ # Run the agent
+ with st.spinner("Searchingโ€ฆ"):
+
+ async def run_task():
+ config_path = Path(__file__).parent / "mcp_servers_config.json"
+ mcp = MCPToolkit(config_path=str(config_path))
+ await mcp.connect()
+ tools = list(mcp.get_tools())
+ agent = ChatAgent(
+ system_message="You are an Airbnb search assistant.",
+ model=ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0.7},
+ ),
+ tools=tools,
+ )
+ res = await agent.astep(prompt)
+ try:
+ await mcp.disconnect()
+ except Exception:
+ pass
+ return res
+
+ result = asyncio.run(run_task())
+
+ # Show results
+ st.success("Search complete!")
+ st.markdown("### Results")
+ st.markdown(result.msgs[0].content)
+# โ€”โ€”โ€” Footer โ€”โ€”โ€”
+st.markdown(
+ """
+ <hr style="margin-top:3rem">
+ <p style="text-align:center; color:gray; font-size:0.8rem;">
+ Powered by Camel-AI &amp; Airbnb MCP
+ </p>
+ """,
+ unsafe_allow_html=True,
+)
diff --git a/apps/Airbnb-MCP/assets/logo_airbnb_mcp.png b/apps/Airbnb-MCP/assets/logo_airbnb_mcp.png
new file mode 100644
index 000000000..8b5b43395
Binary files /dev/null and b/apps/Airbnb-MCP/assets/logo_airbnb_mcp.png differ
diff --git a/apps/Airbnb-MCP/assets/logo_camel_ai.png b/apps/Airbnb-MCP/assets/logo_camel_ai.png
new file mode 100644
index 000000000..9b1050150
Binary files /dev/null and b/apps/Airbnb-MCP/assets/logo_camel_ai.png differ
diff --git a/apps/Airbnb-MCP/assets/screenshot.png b/apps/Airbnb-MCP/assets/screenshot.png
new file mode 100644
index 000000000..c5e8ea5df
Binary files /dev/null and b/apps/Airbnb-MCP/assets/screenshot.png differ
diff --git a/apps/Airbnb-MCP/mcp_servers_config.json b/apps/Airbnb-MCP/mcp_servers_config.json
new file mode 100644
index 000000000..7fb2e637f
--- /dev/null
+++ b/apps/Airbnb-MCP/mcp_servers_config.json
@@ -0,0 +1,12 @@
+{
+ "mcpServers": {
+ "airbnb": {
+ "command": "npx",
+ "args": [
+ "-y",
+ "@openbnb/mcp-server-airbnb",
+ "--ignore-robots-txt"
+ ]
+ }
+ }
+}
diff --git a/apps/Airbnb-MCP/requirements.txt b/apps/Airbnb-MCP/requirements.txt
new file mode 100644
index 000000000..c80191302
--- /dev/null
+++ b/apps/Airbnb-MCP/requirements.txt
@@ -0,0 +1,4 @@
+camel-ai[all]
+streamlit
+python-dotenv
+
diff --git a/apps/chat_with_github/README.md b/apps/chat_with_github/README.md
new file mode 100644
index 000000000..94280f08a
--- /dev/null
+++ b/apps/chat_with_github/README.md
@@ -0,0 +1,116 @@
+````markdown
+# ๐Ÿค– GitHub Repo Chat Explorer
+
+A Streamlit-based chat interface powered by **CAMEL-AI** and **MCP (Model Context Protocol)** that lets you conversationally explore any GitHub repository. Ask questions like "How many files?", "Show me the README contents", or follow-up queriesโ€”all in context of the chosen repo.
+
+---
+
+## โœจ Features
+
+- **Interactive Chat UI**: Chat with your repository using Streamlit's chat components.
+- **Dynamic Context**: Set or change the GitHub repo URL in the sidebar to switch contexts on the fly.
+- **Session Memory**: Keeps your question-answer history until you change the repo.
+- **Agent-Powered**: Under the hood, a `ChatAgent` + MCPToolkit fetches and processes repo data.
+
+---
+
+## ๐Ÿ“ธ Screenshot
+
+![Repo Chat Explorer UI](assets/screenshot_chat.png)
+
+_A conversation where the user asks about the repo structure and README file._
+
+---
+
+## ๐Ÿ“‹ Prerequisites
+
+- Python >=3.10,<3.13
+- Node.js & npm (for MCP server plugin)
+- OpenAI API key in `.env`:
+ ```bash
+ export OPENAI_API_KEY="your_key_here"
+ ```
+
+---
+
+## ๐Ÿ› ๏ธ Installation
+
+1. **Clone the repo**
+
+ ```bash
+ git clone https://github.com/your-org/your-repo.git
+ cd your-repo/owl/community_usecase/gitingest
+ ```
+
+2. **Python environment**
+
+ ```bash
+ python -m venv venv
+ source venv/bin/activate # macOS/Linux
+ venv\\Scripts\\activate # Windows
+ pip install -r requirements.txt
+ ```
+
+3. **Install MCP plugin**
+
+ ```bash
+ npm install -g @openbnb/mcp-server-git
+ ```
+
+---
+
+## โš™๏ธ Configuration
+
+- **.env**: Create in project root:
+ ```ini
+ OPENAI_API_KEY=your_key_here
+ ```
+- **mcp_servers_config.json**: Next to `app.py`:
+ ```json
+ {
+ "mcpServers": {
+ "gitingest": {
+ "command": "npx",
+ "args": ["-y", "@openbnb/mcp-server-git"]
+ }
+ }
+ }
+ ```
+
+---
+
+## ๐Ÿš€ Running the App
+
+```bash
+streamlit run app.py
+```
+Set the repo in the sidebar, then start chatting!
+
+---
+
+## ๐Ÿ”ง Customization
+
+- Tweak system prompts in `st.chat_message` calls.
+- Adjust temperature or model type in `ModelFactory.create`.
+- Style the UI via CSS in the header section.
+
+---
+
+## ๐Ÿ“‚ Project Structure
+
+```
+Gitingest/
+โ”œโ”€โ”€ assets/
+โ”‚ โ”œโ”€โ”€ logo_camel_ai.png
+โ”‚ โ”œโ”€โ”€ logo_github.png
+โ”‚ โ””โ”€โ”€ screenshot_chat.png
+โ”œโ”€โ”€ mcp_servers_config.json
+โ”œโ”€โ”€ app.py # Main Streamlit chat app
+โ”œโ”€โ”€ requirements.txt # Python dependencies
+โ””โ”€โ”€ .env # Env vars
+```
+
+---
+
+*Happy repo chatting!*
+````
diff --git a/apps/chat_with_github/app.py b/apps/chat_with_github/app.py
new file mode 100644
index 000000000..34471cc15
--- /dev/null
+++ b/apps/chat_with_github/app.py
@@ -0,0 +1,130 @@
+# ========= 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 asyncio
+import base64
+import logging
+from pathlib import Path
+
+import streamlit as st
+from dotenv import load_dotenv
+
+from camel.agents import ChatAgent
+from camel.logger import set_log_level
+from camel.models import ModelFactory
+from camel.toolkits import MCPToolkit
+from camel.types import ModelPlatformType, ModelType
+
+# Silence noisy asyncio cancellation messages
+logging.getLogger("asyncio").setLevel(logging.CRITICAL)
+
+# โ€”โ€”โ€” Page Config โ€”โ€”โ€”
+st.set_page_config(page_title="Chat with your Repo", layout="wide")
+
+# โ€”โ€”โ€” Load assets & logos โ€”โ€”โ€”
+ROOT = Path(__file__).resolve().parents[2]
+ROOT = Path(__file__).resolve().parent
+ASSETS = ROOT / "assets"
+with open(ASSETS / "logo_camel_ai.png", "rb") as f:
+ camel_b64 = base64.b64encode(f.read()).decode()
+with open(ASSETS / "logo_github.jpg", "rb") as f:
+ gh_b64 = base64.b64encode(f.read()).decode()
+
+# โ€”โ€”โ€” Header โ€”โ€”โ€”
+st.markdown(
+ f"""
+ <div style='text-align:center; margin-bottom:2rem;'>
+ <h1>Chat with any Github Repo</h1>
+ <img src='data:image/png;base64,{camel_b64}' width='80' style='margin:0 20px;'>
+ <img src='data:image/png;base64,{gh_b64}' width='80' style='margin:0 20px;'>
+ <p style='font-size:14px; color:gray;'>Powered by Camel-AI &amp; Git-Ingest MCP</p>
+ </div>
+ """, # noqa: E501
+ unsafe_allow_html=True,
+)
+
+# โ€”โ€”โ€” Initialize โ€”โ€”โ€”
+load_dotenv()
+set_log_level("DEBUG")
+
+# โ€”โ€”โ€” Session State Setup โ€”โ€”โ€”
+if 'repo_url' not in st.session_state:
+ st.session_state['repo_url'] = ''
+if 'messages' not in st.session_state:
+ st.session_state['messages'] = []
+
+# โ€”โ€”โ€” Sidebar: Repo Input โ€”โ€”โ€”
+st.sidebar.header("Repository")
+repo = st.sidebar.text_input("GitHub Repo URL", st.session_state['repo_url'])
+if st.sidebar.button("Set Repo"):
+ st.session_state['repo_url'] = repo.strip()
+ st.session_state['messages'] = [] # reset conversation
+
+# โ€”โ€”โ€” Main: Chat UI โ€”โ€”โ€”
+if not st.session_state['repo_url']:
+ st.info("Please set a GitHub repository URL in the sidebar to start.")
+ st.stop()
+
+# Display existing messages
+for msg in st.session_state['messages']:
+ if msg['role'] == 'user':
+ st.chat_message('user').markdown(msg['content'])
+ else:
+ st.chat_message('assistant').markdown(msg['content'])
+
+# Chat input
+if user_input := st.chat_input("Ask a question about the repoโ€ฆ"):
+ # Add user message
+ st.session_state['messages'].append(
+ {'role': 'user', 'content': user_input}
+ )
+ st.chat_message('user').markdown(user_input)
+
+ # Define async function to query the agent
+ async def query_agent(question: str):
+ config_path = Path(__file__).parent / "mcp_servers_config.json"
+ toolkit = MCPToolkit(config_path=str(config_path))
+ await toolkit.connect()
+ tools = list(toolkit.get_tools())
+ agent = ChatAgent(
+ system_message=f"You are a GitHub repo assistant. Repository: {st.session_state['repo_url']}", # noqa: E501
+ model=ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0},
+ ),
+ tools=tools,
+ )
+ prompt = f"{question}\nRepository: {st.session_state['repo_url']}"
+ response = await agent.astep(prompt)
+ await toolkit.disconnect()
+ return response.msgs[0].content
+
+ # Run the agent
+ with st.spinner("Thinkingโ€ฆ"):
+ answer = asyncio.run(query_agent(user_input))
+
+ # Display assistant reply
+ st.session_state['messages'].append(
+ {'role': 'assistant', 'content': answer}
+ )
+ st.chat_message('assistant').markdown(answer)
+
+# โ€”โ€”โ€” Footer โ€”โ€”โ€”
+st.markdown(
+ """
+ <hr>
+ <p style='text-align:center; color:gray; font-size:0.8rem;'>Powered by Camel-AI &amp; GitHub MCP</p>
+ """, # noqa: E501
+ unsafe_allow_html=True,
+)
diff --git a/apps/chat_with_github/assets/logo_camel_ai.png b/apps/chat_with_github/assets/logo_camel_ai.png
new file mode 100644
index 000000000..9b1050150
Binary files /dev/null and b/apps/chat_with_github/assets/logo_camel_ai.png differ
diff --git a/apps/chat_with_github/assets/logo_github.jpg b/apps/chat_with_github/assets/logo_github.jpg
new file mode 100644
index 000000000..52c497a6c
Binary files /dev/null and b/apps/chat_with_github/assets/logo_github.jpg differ
diff --git a/apps/chat_with_github/assets/screenshot_chat.png b/apps/chat_with_github/assets/screenshot_chat.png
new file mode 100644
index 000000000..270dbe1a6
Binary files /dev/null and b/apps/chat_with_github/assets/screenshot_chat.png differ
diff --git a/apps/chat_with_github/demo_git_ingest.py b/apps/chat_with_github/demo_git_ingest.py
new file mode 100644
index 000000000..886a59d66
--- /dev/null
+++ b/apps/chat_with_github/demo_git_ingest.py
@@ -0,0 +1,127 @@
+# ========= 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 asyncio
+import base64
+import logging
+from pathlib import Path
+
+import streamlit as st
+from dotenv import load_dotenv
+
+from camel.agents import ChatAgent
+from camel.logger import set_log_level
+from camel.models import ModelFactory
+from camel.toolkits import MCPToolkit
+from camel.types import ModelPlatformType, ModelType
+
+# Silence noisy asyncio cancellation messages
+logging.getLogger("asyncio").setLevel(logging.CRITICAL)
+
+# โ€”โ€”โ€” Page Config โ€”โ€”โ€”
+st.set_page_config(page_title="GitHub Repo Explorer", layout="wide")
+
+# โ€”โ€”โ€” Load assets & logos โ€”โ€”โ€”
+ROOT = Path(__file__).resolve().parents[2]
+ASSETS = ROOT / "assets"
+with open(ASSETS / "logo_camel_ai.png", "rb") as f:
+ camel_b64 = base64.b64encode(f.read()).decode()
+with open(ASSETS / "logo_github.JPG", "rb") as f:
+ gh_b64 = base64.b64encode(f.read()).decode()
+
+# โ€”โ€”โ€” Header โ€”โ€”โ€”
+st.markdown(
+ f"""
+ <div style='text-align:center; margin-bottom:2rem;'>
+ <h1>GitHub Repo Explorer</h1>
+ <img src='data:image/png;base64,{camel_b64}' width='80' alt='Camel-AI' style='margin:0 20px;'>
+ <img src='data:image/png;base64,{gh_b64}' width='80' alt='GitHub' style='margin:0 20px;'>
+ <p style='font-size:14px; color:gray;'>Powered by Camel-AI &amp; Git-Ingest MCP</p>
+ </div>
+ """, # noqa: E501
+ unsafe_allow_html=True,
+)
+
+# โ€”โ€”โ€” Initialize โ€”โ€”โ€”
+load_dotenv()
+set_log_level("DEBUG")
+
+# โ€”โ€”โ€” Sidebar Inputs โ€”โ€”โ€”
+st.sidebar.header("Search parameters")
+repo_url = st.sidebar.text_input(
+ "GitHub Repo URL", "https://github.com/1sarthakbhardwaj/Ollama"
+)
+query = st.sidebar.text_area(
+ "Query", "Show me the directory tree of this repository.", height=100
+)
+
+# โ€”โ€”โ€” Run query โ€”โ€”โ€”
+if st.sidebar.button("Run Query"):
+ # echo parameters
+ st.subheader("๐Ÿ” Your search parameters")
+ cols = st.columns(2)
+ cols[0].write(f"**Repo URL:** {repo_url}")
+ cols[1].write(f"**Query:** {query}")
+
+ # call agent
+ async def run_task():
+ config = Path(__file__).parent / "mcp_servers_config.json"
+ toolkit = MCPToolkit(config_path=str(config))
+ await toolkit.connect()
+ tools = list(toolkit.get_tools())
+ agent = ChatAgent(
+ system_message="You are a GitHub repo explorer.",
+ model=ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0},
+ ),
+ tools=tools,
+ )
+ prompt = f"{query}\nRepository: {repo_url}"
+ resp = await agent.astep(prompt)
+ await toolkit.disconnect()
+ return resp
+
+ with st.spinner("Running queryโ€ฆ"):
+ result = asyncio.run(run_task())
+
+ # display
+ st.success("Query complete!")
+ st.markdown("### Result")
+
+ raw = result.msgs[0].content or ""
+ # strip fences
+ lines = [
+ line for line in raw.splitlines() if not line.strip().startswith("```")
+ ]
+ clean = "\n".join(lines).strip()
+ st.code(clean)
+
+ # tool calls
+ st.markdown("### Tool Calls")
+ for rec in result.info.get("tool_calls", []):
+ name = getattr(rec, "tool_name", None) or getattr(
+ rec, "name", "<unknown>"
+ )
+ args = getattr(rec, "args", None) or getattr(rec, "arguments", {})
+ st.markdown(f"- **{name}**: `{args}`")
+
+# โ€”โ€”โ€” Footer โ€”โ€”โ€”
+st.markdown(
+ """
+ <hr>
+ <p style='text-align:center; color:gray; font-size:0.8rem;'>Powered by Camel-AI &amp; GitHub MCP</p>
+ """, # noqa: E501
+ unsafe_allow_html=True,
+)
diff --git a/apps/chat_with_github/mcp_servers_config.json b/apps/chat_with_github/mcp_servers_config.json
new file mode 100644
index 000000000..c7dfe5857
--- /dev/null
+++ b/apps/chat_with_github/mcp_servers_config.json
@@ -0,0 +1,13 @@
+{
+ "mcpServers": {
+ "mcp-git-ingest": {
+ "command": "uvx",
+ "args": [
+ "--from",
+ "git+https://github.com/adhikasp/mcp-git-ingest",
+ "mcp-git-ingest"
+ ]
+ }
+ }
+ }
+
\ No newline at end of file
diff --git a/apps/chat_with_github/requirements.txt b/apps/chat_with_github/requirements.txt
new file mode 100644
index 000000000..c80191302
--- /dev/null
+++ b/apps/chat_with_github/requirements.txt
@@ -0,0 +1,4 @@
+camel-ai[all]
+streamlit
+python-dotenv
+