Skip to main content
Glama
iamatulsingh

brave-mcp-langchain

by iamatulsingh

brave-mcp-langchain

Create venv

uv sync

Related MCP server: Tagny MCP Server

Install package

uv pip install brave-mcp-langchain

Run MCP server in STDIO mode

uvx brave-mcp-langchain

To run MCP server in SSE mode

uvx brave-mcp-langchain sse 5003

MCP Setting

{
  "mcpServers": {
    "brave-mcp-langchain": {
      "disabled": false,
      "timeout": 60,
      "type": "stdio",
      "command": "uvx",
      "args": [
        "brave-mcp-langchain"
      ]
    }
  }
}

Use as Langchain tool

It can also be used as Langchain tool. Below is how to validate tool.

import httpx
import asyncio
from langchain.tools import Tool
from brave_mcp_langchain import brave_tool

async def test_search():
    result = await brave_tool.search_tool.ainvoke({"query": "LangGraph overview", "max_results": 10})
    print(result)

    result = await brave_tool.fetch_content_tool.ainvoke({
        "url": "https://iamatulsingh.github.io"
    })
    print(result)

asyncio.run(test_search())

Use with langchain example

import asyncio
from langchain.agents import initialize_agent
from langchain.agents.agent_types import AgentType
from langchain_ollama import ChatOllama
from brave_mcp_langchain import brave_tool

llm = ChatOllama(model="llama3.1:8b")

tools = [
    brave_tool.search_tool,
    brave_tool.fetch_content_tool
]

agent = initialize_agent(
    tools=[brave_tool.search_tool, brave_tool.fetch_content_tool],
    llm=llm,
    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
    verbose=True
)

async def run_agent_query():
    response = await agent.ainvoke(
        "Search for 'iamatulsingh' overview, then fetch content from https://iamatulsingh.github.io"
    )
    print("\nAgent Response:")
    print(response)

asyncio.run(run_agent_query())

🧠 Inspiration & Attribution

This project, brave-mcp-langchain, was inspired by and partially based on the excellent work in duckduckgo-mcp-server by @nickclyde. That project laid the groundwork for integrating DuckDuckGo search and content fetching into the MCP ecosystem.

While brave-mcp-langchain extends the concept to support Brave Search and LangChain workflows, several architectural ideas and implementation patterns were adapted from duckduckgo-mcp-server, which is licensed under the MIT License.

I'm grateful for the open-source community and contributors who make projects like this possible. If you’re interested in DuckDuckGo-based search tools, definitely check out the original repository!

Available Tools

2 tools
fetch_contentA
Fetch and parse content from a webpage URL.

Args:
    url: The webpage URL to fetch content from
    ctx: MCP context for logging
ParametersJSON Schema
NameRequiredDescriptionDefault
urlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavior, but it only states it fetches and parses content. It does not mention whether it executes JavaScript, handles errors, follows redirects, or any authentication/rate-limit implications, leaving the agent without behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief and front-loaded with the purpose, but includes an 'Args' section listing 'ctx' which is not present in the input schema, adding unnecessary (and possibly confusing) content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple single-parameter tool, the description covers purpose and parameter semantics, but lacks usage guidance and behavioral details that would be expected given no annotations; overall it is minimally adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema only defines 'url' as a string with no description; the description compensates by defining 'url' as 'The webpage URL to fetch content from', adding meaning beyond the bare schema. The mention of 'ctx' is not in the schema and may be an implementation detail.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Fetch and parse') and resource ('webpage URL'), clearly distinguishing this content-fetching tool from the sibling 'search' tool which searches rather than fetches a specific URL.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides clear context that this tool fetches a specific webpage URL, but it does not explicitly state when to use it instead of the sibling 'search' tool, nor does it give any exclusions or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv0.2.0
    • First observedfetch_content
    • First observedsearch

TDQS

B3.4/5.0

Scored across 2 tools

Disambiguation5/5

The two tools are completely distinct: one performs web searches, the other fetches webpage content. There is no overlap or confusion between their purposes.

Naming Consistency4/5

Both names are verb-based and clear, but 'search' is a single verb while 'fetch_content' follows a verb_noun pattern, showing a minor inconsistency in naming convention.

Tool Count3/5

With only 2 tools, the server feels thin for a search-related service. While these two cover the basic search-and-fetch workflow, the count is on the low end of the borderline range.

Completeness4/5

The core functionality of searching and fetching content is covered, but there are minor gaps such as lack of search result filtering options or pagination controls. Overall, the surface is adequate for simple search tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    An MCP implementation that integrates the Brave Search API, providing comprehensive search capabilities including web, local business, image, video, news searches, and AI-powered summarization.
    8
    8
    10,280 npm
    1,441
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables web browsing capabilities for locally served LLMs through URL text fetching, link extraction, and web search using Brave and DuckDuckGo engines. Designed to enhance LLMs with real-time web access through the MCP protocol.
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    Enables web search capabilities through the Brave Search API, including web search, local POI lookups, and rich search results retrieval for MCP-compatible clients.
    4
    22 npm
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    Enables Brave Search via MCP, deployed on Railway for seamless integration with AI agents.
    6
    -