Skip to main content
Glama
Mantraa-Zzz

Web Search MCP Server

by Mantraa-Zzz

Web Search MCP Server

一个为 AgentX 平台设计的网页搜索 MCP(Model Context Protocol)服务器,提供强大的网页搜索和内容抓取功能。

🚀 功能特性

  • 网页搜索: 使用 Google Custom Search API 进行互联网搜索

  • 内容抓取: 抓取指定网页的文本内容和元数据

  • 智能组合: 搜索并自动抓取前几个结果的内容

  • 多语言支持: 支持中文、英文等多种语言搜索

  • 模拟模式: 无需API密钥即可测试基本功能

Related MCP server: DuckDuckGo MCP Server

🛠️ 工具列表

在互联网上搜索信息,返回相关的网页链接和摘要。

参数:

  • query (必需): 搜索查询关键词

  • maxResults (可选): 最大返回结果数量,默认10

  • language (可选): 搜索语言,默认zh-CN

2. web_scrape

抓取指定网页的内容,提取文本和元数据。

参数:

  • url (必需): 要抓取的网页URL

  • extractText (可选): 是否提取纯文本内容,默认true

  • extractMetadata (可选): 是否提取元数据,默认true

3. web_search_and_scrape

搜索网页并抓取前几个结果的内容。

参数:

  • query (必需): 搜索查询关键词

  • maxResults (可选): 最大抓取结果数量,默认3

  • language (可选): 搜索语言,默认zh-CN

📦 安装和配置

1. 安装依赖

npm install

2. 配置环境变量

复制 env.example.env 并配置:

cp env.example .env

编辑 .env 文件:

# Google Custom Search API 配置
SEARCH_API_KEY=your_google_api_key
SEARCH_ENGINE_ID=your_search_engine_id

# 可选配置
SEARCH_PROVIDER=google
REQUEST_TIMEOUT=10000
MAX_RESULTS=10
LOG_LEVEL=info

3. 获取 Google Custom Search API 密钥

  1. 访问 Google Cloud Console

  2. 创建新项目或选择现有项目

  3. 启用 Custom Search API

  4. 创建 API 密钥

  5. 创建自定义搜索引擎:

🚀 运行

开发模式

npm run dev

生产模式

npm run build
npm start

🔧 在 AgentX 中集成

1. 部署到 MCP Gateway

在 AgentX 中,通过以下方式部署此 MCP 服务器:

# 使用 npm 安装命令
npm install -g web-search-mcp

# 或者使用 git 克隆
git clone https://github.com/Mantraa-Zzz/mcp.git
cd mcp
npm install
npm run build

2. 配置 AgentX

在 AgentX 的 .env 文件中确保 MCP Gateway 配置正确:

# MCP Gateway 配置
MCP_GATEWAY_BASE_URL=http://localhost:8081
MCP_GATEWAY_API_KEY=123456

3. 重启 AgentX 容器

docker restart agentx

📝 使用示例

在 AgentX 中创建 Agent 时使用

  1. 登录 AgentX 管理界面

  2. 创建新的 Agent

  3. 在工具配置中选择 "web_search" 相关工具

  4. Agent 将能够使用网页搜索功能

示例对话

用户: "帮我搜索最新的 AI 技术趋势"

Agent: 我将为您搜索最新的 AI 技术趋势信息。

调用 web_search 工具

  • 查询: "最新 AI 技术趋势 2024"

  • 返回相关网页链接和摘要

用户: "抓取第一个搜索结果的内容"

Agent: 我将抓取第一个搜索结果的详细内容。

调用 web_scrape 工具

  • URL: [第一个搜索结果的URL]

  • 返回完整的网页内容

🔍 测试

模拟模式测试

即使没有配置 Google API 密钥,服务器也会返回模拟数据,方便测试基本功能。

真实 API 测试

配置正确的 API 密钥后,可以获取真实的搜索结果。

📋 技术栈

  • TypeScript: 主要开发语言

  • @modelcontextprotocol/sdk: MCP 协议实现

  • Axios: HTTP 客户端

  • Cheerio: HTML 解析和内容提取

  • dotenv: 环境变量管理

🤝 贡献

欢迎提交 Issue 和 Pull Request 来改进这个项目!

📄 许可证

MIT License

🔗 相关链接

Available Tools

3 tools
web_scrapeC

抓取指定网页的内容,提取文本和元数据

ParametersJSON Schema
NameRequiredDescriptionDefault
extractMetadataNo是否提取元数据(默认true)
extractTextNo是否提取纯文本内容(默认true)
urlYes要抓取的网页URL

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions extraction of text and metadata but fails to describe critical traits such as rate limits, authentication needs, error handling (e.g., for invalid URLs), or output format. This is inadequate for a web scraping tool that likely involves network operations and potential restrictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the tool's function without unnecessary words. It is front-loaded with the core purpose and appropriately sized for a simple tool, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of web scraping (involving network calls, potential errors, and content parsing) and the absence of both annotations and an output schema, the description is insufficient. It does not explain what 'extract text and metadata' entails in practice (e.g., structured data, limitations), leaving gaps in understanding the tool's behavior and results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting all three parameters (url, extractText, extractMetadata) with their types, defaults, and purposes. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as '抓取指定网页的内容,提取文本和元数据' (scrape content from specified web pages, extract text and metadata), which includes a specific verb ('抓取' - scrape) and resource ('网页' - web pages). It distinguishes from sibling tools like 'web_search' by focusing on extraction rather than searching, though it doesn't explicitly mention how it differs from 'web_search_and_scrape'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'web_search' or 'web_search_and_scrape'. It lacks context on prerequisites (e.g., URL validity), exclusions (e.g., dynamic content), or comparisons with siblings, leaving the agent to infer usage based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

web_search_and_scrapeC

搜索网页并抓取前几个结果的内容

ParametersJSON Schema
NameRequiredDescriptionDefault
languageNo搜索语言(如:zh-CN, en-US)zh-CN
maxResultsNo最大抓取结果数量(默认3)
queryYes搜索查询关键词

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions scraping '前几个结果的内容' (content of top results), implying a limit based on search ranking, but lacks details on permissions, rate limits, error handling, or output format. This is inadequate for a tool that performs web operations with potential complexities.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the tool's function without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (web search and scrape), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what '抓取内容' (scrape content) entails (e.g., full text, metadata), potential limitations, or how results are returned, leaving significant gaps for agent understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents parameters like 'query', 'maxResults', and 'language'. The description adds no additional semantic context beyond implying '前几个结果' relates to 'maxResults', which is already covered. Baseline 3 is appropriate as the schema handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as '搜索网页并抓取前几个结果的内容' (search web and scrape content of top results), which specifies the verb (search and scrape) and resource (web pages). It distinguishes from 'web_scrape' (scraping only) and 'web_search' (searching only) by combining both functions, though it doesn't explicitly mention this differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its siblings 'web_scrape' or 'web_search'. There are no explicit instructions on alternatives, prerequisites, or context for choosing this combined tool over separate ones, leaving usage decisions ambiguous.

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. Dates show when Glama detected each change.

  1. 3 tool updatesv1.0.0
    • First observedweb_scrape
    • First observedweb_search
    • First observedweb_search_and_scrape

TDQS

B3/5.0
Disambiguation2/5

The tools have significant overlap, particularly between web_search and web_search_and_scrape, which both perform search operations. While web_scrape is distinct for direct content extraction, the boundary between the two search tools is unclear, as web_search_and_scrape essentially combines the functionality of the other two, creating redundancy and potential confusion for agent selection.

Naming Consistency5/5

All tool names follow a consistent snake_case pattern with a clear 'web_' prefix, indicating the domain. The naming is predictable and uniform across all three tools, making it easy to understand their purpose and relationship at a glance.

Tool Count3/5

With only 3 tools, the count feels thin for a web search server, potentially limiting functionality. While it covers basic search and scrape operations, the scope might be too narrow, lacking tools for advanced features like filtering, pagination, or handling different content types, which could hinder comprehensive agent workflows.

Completeness2/5

The tool set has notable gaps for a web search domain, such as missing operations for filtering search results, handling pagination, or accessing cached content. The redundancy in search tools (web_search and web_search_and_scrape) suggests inefficiency rather than coverage, and there are no tools for managing search sessions or advanced metadata extraction, which could lead to agent failures in complex tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables search capabilities using a Google Custom Search Engine, allowing users to input a search term and retrieve search result titles, links, and snippets, while facilitating integration with other tools for content extraction and advanced search strategies.
    1
    45
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables web searching through Google, DuckDuckGo, and Bing using a headless Chrome browser, returning structured results with titles, URLs, and snippets. Also supports fetching and extracting text content from any webpage.
    13
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mantraa-Zzz/Web_Search'

If you have feedback or need assistance with the MCP directory API, please join our Discord server