WebSearch-MCP is a Model Context Protocol (MCP) server implementation that provides web search capabilities to AI assistants like Claude. It integrates with a WebSearch Crawler API to retrieve real-time search results, enabling AI models to access up-to-date information on any topic.
To install WebSearch for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @mnhlt/WebSearch-MCP --client claude
npm install -g websearch-mcp
Or use without installing:
npx websearch-mcp
The WebSearch MCP server can be configured using environment variables:
API_URL
: The URL of the WebSearch Crawler API (default: http://localhost:3001
)MAX_SEARCH_RESULT
: Maximum number of search results to return (default: 5
)Examples:
# Configure API URL
API_URL=https://crawler.example.com npx websearch-mcp
# Configure maximum search results
MAX_SEARCH_RESULT=10 npx websearch-mcp
# Configure both
API_URL=https://crawler.example.com MAX_SEARCH_RESULT=10 npx websearch-mcp
The WebSearch MCP server requires a crawler service to perform web searches. You can set up the crawler service using Docker Compose.
docker-compose.yml
file:version: '3.8'
services:
crawler:
image: laituanmanh/websearch-crawler:latest
container_name: websearch-api
restart: unless-stopped
ports:
- "3001:3001"
environment:
- NODE_ENV=production
- PORT=3001
- LOG_LEVEL=info
- FLARESOLVERR_URL=http://flaresolverr:8191/v1
depends_on:
- flaresolverr
volumes:
- crawler_storage:/app/storage
flaresolverr:
image: 21hsmw/flaresolverr:nodriver
container_name: flaresolverr
restart: unless-stopped
environment:
- LOG_LEVEL=info
- TZ=UTC
volumes:
crawler_storage:
docker-compose up -d
docker-compose ps
curl http://localhost:3001/health
{
"mcpServers": {
"websearch": {
"command": "npx",
"args": ["websearch-mcp"],
"environment": {
"API_URL": "http://localhost:3001",
"MAX_SEARCH_RESULT": "5"
}
}
}
}
query
(required): The search query.numResults
(optional): Number of results to return (default: 5).language
(optional): Language code for results (e.g., 'en').region
(optional): Region code for results (e.g., 'us').excludeDomains
(optional): Domains to exclude.includeDomains
(optional): Domains to include.excludeTerms
(optional): Terms to exclude.resultType
(optional): Type of results ('all', 'news', or 'blogs').{
"query": "machine learning trends",
"results": [
{
"title": "Top Machine Learning Trends in 2025",
"snippet": "The key machine learning trends for 2025 include multimodal AI, generative models, and quantum machine learning applications in enterprise...",
"url": "https://example.com/machine-learning-trends-2025",
"siteName": "AI Research Today",
"byline": "Dr. Jane Smith"
}
]
}
npm run test-client
import { createMCPClient } from '@modelcontextprotocol/sdk';
const client = createMCPClient({
transport: { type: 'subprocess', command: 'npx websearch-mcp' }
});
const response = await client.request({
method: 'call_tool',
params: {
name: 'web_search',
arguments: {
query: 'your search query',
numResults: 5,
language: 'en'
}
}
});
console.log(response.result);
docker-compose logs crawler
npm install -g @modelcontextprotocol/sdk@latest
npm install
.npm run build
.npm run dev
..gitignore
: Files ignored by Git..npmignore
: Files excluded from npm.package.json
: Project metadata.src/
: Source TypeScript files.dist/
: Compiled JavaScript files.npm login
.npm version patch|minor|major
.npm publish
.Contributions are welcome! Submit a Pull Request.
ISC