高效搜索工具

一个调用Google可编程搜索引擎并返回清理、结构化搜索结果的MCP服务器。

  • by om-surushe
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 om-surushe/efficient-search

使用说明

Efficient Search

An MCP server that calls Google Programmable Search Engine and returns cleaned, structured search results. It decodes HTML entities, extracts available page metadata, adds a short summary, and caches equivalent requests.

Install

npm install -g @om-surushe/efficient-search

You need a Google Programmable Search Engine and a Google API key.

Add the server to your MCP client:

{
  "mcpServers": {
    "efficient-search": {
      "command": "bunx",
      "args": ["@om-surushe/efficient-search"],
      "env": {
        "GOOGLE_API_KEY": "your_api_key_here",
        "SEARCH_ENGINE_ID": "your_search_engine_id"
      }
    }
  }
}

Tools

Tool Purpose
web_search Search Google with optional result-count, safety, country, and language filters
clear_cache Remove all cached responses
get_cache_stats Return cache size, capacity, and TTL

Example request:

{
  "query": "typescript documentation",
  "num": 5,
  "safe": "high",
  "gl": "us",
  "lr": "lang_en"
}

Each result contains its title, URL, cleaned snippet, display host, available metadata, and a score derived from its position in Google's response. The score is not an independent relevance model.

Cache entries are separated by normalized query, result count, safety level, country, and language. The default TTL is 60 minutes.

Configuration

Variable Required Default Purpose
GOOGLE_API_KEY Yes — Google API key
SEARCH_ENGINE_ID Yes — Programmable Search Engine ID
CACHE_TTL_MINUTES No 60 Cache lifetime
MAX_RESULTS No 10 Default result count

Google API quotas and Programmable Search Engine coverage still apply. This package does not crawl pages or rerank Google's results.

Development

npm ci
npm test
npm run typecheck
npm run lint
npm run build
npm run test:server
npm pack --dry-run

See CONTRIBUTING.md for repository layout and pull-request guidance.

Security

Keep GOOGLE_API_KEY and SEARCH_ENGINE_ID in your MCP client's environment or secret store. See SECURITY.md for credential guidance and private vulnerability reporting.

License

MIT © Om Surushe