Rick

Rick
Rick

Sunday, December 1, 2024

MCP Integration: How Brave Search and Claude Desktop Enhance AI Assistant Agentic Capabilities

 

Introduction to Anthropic’s new Agentic MCP Integration

The Model Context Protocol (MCP) has revolutionized how AI assistants interact with external data sources. Introduced by Anthropic in late 2024, MCP enables AI to go beyond its traditional constraints, making it more proactive, contextual, and integrated into our workflows.

This article focuses on setting up the Brave Search MCP plugin for Claude Desktop to empower your AI assistant with advanced web search capabilities. Whether you’re a developer or a casual user, this guide will help you integrate this tool to leverage AI’s full potential.

This is a continuation of Rick’s recent article on Setting up Claude Filesystem MCP, but it’s a standalone guide. First, we’ll delve into an in-depth discussion of MCP. Then, we’ll explore practical hands-on use cases that demonstrate the Brave search connector with the Claude client. This hands-on approach will help you grasp the power of the MCP architecture.

This guide will walk you through setting up Brave Search integration with Claude Desktop using the Model Context Protocol (MCP). Beyond adding search features, you’ll learn about MCP’s potential to transform how AI assistants connect with external tools. The guide covers API key setup, Claude Desktop configuration, integration testing, and troubleshooting. You’ll gain practical experience with MCP while enhancing Claude’s search capabilities.

Learning MCP hands-on is valuable for developers and technologists who want to explore AI agent development. You can apply these principles to build your own MCP integrations that connect AI assistants with databases, APIs, and custom tools. Whether you want to enhance Claude Desktop today or explore the future of AI integration, this guide offers a practical foundation for working with this powerful protocol.

Brave Search MCP Integration Process. Powering Agentic AI.

Unlocking the Power of MCP with Client-Server Architecture

The Model Context Protocol (MCP) represents a significant breakthrough in the integration of artificial intelligence (AI) with external data sources. By establishing a standardized framework for connecting AI systems to tools, repositories, and datasets, MCP eliminates the gap between isolated AI assistants and the information they require to deliver contextually relevant and highly capable results. At the heart of its design lies a client-server architecture that guarantees seamless and secure data access.

Integrating AI Datasource and resources. Powering Agentic AI with Claude MCP.
Integrating Resources with AI

MCP Hosts: Empowering Applications

At the core of the MCP framework are MCP hosts, which act as the central hubs for applications that require data access. Applications like Claude Desktop leverage these hosts to orchestrate and manage multiple connections to various data sources. The host ensures security, enforces permissions, and aggregates the data needed to enhance the AI’s contextual understanding, making tools like Claude more responsive, informed, and powerful.

MCP Hosts Controlling Access to Local and Remote Resources. Powering Agentic AI.
MCP Hosts Controlling Access to Local and Remote Resources

MCP Clients: The Agentic Communication Bridge

At the heart of the MCP framework lies the MCP host, serving as the central hub for applications that necessitate data access. Applications such as Claude Desktop utilize these hosts to orchestrate and manage multiple connections to diverse data sources. The host ensures security, imposes permissions, and aggregates the required data to enhance the AI’s contextual comprehension, thereby making tools like Claude more responsive, knowledgeable, and potent.

MCP Client
MCP Client: routing messages to resources and providing access to data sources

MCP Servers: Unlocking Agentic Functionality

At the heart of the MCP architecture are the specialized servers, known as MCP servers. These servers serve as gateways to various data sources, providing the tools and interfaces necessary for accessing files on local filesystems, retrieving records from databases, and searching the web through Brave Search. Each server is designed to focus on a specific type of resource or function, ensuring modularity and composability within the MCP ecosystem.

Unified Data Access Through MCP Servers. Powering Agentic AI.
Unified Data Access Through MCP Servers

Local and Remote Resources: The Agentic Data Backbone

The true power of MCP lies in its ability to seamlessly connect AI assistants with both local and remote resources. These resources can range from files stored on a user’s computer to remote APIs, databases, or cloud-based services. By integrating these diverse resources into the AI workflow, MCP enables AI systems to access, analyze, and act upon the data required for a wide range of applications.

MCP’s Role in AI Integration with Cloud Services, Local resources, Remote APIs and Data sources. Powering Agentic AI.
MCP’s Role in AI Integration with Cloud Services, Local resources, Remote APIs and Data sources

Bridging AI and Data: The MCP Promise

Together, these components form a cohesive architecture that transforms AI assistants from isolated tools into dynamic agents capable of accessing and utilizing a vast array of data sources. By combining host applications, communication clients, specialized servers, and diverse resources, MCP not only simplifies integration but also expands the horizons of what AI can achieve. With this robust architecture, users can unlock a future where AI works more intelligently, intuitively, and effectively.

Components of MCP Architecture. Servers, Clients, Hosts and access to Resources: APIs, DataSources etc. Powering Agentic AI.
Components of MCP Architecture. Servers, Clients, Hosts and access to Resources: APIs, DataSources etc.

What is Brave Search MCP?

Brave Search MCP serves as a bridge between Claude Desktop and Brave’s privacy-oriented web search engine. This integration seamlessly integrates Claude with MCP’s structured connectivity, granting users effortless access to both web and local searches.

Brave Search MCP offers a range of features, including:

  • Real-time web information retrieval.
  • Context-based local searches for enhanced results.
  • Privacy-respecting AI-assisted research.

Now that we have covered the background information, let’s set up Brave Search with the Claude client. This hands-on experience will help you truly understand the power of MCP once you see it integrate with one of the plugins.

Brave Search API and Claude. Powering Agentic AI.
Brave Search API and Claude.

Prerequisites to provide Agentic Search

Before diving into the setup, ensure you have:

Setting Up Brave Search MCP Agentic Plugin for Claude Desktop

Step 1: Obtain the Brave Search API Key

  1. Visit the Brave Search API.
  2. Sign up or log in.
  3. Select a plan (free tier supports 2,000 queries per month).
  4. Generate your API key and store it securely.

Step 2: Configure Claude Desktop

Locate Configuration File

The Claude Desktop configuration file resides at:

~/Library/Application Support/Claude/claude_desktop_config.json

Add Brave Search MCP Server Configuration

Open the file in your editor:

code ~/Library/Application\\ Support/Claude/claude_desktop_config.json

Insert or merge the following configuration:

{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/richardhightower/src",
"/Users/richardhightower/clients"
]
},
"brave-search": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-brave-search"
],
"env": {
"BRAVE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}

This configuration step is crucial for enabling the Brave Search MCP integration with Claude Desktop. The JSON configuration file specifies how Claude Desktop should interact with the Brave Search service, including the necessary command-line arguments and environment variables.

After adding or modifying this configuration, it’s essential to completely restart Claude Desktop for the changes to take effect. Simply closing and reopening the application window is not sufficient — you must fully quit Claude Desktop (using ⌘+Q on macOS or the equivalent on your operating system) and then relaunch it.

The restart allows Claude Desktop to properly initialize the MCP servers with the new configuration and establish the necessary connections for the Brave Search integration to function.

Remember, replace YOUR_API_KEY_HERE with the API key obtained in Step 1.

If starting from scratch, use:

cat > ~/Library/Application\\ Support/Claude/claude_desktop_config.json << 'EOL'
{
"mcpServers": {
"brave-search": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-brave-search"
],
"env": {
"BRAVE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}
EOL

The alternate approach shown above uses the Unix/Linux cat command with a "here document" (heredoc) to create the configuration file in one step. This method is particularly useful when setting up the configuration for the first time, as it creates the entire file structure at once without needing to manually edit an existing file.

The heredoc syntax (&lt;&lt; 'EOL') allows you to input multiple lines of text until the delimiter (EOL) is reached. The single quotes around EOL prevent variable expansion, ensuring the configuration is written exactly as specified.

This command will create the configuration file in the correct location with the proper JSON structure. Remember to replace YOUR_API_KEY_HERE with your actual Brave Search API key before running the command.

Step 3: Restart Claude Desktop

After saving changes:

  1. Quit Claude Desktop (⌘+Q on macOS).
  2. Relaunch the application to load the new configuration.

Testing the Integration

Basic Commands

  1. Web Search:
Can you search for recent trends in generative AI?

2. Local Search:

Find restaurants near [your location].

Verification

Observe whether Claude retrieves relevant results. If issues arise, refer to the troubleshooting section.

Don’t worry, I will walk you through a couple of sample sessions with the Claude Desktop and Brave search.

Troubleshooting Common Issues

Configuration Not Loading

  • Verify JSON Syntax: Use a JSON validator to check for errors.
  • Permissions: Ensure proper read/write permissions for the configuration file.
  • Correct Path: Double-check the file’s location.

API Key Problems

  • Ensure the API key is accurately copied without extra spaces.
  • Verify the key’s status in the Brave Search dashboard.

Node.js Issues

  • Check installation: node --version.
  • Reinstall Node.js if necessary.

Enhancing Security

To enhance security and protect sensitive data:

  • Store API keys securely in environment variables or encrypted vaults.
  • Rotate API keys regularly to reduce security risks.
  • Restrict configuration file access to trusted users only.

Sample Session with Claude

Me (RH):

Can you search for recent news about artificial intelligence?

Claude:

I’ll search for recent news about AI using the Brave search function.

Let me search for some more specific recent developments.

Based on these search results, I can provide an overview of recent AI developments and regulatory trends:

  1. Regulatory Landscape: 2024 has seen significant movement in AI regulation:
  • At least 40 U.S. states, along with Puerto Rico, the U.S. Virgin Islands, and D.C., have introduced AI-related legislation
  • The European Union has established comprehensive rules through the AI Act and AI Liability Directive
  • The African Union is developing a continent-wide AI strategy to protect consumers and help African countries compete in the AI space

…. it continues on

Would you like me to explore any of these areas in more detail? I can search for more specific information about any particular aspect that interests you.

Another Sample Session using Brave Search and Claude Desktop

RH:

Can you find pizza restaurants near me?

Claude:

I notice you’d like to find pizza restaurants, but I can’t determine your location from our conversation. To find pizza places near you, I’ll need you to specify a location — it could be a city, neighborhood, landmark, or address. Could you please provide that information?

RH:

I live in Manor Texas

Claude:

I’ll search for pizza restaurants in Manor, Texas using the local search function.

View Result from brave_web_search from brave-search (local)

Based on the search results, here are some pizza options in Manor, TX:

  1. GRAZIE Pizzeria — A local pizzeria that’s highly rated on Yelp
  2. DoubleDave’s Pizzaworks
  • Location: Manor location
  • Known for: Peproni Rolls®, Philly Cheesesteak Stromboli, and specialty pizzas
  • Services: Dine-in, Delivery, and Carry-Out available

3. Domino’s Pizza

  • Address: 11211 US Highway 290 E, Ste 400
  • Hours: Open until midnight
  • Services: Delivery and takeout available
  • Menu includes pizza, wings, sandwiches, and salads

4. Pizza Hut

  • Address: 11300 Highway 290 East Bldg 3
  • Hours: 11:00 AM — 11:00 PM
  • Services: Carryout and delivery

5. Little Caesars

  • Address: 12836 Hwy 290
  • Phone: (737) 357–6622

Each of these places offers different specialties and service options. Would you like more specific information about any of these restaurants, such as their menus, pricing, or customer reviews? I can also search for other local pizzerias if these don’t meet your preferences.

Sequence Diagram: Brave Search MCP Server Integration

The following sequence diagram illustrates how the Brave Search MCP server processes requests through two sample sessions. It shows the flow of communication between the HostClient, and Server components.

Sequence Diagram: Communication Flow

Communication Flow for Claude Desktop and Brave Search MCP

The sequence diagram above illustrates the dynamic communication flow between system components:

  • Users initiate requests through the Claude Desktop interface (Host)
  • The MCP Client processes and transforms these requests into standardized API calls
  • Brave MCP Server acts as an intermediary, coordinating with external APIs and data sources
  • Information flows back through the chain, ultimately presenting results to users

System Architecture: Brave Search MCP Integration

Brave Search / Claude Desktop Client System Architecture

Block Diagram:

  • Illustrates the modular architecture:
  • The Host (Claude Desktop) provides the user interface and communicates with the Client.
  • The Client manages protocol-specific interactions with the Brave MCP Server.
  • The Brave MCP Server connects with external APIs (Brave Search API) and local resources to retrieve data.

The diagrams above illustrate how the integration brings advanced search capabilities to the Claude Desktop environment.

Finding more information about MCP

You can begin building and testing MCP connectors right away. If you’re a Claude for Work customer, you can test MCP servers locally and connect Claude to your internal systems and datasets. With Anthropic’s recently released developer toolkits, you can immediately start using the existing servers for Claude Desktop, significantly expanding Claude’s capabilities and reach.

Here’s how to get started building with MCP:

The following MCP Server Plugins are available:

  • Filesystem — File operations with configurable access controls
  • GitHub — Repository management, file operations, and GitHub API integration
  • GitLab — GitLab API, enabling project management
  • Git — Read, search, and manipulate Git repositories
  • Google Drive — File access and search capabilities for Google Drive
  • PostgreSQL — Read-only database access with schema inspection
  • SQLite — Database interaction
  • Slack — Channel management and messaging
  • Memory — Knowledge graph-based persistent memory system
  • Puppeteer — Browser automation and web scraping
  • Brave Search — Web and local search using Brave’s Search API
  • Google Maps — Location services, directions, and place details
  • Fetch — Web content fetching and conversion for efficient LLM usage

Conclusion

Integrating Brave Search with Claude Desktop revolutionizes AI-assisted tasks, enabling users to access real-time, contextual insights directly from the web or their local environment. By bridging the gap between AI and diverse data sources, this plugin transforms Claude into a formidable tool for productivity, research, and decision-making.

Embrace the future of AI with MCP and unlock a more intelligent approach to work, learning, and creation.

Rick Hightower, a seasoned software architect and technology innovator with over three decades of experience in enterprise software development, holds a TensorFlow Certified Developer certification and completed a specialization in Machine Learning at Stanford University. His unwavering dedication to advancing AI and data engineering technologies has earned him recognition within the Java ecosystem, where he was named a 2017 Java Champion.

As a prominent figure in the Java community, Rick has authored technical publications, contributed to open-source initiatives, and held leadership positions, including a stint as an executive at a Fortune 100 technology company.

In recent years, Rick has been at the forefront of AI innovation, focusing on large-scale data engineering and the development of AI-driven solutions. He has spearheaded groundbreaking projects, such as:

  • AI Document Processing: Rick leveraged AWS Bedrock and generative AI to extract data from documents and generate deliverables within minutes, significantly reducing the traditional months-long process.
  • RAG-based Expert Systems: He designed and deployed Retrieval-Augmented Generation (RAG) systems using LLMs like ChatGPT and Claude, integrating them with Google Cloud for efficient document and code repository indexing.
  • Meeting Tools: Rick and Chris developed tools that enable real-time question detection, meeting summarization, and action item extraction, substantially enhancing workplace productivity.
  • AR/VR Scalability: He collaborated with a startup to scale backend services on Azure Kubernetes Service (AKS), successfully deploying seven services with advanced load balancing and caching mechanisms.
  • Legal AI Automation: Leveraging artificial intelligence (AI), Rick analyzed legal documents, extracting valuable insights at a significantly reduced cost. This resulted in substantial efficiency gains for his clients.

As an active mentor and thought leader, Rick actively participates in conferences, sharing his insights on the convergence of AI, data engineering, and enterprise software. His practical approach to addressing complex challenges has earned him a distinguished reputation within the technology community.

Recent articles by Rick

  1. Articles Overview
  2. Setting up Claude Filesystem MCP
  3. Setting up Brave Search MCP with Claude Desktop Client
  4. Introduction to Anthropic MCP Architecture
  5. Rick and Chris Review Machine Learning
  6. Streamlit Adventures Part 5 Article
  7. Streamlit Part 4: Form Validation Part 2
  8. Streamlit Part 3 — Form Validation Part 1
  9. Advanced SQL Techniques for ETL
  10. Streamlit Part 2: Layouts, Components, and Graphs
  11. Conversation About Streamlit While Walking in the Park
  12. PrivateGPT and LlamaIndex
  13. OpenAI’s Latest Developments
  14. AI-Powered Knowledge Base for Product Managers
  15. ChatGPT at Scale on Azure Cloud
  16. Prompt Engineering with CoT and Synthetic Prompts Part 2
  17. Understanding LLMs and Using Chain of Thoughts
  18. Meta’s Llama 2 AI Model
  19. ChatGPT Embeddings and HyDE for Improved Search
  20. Rick wrote all of the blog posts and articles on the Cloudurable site

No comments:

Post a Comment

Kafka and Cassandra support, training for AWS EC2 Cassandra 3.0 Training