LangSearch MCP Server

LangSearch MCP Server

An MCP server that provides web search and semantic reranking capabilities using the LangSearch API. It enables searching billions of web documents with AI-optimized results and reordering them based on semantic relevance scores.

Category
Visit Server

README

LangSearch MCP Server

A Model Context Protocol (MCP) server that provides web search and semantic reranking capabilities using the LangSearch API.

Features

  • Web Search: Search billions of web documents with AI-optimized results

    • Full page summaries
    • Freshness filtering (day, week, month)
    • Customizable result count
    • Machine-readable structured output
  • Semantic Reranking: Improve search accuracy with deep semantic understanding

    • Reorder documents by semantic relevance
    • Relevance scores (0-1 scale)
    • Better than traditional keyword/vector search
    • Top-N filtering

Installation

Prerequisites

Setup

  1. Clone or navigate to the repository:
cd langsearch-mcp-python
  1. Install dependencies:
uv sync
  1. Configure your API key:
cp .env.example .env
# Edit .env and add your LANGSEARCH_API_KEY

Usage

Testing with MCP Inspector

Test the server interactively:

uv run mcp dev main.py

This opens the MCP Inspector where you can:

  • Browse available tools
  • Test tool invocations
  • View structured responses

Installing to Claude Desktop

Install the server for use with Claude Desktop:

uv run mcp install main.py

Follow the prompts to configure the installation.

Manual Installation in Claude Desktop

Add to your Claude Desktop configuration file:

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

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "langsearch": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/langsearch-mcp-python",
        "run",
        "main.py"
      ],
      "env": {
        "LANGSEARCH_API_KEY": "your_api_key_here"
      }
    }
  }
}

Running as HTTP Server

For remote access, run as an HTTP server:

# In main.py, change the last line to:
if __name__ == "__main__":
    mcp.run(transport="streamable-http")

Then run:

uv run main.py

Access at http://localhost:8000/mcp

Tools

web_search

Search the web for information across billions of documents.

Parameters:

  • query (string, required): Search query
  • count (integer, default=10): Number of results (1-50)
  • summary (boolean, default=true): Include full page summaries
  • freshness (string, default="noLimit"): Filter by freshness
    • "noLimit": All results
    • "day": Last 24 hours
    • "week": Last 7 days
    • "month": Last 30 days

Returns: Structured data with:

  • Total result count
  • Web pages with title, URL, snippet, summary
  • Original query

Example:

{
  "query": "latest AI developments 2026",
  "count": 5,
  "summary": true,
  "freshness": "week"
}

semantic_rerank

Rerank documents based on semantic relevance to a query.

Parameters:

  • query (string, required): Search query for ranking
  • documents (array[string], required): List of document texts to rerank
  • top_n (integer, optional): Return only top N results
  • model (string, default="langsearch-reranker-v1"): Reranker model

Returns: Structured data with:

  • Reranked documents with indices
  • Relevance scores (0-1, higher = more relevant)
  • Model used

Example:

{
  "query": "machine learning algorithms",
  "documents": [
    "Deep learning is a subset of machine learning...",
    "The history of neural networks dates back...",
    "Random forests are ensemble learning methods..."
  ],
  "top_n": 2
}

Development

Project Structure

langsearch-mcp-python/
├── main.py              # MCP server implementation
├── pyproject.toml       # Project dependencies
├── uv.lock             # Locked dependencies
├── .env.example        # Example environment variables
├── .gitignore          # Git ignore rules
└── README.md           # This file

Running Tests

# Test with MCP Inspector
uv run mcp dev main.py

# Test individual tools
uv run python -c "
from main import web_search
import asyncio
result = asyncio.run(web_search('Python programming', count=3))
print(result)
"

Error Handling

The server provides clear error messages for:

  • Missing API key
  • Invalid parameters
  • API errors
  • Network issues

Errors are returned as structured exceptions with descriptive messages.

API Reference

For detailed API documentation, see:

Environment Variables

Variable Required Description
LANGSEARCH_API_KEY Yes Your LangSearch API key

License

MIT

Support

For issues and questions:

Contributing

Contributions are welcome! Please ensure:

  • Type hints are used throughout
  • Docstrings follow the existing format
  • Error handling is comprehensive
  • Tests pass with uv run mcp dev

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured