WebSearch-MCP
Búsqueda web-MCP
Una implementación de servidor de Protocolo de Contexto de Modelo (MCP) que proporciona funciones de búsqueda web mediante el transporte stdio. Este servidor se integra con una API de WebSearch Crawler para obtener resultados de búsqueda.
Tabla de contenido
Related MCP server: MCP Server for Google Search
Acerca de
WebSearch-MCP es un servidor de Protocolo de Contexto de Modelo que proporciona funciones de búsqueda web a asistentes de IA compatibles con MCP. Permite a modelos de IA como Claude buscar en la web en tiempo real y obtener información actualizada sobre cualquier tema.
El servidor se integra con un servicio API de Crawler que maneja las búsquedas web reales y se comunica con los asistentes de IA mediante el Protocolo de contexto de modelo estandarizado.
Instalación
Instalación mediante herrería
Para instalar WebSearch para Claude Desktop automáticamente a través de Smithery :
npx -y @smithery/cli install @mnhlt/WebSearch-MCP --client claudeInstalación manual
npm install -g websearch-mcpO utilizar sin instalar:
npx websearch-mcpConfiguración
El servidor WebSearch MCP se puede configurar mediante variables de entorno:
API_URL: La URL de la API del rastreador de búsqueda web (predeterminado:http://localhost:3001)MAX_SEARCH_RESULT: Número máximo de resultados de búsqueda a devolver cuando no se especifica en la solicitud (valor predeterminado:5)
Ejemplos:
# 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-mcpConfiguración e integración
La configuración de WebSearch-MCP implica dos partes principales: configurar el servicio de rastreo que realiza las búsquedas web reales e integrar el servidor MCP con sus aplicaciones cliente de IA.
Configuración del servicio de rastreo
El servidor MCP de WebSearch requiere un servicio de rastreo para realizar las búsquedas web. Puede configurarlo fácilmente con Docker Compose.
Prerrequisitos
Iniciar el servicio de rastreo
Cree un archivo llamado
docker-compose.ymlcon el siguiente contenido:
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:solución alternativa para Mac Apple Silicon
version: '3.8'
services:
crawler:
image: laituanmanh/websearch-crawler:latest
container_name: websearch-api
platform: "linux/amd64"
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
platform: "linux/arm64"
container_name: flaresolverr
restart: unless-stopped
environment:
- LOG_LEVEL=info
- TZ=UTC
volumes:
crawler_storage:Iniciar los servicios:
docker-compose up -dVerifique que los servicios se estén ejecutando:
docker-compose psPruebe el punto final de estado de la API del rastreador:
curl http://localhost:3001/healthRespuesta esperada:
{
"status": "ok",
"details": {
"status": "ok",
"flaresolverr": true,
"google": true,
"message": null
}
}La API del rastreador estará disponible en http://localhost:3001 .
Prueba de la API del rastreador
Puedes probar la API del rastreador directamente usando curl:
curl -X POST http://localhost:3001/crawl \
-H "Content-Type: application/json" \
-d '{
"query": "typescript best practices",
"numResults": 2,
"language": "en",
"filters": {
"excludeDomains": ["youtube.com"],
"resultType": "all"
}
}'Configuración personalizada
Puede personalizar el servicio de rastreo modificando las variables de entorno en el archivo docker-compose.yml :
PORT: El puerto en el que escucha la API del rastreador (predeterminado: 3001)LOG_LEVEL: Nivel de registro (opciones: depuración, información, advertencia, error)FLARESOLVERR_URL: URL del servicio FlareSolverr (para omitir la protección de Cloudflare)
Integración con clientes MCP
Referencia rápida: Configuración de MCP
A continuación se muestra una referencia rápida para la configuración de MCP en diferentes clientes:
{
"mcpServers": {
"websearch": {
"command": "npx",
"args": [
"websearch-mcp"
],
"environment": {
"API_URL": "http://localhost:3001",
"MAX_SEARCH_RESULT": "5" // reduce to save your tokens, increase for wider information gain
}
}
}
}Solución alternativa para Windows, debido a un problema
{
"mcpServers": {
"websearch": {
"command": "cmd",
"args": [
"/c",
"npx",
"websearch-mcp"
],
"environment": {
"API_URL": "http://localhost:3001",
"MAX_SEARCH_RESULT": "1"
}
}
}
}Uso
Este paquete implementa un servidor MCP que utiliza transporte stdio que expone una herramienta web_search con los siguientes parámetros:
Parámetros
query(obligatoria): La consulta de búsqueda a buscarnumResults(opcional): Número de resultados a devolver (predeterminado: 5)language(opcional): código de idioma para los resultados de búsqueda (por ejemplo, 'en')region(opcional): código de región para los resultados de búsqueda (por ejemplo, 'nosotros')excludeDomains(opcional): Dominios que se excluirán de los resultadosincludeDomains(opcional): solo incluye estos dominios en los resultadosexcludeTerms(opcional): Términos que se excluirán de los resultadosresultType(opcional): tipo de resultados a devolver ('todos', 'noticias' o 'blogs')
Ejemplo de respuesta de búsqueda
A continuación se muestra un ejemplo de una respuesta de búsqueda:
{
"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"
},
{
"title": "The Evolution of Machine Learning: 2020-2025",
"snippet": "Over the past five years, machine learning has evolved from primarily supervised learning approaches to more sophisticated self-supervised and reinforcement learning paradigms...",
"url": "https://example.com/ml-evolution",
"siteName": "Tech Insights",
"byline": "John Doe"
}
]
}Pruebas locales
Para probar el servidor WebSearch MCP localmente, puede utilizar el cliente de prueba incluido:
npm run test-clientEsto iniciará el servidor MCP y una interfaz de línea de comandos simple que le permitirá ingresar consultas de búsqueda y ver los resultados.
También puede configurar la API_URL para el cliente de prueba:
API_URL=https://crawler.example.com npm run test-clientComo biblioteca
Puedes utilizar este paquete programáticamente:
import { createMCPClient } from '@modelcontextprotocol/sdk';
// Create an MCP client
const client = createMCPClient({
transport: { type: 'subprocess', command: 'npx websearch-mcp' }
});
// Execute a web search
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);Solución de problemas
Problemas con el servicio de rastreo
API inaccesible : asegúrese de que el servicio de rastreo esté en ejecución y sea accesible en la API_URL configurada.
Resultados de la búsqueda no disponibles : Verifique los registros del servicio de rastreo para ver si hay algún error:
docker-compose logs crawlerProblemas con FlareSolverr : Algunos sitios web usan la protección de Cloudflare. Si detecta errores relacionados, compruebe si FlareSolverr funciona correctamente.
docker-compose logs flaresolverr
Problemas con el servidor MCP
Errores de importación : asegúrese de tener la última versión del SDK de MCP:
npm install -g @modelcontextprotocol/sdk@latestProblemas de conexión : asegúrese de que el transporte stdio esté configurado correctamente para su cliente.
Desarrollo
Para trabajar en este proyecto:
Clonar el repositorio
Instalar dependencias:
npm installConstruya el proyecto:
npm run buildEjecutar en modo de desarrollo:
npm run dev
El servidor espera una API de WebSearch Crawler, tal como se define en el archivo swagger.json incluido. Asegúrese de que la API se esté ejecutando en la API_URL configurada.
Estructura del proyecto
.gitignore: especifica los archivos que Git debe ignorar (node_modules, dist, registros, etc.).npmignore: especifica los archivos que no deben incluirse al publicar en npmpackage.json: metadatos y dependencias del proyectosrc/: Archivos fuente de TypeScriptdist/: Archivos JavaScript compilados (generados durante la compilación)
Publicación en npm
Para publicar este paquete en npm:
Asegúrese de tener una cuenta npm y de haber iniciado sesión (
npm login)Actualice la versión en package.json (
npm version patch|minor|major)Ejecutar
npm publish
El archivo .npmignore garantiza que solo se incluyan los archivos necesarios en el paquete publicado:
El código compilado en
dist/Archivos README.md y LICENSE
paquete.json
Contribuyendo
¡Agradecemos sus contribuciones! No dude en enviar una solicitud de incorporación de cambios.
Licencia
ISC
Available Tools
1 toolweb_searchB
Search the web for information. Use this tool when you need to search the web for information. You can use this tool to search for news, blogs, or all types of information. You can also use this tool to search for information about a specific company or product. You can also use this tool to search for information about a specific person. You can also use this tool to search for information about a specific product. You can also use this tool to search for information about a specific company. You can also use this tool to search for information about a specific event. You can also use this tool to search for information about a specific location. You can also use this tool to search for information about a specific thing. If you request search with 1 result number and failed, retry with bigger results number.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The search query to look up | |
| numResults | No | Number of results to return (default: 5) | |
| language | No | Language code for search results (e.g., 'en') | |
| region | No | Region code for search results (e.g., 'us') | |
| excludeDomains | No | Domains to exclude from results | |
| includeDomains | No | Only include these domains in results | |
| excludeTerms | No | Terms to exclude from results | |
| resultType | No | Type of results to return |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It does not mention potential side effects, rate limits, or permissions. The only behavioral detail is the retry advice, which is insufficient for a tool performing external web requests.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is overly repetitive, listing 'You can also use this tool to search for...' multiple times, which adds no value and wastes tokens. The retry advice is useful but could be condensed. A single sentence covering the core function and filtering options would suffice.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 8 parameters and no output schema, the description provides a basic overview but lacks details on pagination, error handling beyond the retry note, and the structure of results. The schema covers parameter details, but the description does not fully fill the gaps for a complex tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
All 8 parameters have descriptions in the schema, so the schema coverage is 100%. The description adds no additional parameter-specific information beyond what is in the schema, matching the baseline expectation. The retry advice does not relate to parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Search the web for information,' which defines the tool's purpose. However, it lacks specificity and reads as a general search tool rather than highlighting unique capabilities. There are no sibling tools, so no need for differentiation, but the description could be more concise.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description includes explicit guidance on when to use ('when you need to search the web') and a specific retry strategy for failed requests with small result numbers. No siblings exist, so no alternatives to discuss, but the guidance is clear and actionable.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- First observed
web_search
TDQS
Scored across 1 tool
Only one tool exists, so there is no ambiguity. The single tool's purpose is clearly defined as searching the web.
With only one tool, naming consistency is trivially maintained. The name 'web_search' follows a clear verb_noun pattern.
A single tool for a web search server is minimal but acceptable for basic functionality. However, a more complete server might include tools for fetching page content or image search, making the count borderline.
The server provides only a search tool, missing common complementary tools like fetching web page content or performing advanced searches. This leaves notable gaps for typical workflows.
Maintenance
Related MCP Connectors
MCP server for Firecrawl — web search, scraping, and biomedical/arXiv paper search.
Free web search for AI agents. No API key required. Hosted MCP in active development.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Related MCP Servers
- AlicenseAqualityCmaintenanceA Model Context Protocol server that provides real-time web search capabilities to AI assistants through pluggable search providers, currently integrated with the Brave Search API.516MIT
- FlicenseAqualityCmaintenanceA Model Context Protocol server that provides web search capabilities using Google Custom Search API and webpage content extraction functionality.26 npm2-
- FlicenseCqualityDmaintenanceA Model Context Protocol server that enables web search capabilities using the Tavily API, allowing AI models to retrieve current information from the internet through natural language commands.3-
- AlicenseBqualityDmaintenanceA Model Context Protocol server that provides web search capabilities using Google Custom Search API and webpage content extraction functionality.2MIT