Update navigation and MCP integration#433
Conversation
- Added "MCP" section to `mint.json` for improved documentation navigation. - Integrated environment variable for `BRAVE_API_KEY` in `mcp-npx-brave.py` to enhance security and flexibility. - Updated search agent prompt for better clarity.
|
Caution Review failedThe pull request is closed. WalkthroughThe changes add new documentation files covering Airbnb, Brave Search, and custom MCP integrations for PraisonAI agents, along with updates to the documentation navigation. New agent scripts have been introduced for processing Airbnb booking requests, Brave Search queries, and stock price checks. These scripts leverage the MCP tool with updated API key handling and simplified command arguments. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant A as Airbnb Agent
participant M as MCP (Airbnb)
participant B as Airbnb Service
U->>A: Initiate booking request
A->>M: Send MCP command
M->>B: Process booking
B-->>M: Return booking info
M-->>A: Relay confirmation
A-->>U: Display booking result
sequenceDiagram
participant U as User
participant A as Brave Search Agent
participant M as MCP (Brave Search)
participant S as Brave Search API
U->>A: Initiate search query
A->>M: Send MCP command
M->>S: Query search API
S-->>M: Return results
M-->>A: Relay search results
A-->>U: Display results
sequenceDiagram
participant U as User
participant A as Stock Price Agent
participant M as MCP (Stock Price)
participant S as Stock Price Server
U->>A: Request stock price
A->>M: Send MCP command
M->>S: Retrieve stock data
S-->>M: Return stock price
M-->>A: Relay info
A-->>U: Display stock price
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (9)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Hello @MervinPraison, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request focuses on updating the navigation and integrating Model Context Protocol (MCP) to enhance the functionality of PraisonAI agents. It introduces new documentation pages for Airbnb, Brave Search, and custom Python MCP server integrations. The pull request also includes updates to the mint.json file to reflect these changes in the navigation and incorporates environment variables for API key management in the Brave Search integration.
Highlights
- Documentation: Adds new documentation pages for Airbnb, Brave Search, and custom Python MCP server integrations, providing guides and examples for users.
- MCP Integration: Integrates MCP to enable PraisonAI agents to interact with external tools and services like Airbnb and Brave Search.
- Security: Enhances security by using environment variables for API key management, specifically for the Brave Search integration.
- Navigation: Updates the
mint.jsonfile to include a new "MCP" section in the navigation, improving the discoverability of MCP-related documentation.
Changelog
Click here to see the changelog
- docs/mcp/airbnb.mdx
- Created a new documentation page for Airbnb MCP integration, including a quick start guide, features overview, and code examples for integrating Airbnb booking capabilities with PraisonAI agents.
- docs/mcp/bravesearch.mdx
- Created a new documentation page for Brave Search MCP integration, including a quick start guide, features overview, and code examples for integrating Brave Search capabilities with PraisonAI agents.
- Demonstrates how to set the Brave Search API key as an environment variable for enhanced security.
- docs/mcp/custom.mdx
- Created a new documentation page for custom Python MCP server integration, including a quick start guide, features overview, and code examples for creating and using custom Python MCP servers with PraisonAI agents.
- Provides implementation details for the
FastMCPclass and agent integration.
- docs/mint.json
- Added a new "MCP" section to the navigation to improve the discoverability of MCP-related documentation (lines 78-81).
- Added new entries to the
mint.jsonfile to group the new MCP documentation pages under the "MCP" section (lines 237-244).
- src/praisonai-agents/mcp-mini-airbnb.py
- Added a minimal example file to demonstrate Airbnb MCP integration.
- src/praisonai-agents/mcp-mini-bravesearch.py
- Added a minimal example file to demonstrate Brave Search MCP integration.
- src/praisonai-agents/mcp-npx-brave.py
- Updated the Brave Search integration to use environment variables for the API key (lines 4, 6, 14).
- Simplified the MCP command to use
@modelcontextprotocol/server-brave-searchdirectly (line 13). - Updated the search agent prompt to search for "AI News" instead of "Praison AI" (line 18).
- src/praisonai-agents/mcp-npx-mini-airbnb-stockprice.py
- Added a minimal example file to demonstrate Airbnb and Stockprice MCP integration.
- src/praisonai-agents/mcp-python-stockprice.py
- Added a minimal example file to demonstrate Python Stockprice MCP integration.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
In realms of code, where agents roam,
MCP guides them, bringing tools home.
From Airbnb's listings to Brave's keen search,
AI's potential, within our grasp, we beseech.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
✅ Deploy Preview for praisonai ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Code Review
This pull request introduces new documentation for integrating PraisonAI agents with Model Context Protocol (MCP) servers, including Airbnb, Brave Search, and custom Python implementations. It also updates the navigation in mint.json to include an MCP section. The use of environment variables for API keys is a good security practice. Overall, the changes seem well-structured and provide useful guidance for users.
Summary of Findings
- API Key Security: The use of environment variables for API keys is a good practice, but the example code in
brave_search.pyincludes a default API key. This could lead to unintentional exposure if users don't replace it with their own key. - Path Hardcoding: The custom Python MCP server example in
custom.mdxandmcp-python-stockprice.pyincludes hardcoded paths to the Python interpreter andapp.pyfile. This makes the example less portable and requires users to modify the code to match their environment. - Inconsistent Agent Prompt: The agent prompt in
mcp-npx-brave.pywas updated from 'Praison AI' to 'AI News'. It would be useful to understand the reasoning behind this change and ensure consistency across all examples.
Merge Readiness
The pull request introduces valuable documentation and examples for MCP integration. However, the potential security risk of the default API key in the Brave Search example and the hardcoded paths in the custom Python MCP example should be addressed before merging. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. I would recommend that the pull request not be merged until the high severity issues are addressed.
| # Use the API key from environment or set it directly | ||
| brave_api_key = os.getenv("BRAVE_API_KEY") or "your_brave_api_key_here" |
There was a problem hiding this comment.
While using environment variables is great, providing a default value directly in the code can be a security risk. It's better to force users to explicitly set the environment variable to avoid accidental exposure of the API key. Consider raising an error if the environment variable is not set.
# Use the API key from environment or set it directly
brave_api_key = os.getenv("BRAVE_API_KEY")
if not brave_api_key:
raise ValueError("BRAVE_API_KEY environment variable must be set.")
| import os | ||
|
|
||
| # Use the API key from environment or set it directly | ||
| brave_api_key = os.getenv("BRAVE_API_KEY") or "BSAbRwmwE-WV_7gKR1ZZIdE2Twa0l4w" |
There was a problem hiding this comment.
Including a default API key directly in the code is a security risk. It's better to force users to explicitly set the environment variable to avoid accidental exposure of the API key. Consider raising an error if the environment variable is not set.
| brave_api_key = os.getenv("BRAVE_API_KEY") or "BSAbRwmwE-WV_7gKR1ZZIdE2Twa0l4w" | |
| brave_api_key = os.getenv("BRAVE_API_KEY") | |
| if not brave_api_key: | |
| raise ValueError("BRAVE_API_KEY environment variable must be set.") |
| tools = MCP("/path/to/python /path/to/app.py") | ||
| ) |
There was a problem hiding this comment.
Hardcoding the path to the Python interpreter and the app.py file makes this example less portable. It would be better to use relative paths or environment variables to specify these locations.
agent = Agent(
instructions="""You are a helpful assistant that can check stock prices and perform other tasks.
Use the available tools when relevant to answer user questions.""",
llm="gpt-4o-mini",
tools = MCP("python app.py")
)
| ) | ||
|
|
||
| search_agent.start("Search more information about Praison AI") No newline at end of file | ||
| search_agent.start("Search more information about AI News") No newline at end of file |
There was a problem hiding this comment.
The prompt was changed from 'Praison AI' to 'AI News'. Can you explain the reasoning behind this change? It would be good to ensure consistency across all examples.
| search_agent.start("Search more information about AI News") | |
| search_agent.start("Search more information about Praison AI") |
| instructions="""You are a helpful assistant that can check stock prices and perform other tasks. | ||
| Use the available tools when relevant to answer user questions.""", | ||
| llm="gpt-4o-mini", | ||
| tools = MCP("/Users/praison/miniconda3/envs/mcp/bin/python /Users/praison/stockprice/app.py") |
There was a problem hiding this comment.
Hardcoding the path to the Python interpreter and the app.py file makes this example less portable. It would be better to use relative paths or environment variables to specify these locations.
| tools = MCP("/Users/praison/miniconda3/envs/mcp/bin/python /Users/praison/stockprice/app.py") | |
| tools = MCP("python app.py") |
Update navigation and MCP integration
mint.jsonfor improved documentation navigation.BRAVE_API_KEYinmcp-npx-brave.pyto enhance security and flexibility.Summary by CodeRabbit
Documentation
New Features