Enable network search with MCP2Brave using Python and Brave API key integration
MCP2Brave is an advanced server that leverages Model Context Protocol (MCP) to integrate with AI applications such as Claude Desktop, Continue, and others through a standardized protocol. It enables these AI applications to efficiently query and search the web using Brave API, providing rich textual data directly within the AI's interface.
MCP2Brave offers seamless integration with the Brave network search engine via its extensive API. This server supports two key functions: search_web(query: str)
and search_web_info(query: str)
, which allow AI applications to execute web searches and retrieve detailed information effortlessly.
MCP2Brave is meticulously designed for compatibility with a wide range of MCP clients, including:
MCP2Brave is built with a robust architecture that adheres to the Model Context Protocol, ensuring seamless communication between AI applications and external services. It uses Python 3.11+ for development and relies on Uvicorn (UV) package manager to handle backend operations efficiently.
The core of MCP2Brave's implementation involves setting up an environment, managing dependencies, running command-line tools for deployment, and configuring essential environment variables such as Brave API key.
Brave_API_KEY
to be set in an .env
file for secure and functional operation.To get started, clone the MCP2Brave repository and navigate to the project directory:
git clone <repo-url>
cd mcp2brave
Create and configure an environment variable file with your Brave API key:
.env
# Example:
BRAVE_API_KEY=your-api-key-here
Using Uvicorn, create and activate the virtual environment:
uv venv
# On Windows:
.venv\Scripts\activate
# On Linux/Mac:
source .venv/bin/activate
Once your virtual environment is activated, install all necessary dependencies using Uvicorn:
uv sync
Imagine a chatbot designed to assist with customer queries. By integrating MCP2Brave, the chatbot can quickly access and provide relevant web search results directly within its conversation flow.
A researcher requires quick access to varied online resources. Using MCP2Brave as an intermediary, any AI application can efficiently gather information from a wide range of websites, streamlining the research process by delivering accurate, up-to-date data without manual web searching.
To ensure seamless integration, follow these steps:
Install the MCPServer: Use FastMCP to install MCP2Brave as an extension:
fastmcp install mcp2brave.py
Development Mode: To test MCP2Brave with MCP checkers:
fastmcp dev mcp2brave.py
After running, a local server will start, and you can access the MCP console via http://localhost:5173
.
MCP2Brave is designed to work with specific AI applications:
Below are the MCP protocol flow diagram and a detailed data architecture diagram:
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
graph TB
A["Web Request"] --> B[MCP Server]
B -->
[
Parse & Query API\nBrave Database
] \nC[Data Processing & Return]
C --> D
D --> E["AI Application"]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#d8e9ff
style D fill:#e8f5e8
To manually configure the settings for MCPServer in Cline Continue Claude, add the following information to your server configuration:
{
"mcp2brave": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp",
"--with",
"python-dotenv",
"--with",
"beautifulsoup4",
"--with",
"requests",
"fastmcp",
"run",
"C:\\Users\\youRealPath\\mcp2brave.py"
],
"env": {
"BRAVE_API_KEY": "yourApiKeyHere"
}
}
}
search_web(query: str)
and search_web_info(query: str)
?Brave_API_KEY
, are correctly set in the .env
file before starting the server.Ensure that your system's locale and settings support UTF-8 encoding to avoid these errors.
Yes, MCP2Brave can be deployed on both Windows, Linux, and macOS with minimal configuration adjustments.
Developers often face issues related to environment setup, API key management, and ensuring compatibility across different AI applications.
Contributions are welcome! If you'd like to contribute to MCP2Brave:
Explore more about MCP (Model Context Protocol) in the official documentation and developer community to learn how it enhances AI integrations:
By leveraging MCP2Brave, developers can build highly flexible and powerful AI applications that seamlessly integrate with web data through a standardized protocol.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods