Web Search MCP Server
by joao-santillo
This MCP server provides tools for web search and vector database functionality using LangChain and ChromaDB. It allows you to search documentation and web pages, and store/retrieve documents with vector embeddings.
View on GitHub
Last updated: N/A
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
- Install dependencies:
pip install -e .
# or
uv pip install -e .
- 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
- 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 ChromaDBsearch_vectordb(query: str, top_k: int, filter_criteria: Optional[Dict[str, Any]])
: Search the vector databasedelete_document_from_vectordb(document_id: str)
: Delete a document by IDbatch_add_documents_to_vectordb(documents: List[Dict[str, Any]])
: Add multiple documents in a batchcreate_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 .
andisort .
- Lint code:
ruff check .
- Type check:
mypy .