Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LangSearch MCP ServerSearch for the latest news on generative AI from the past week"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LangSearch MCP Server
A Model Context Protocol (MCP) server that provides access to LangSearch's Web Search API and Semantic Rerank API. This server enables AI assistants to perform web searches and rerank search results based on semantic relevance.
Features
Web Search: Search the web with advanced filtering options (freshness, result count, summaries)
Semantic Rerank: Rerank documents based on semantic relevance to a query
Tools
1. langsearch_web_search
Search the web using LangSearch's Web Search API.
Parameters:
query(string, required): The search queryfreshness(string, optional): Filter results by freshness - "noLimit" (default), "onLimit", "day", "week", "month"summary(boolean, optional): Include full summaries in results (default: true)count(number, optional): Number of results to return (1-50, default: 10)
Returns:
Structured search results with titles, URLs, snippets, and optional summaries
Query context and metadata
2. langsearch_semantic_rerank
Rerank documents based on semantic relevance to a query.
Parameters:
query(string, required): The search query to compare against documentsdocuments(array of strings, required): List of document texts to reranktop_n(number, optional): Number of top results to return (default: all documents)return_documents(boolean, optional): Whether to include document text in response (default: true)
Returns:
Reranked documents with relevance scores (0-1 scale)
Original document indices and optional text content
Installation
Clone or download this repository
Install dependencies:
Build the project:
Copy
.env.exampleto.envand add your LangSearch API key:
Edit
.envand set your API key:
Getting a LangSearch API Key
Visit LangSearch to sign up and obtain an API key.
Usage
With Claude Desktop
Add the server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Replace /absolute/path/to/langsearch-mcp-ts with the actual path to this project directory.
After configuration, restart Claude Desktop. The LangSearch tools will be available in your conversations.
Standalone Mode
Standalone Mode
Development Mode
Run the server in development mode with auto-reload:
Production Mode
Build and run the compiled server:
Testing with MCP Inspector
Test the server using the MCP Inspector:
Then select "stdio" transport and provide the path to the server executable.
Configuration
The server uses environment variables for configuration:
LANGSEARCH_API_KEY(required): Your LangSearch API keyLANGSEARCH_BASE_URL(optional): Custom API base URL (default: https://api.langsearch.com)
Example Usage
Web Search Example
Semantic Rerank Example
API References
Error Handling
The server implements comprehensive error handling:
Invalid API keys return clear error messages
Network errors are caught and reported
Input validation ensures correct parameter types and ranges
All errors are returned with
isError: trueflag
TypeScript
This server is written in TypeScript with full type safety. All API responses and tool parameters are properly typed using zod schemas for runtime validation.
License
MIT