web-search-mcp-server

web-search-mcp-server

3.2

If you are the rightful owner of web-search-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This MCP server provides tools for web search and vector database functionality using LangChain and ChromaDB.

Web Search MCP Server with ChromaDB Vector Database

This MCP server provides tools for web search and vector database functionality using LangChain and ChromaDB.

Features

Web Search

  • Search documentation for popular libraries (LangChain, LlamaIndex, OpenAI)
  • Extract content from web pages

Vector Database (ChromaDB)

  • Store and retrieve documents with vector embeddings
  • Perform semantic similarity search
  • Filter documents based on metadata
  • Batch operations for efficiency

Setup

  1. Install dependencies:
pip install -e .
# or
uv pip install -e .
  1. Create a .env file with the following variables:
# Serper API for web search
USER_AGENT=Mozilla/5.0
SERPER_API_URL=https://google.serper.dev/search
SERPER_API_KEY=your_serper_api_key

# ChromaDB configuration
CHROMA_PERSIST_DIRECTORY=./chroma_db
EMBEDDING_MODEL_NAME=sentence-transformers/all-MiniLM-L6-v2

# Transport mode (stdio or sse)
TRANSPORT=stdio
  1. Run the server:
python main.py

Available Tools

Web Search

  • get_docs(query: str, library: str): Search documentation for specified libraries

Vector Database (ChromaDB)

  • add_document_to_vectordb(content: str, metadata: Optional[Dict[str, Any]]): Add a single document to ChromaDB
  • search_vectordb(query: str, top_k: int, filter_criteria: Optional[Dict[str, Any]]): Search the vector database
  • delete_document_from_vectordb(document_id: str): Delete a document by ID
  • batch_add_documents_to_vectordb(documents: List[Dict[str, Any]]): Add multiple documents in a batch
  • create_retriever(search_type: str, search_kwargs: Optional[Dict[str, Any]]): Create a retriever for the vector database

Example Usage

# Add a document to the vector database
doc_id = await add_document_to_vectordb(
    content="This is a sample document about ChromaDB vector databases.",
    metadata={"source": "example", "category": "vector_db"}
)

# Search for similar documents
results = await search_vectordb(
    query="How do vector databases work?",
    top_k=2,
    filter_criteria={"category": "vector_db"}
)

# Delete a document
status = await delete_document_from_vectordb(document_id=doc_id)

# Add multiple documents at once
doc_ids = await batch_add_documents_to_vectordb([
    {
        "content": "Document 1 content",
        "metadata": {"source": "example", "category": "general"}
    },
    {
        "content": "Document 2 content",
        "metadata": {"source": "example", "category": "specific"}
    }
])

Development

  • Format code: black . and isort .
  • Lint code: ruff check .
  • Type check: mypy .