mcpField
G
Google Search (via Apify)

Google Search (via Apify)

リモート
apify.com検索03 週間前に更新
リポジトリ公式サイト

Google Search (via Apify) について

Apify Actorとして、Google Custom Search JSON API互換の形式で、リアルタイムのウェブ検索と画像検索の結果を返します。使い慣れたリクエストパラメーターとレスポンス項目を維持したい開発者やエージェント向けです。

主な機能

  1. 01Custom Search JSON互換のエンドポイント
  2. 02ウェブと画像の検索結果
  3. 03一般的な検索パラメーターに対応
  4. 04SearXNG互換のレスポンス経路

活用シーン

  1. 01Custom Search APIのエンドポイント置換
  2. 02検索クライアントへのGoogle結果提供
  3. 03画像検索結果のJSON取得

MCP 対応

Apifyのホスト型MCPサーバーから利用でき、MCPクライアントやAIエージェントが検索を実行できます。

設定

リモートサーバーはインストール不要です。クライアントを選んで設定をコピーするか、ワンクリックで導入できます。

エンドポイントhttps://mcp.apify.com/?tools=automationnation/google-custom-search-api
インストールコマンドをコピー
Claude CodeTerminal
Cursor.cursor/mcp.json
VS Code.vscode/mcp.json
Claude Desktopclaude_desktop_config.json
Windsurf~/.codeium/windsurf/mcp_config.json

コマンドはターミナルで実行し、JSON は各クライアントの MCP 設定に貼り付けて再起動します。認可が必要なサーバーは初回接続時にログインを求めます。

すべてのエンドポイント
Streamable HTTPhttps://mcp.apify.com/?tools=automationnation/google-custom-search-api認証が必要

ツール

詳細

Google Custom Search JSON API の代替:同じリクエスト、同じ JSON

Apify で実行

Google Custom Search API Alternative は、Google が新規顧客への提供を終了し、2027 年 1 月 1 日に廃止する Custom Search JSON API を置き換える Apify Actor です。同じ /customsearch/v1 リクエストに、同じ JSON(title、link、displayLink、snippet を含む items と画像検索)で応答します。ライブの Google 検索結果を基に、1,000 回の検索あたり $5 で、1 日あたりの上限はありません。

料金: 最大 10 件の検索結果で 1,000 回あたり $5(Gold 以上では $4) · 実行する: https://apify.com/automationnation/google-custom-search-api · ガイド: https://retracn.github.io/automationnation-actors/google-custom-search-api/

基本情報

  • そのまま置き換えられるエンドポイント:https://www.googleapis.com/customsearch/v1 を https://automationnation--google-custom-search-api.apify.actor/customsearch/v1 に置き換え、key= の代わりに Apify トークン(token=… または Authorization: Bearer)を送信します。
  • 同じパラメーター:q、num、start、gl、hl、lr、cr、safe、dateRestrict、siteSearch、exactTerms、excludeTerms、orTerms、fileType、searchType=image とその画像フィルターに対応します。cx は受け付けますが、無視されます。
  • Open WebUI:External web search エンジンを選択し、URL に https://automationnation--google-custom-search-api.apify.actor/search、キーに Apify トークンを指定すると、Google PSE が新規顧客への提供を終了した後も Google の検索結果を利用できます。
  • AnythingLLM やその他の SearXNG クライアント向けの SearXNG 互換ルート:https://automationnation--google-custom-search-api.apify.actor/searxng?token=YOUR_APIFY_TOKEN は、SearXNG の JSON 形式で Google の検索結果を返します。
  • 同じ JSON:kind、queries.request と nextPage、searchInformation、title、htmlTitle、link、displayLink、snippet、htmlSnippet、formattedUrl を含む items[] を返します(画像の item には mime と image.contextLink、width、height、byteSize、thumbnailLink が追加されます)。
  • ウェブ検索では Google の「ウェブ」検索結果ビューを使用します。AI による概要、広告、動画やフォーラムのボックスを含まない、ページあたり 10 件の通常の検索結果で、API の返却結果に近い内容です。
  • 相違点:ウェブ全体を検索します(siteSearch または site: 演算子でサイトを指定してください)。totalResults は下限値であり、pagemap はなく、リクエストには約 4~10 秒かかります。
  • 料金:最大 10 件の検索結果で 1,000 回あたり $5。Google が請求していた料金と同額です。結果がない検索は無料で、1 日あたりの上限はありません。

Custom Search JSON API の代替としてそのまま使う

エンドポイントとキーを変更し、それ以外のコードはそのまま使います。

変更前変更後
エンドポイントhttps://www.googleapis.com/customsearch/v1https://automationnation--google-custom-search-api.apify.actor/customsearch/v1
認証key=YOUR_GOOGLE_KEY&cx=YOUR_ENGINE_IDtoken=YOUR_APIFY_TOKEN またはヘッダー Authorization: Bearer YOUR_APIFY_TOKEN
curl "https://automationnation--google-custom-search-api.apify.actor/customsearch/v1?q=best+crm+for+startups&num=10&token=$APIFY_TOKEN"

Python(examples/cse_requests.py)と JavaScript(examples/cse_fetch.mjs)の例は examples/ にあります。レスポンスは API と同じ JSON です:items[].title、link、displayLink、snippet、queries.nextPage、searchInformation。searchType=image にも対応しています。

入力例

{
  "queries": [
    "best project management software"
  ],
  "maxResultsPerQuery": 10
}

コードから実行する

REST API

curl -X POST "https://api.apify.com/v2/acts/automationnation~google-custom-search-api/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"queries": ["best project management software"], "maxResultsPerQuery": 10}'

Python — examples/python_example.py を参照してください。

# pip install apify-client
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("automationnation/google-custom-search-api").call(run_input={
  "queries": [
    "best project management software"
  ],
  "maxResultsPerQuery": 10
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item.get("title"), item.get("link"), item.get("displayLink"), item.get("snippet"))

JavaScript — examples/node_example.mjs を参照してください。

// npm install apify-client
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('automationnation/google-custom-search-api').call({
  "queries": [
    "best project management software"
  ],
  "maxResultsPerQuery": 10
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const item of items) console.log(item.title, item.link, item.displayLink, item.snippet);

AI エージェントと使う(MCP)

ホスト型 MCP サーバーの URL(Claude、ChatGPT、Cursor、およびリモート MCP に対応するその他のクライアント向け):

https://mcp.apify.com?tools=automationnation/google-custom-search-api

Claude Desktop / Cursor 用のローカル設定 — mcp/claude_desktop_config.json:

{
  "mcpServers": {
    "google-custom-search-api": {
      "command": "npx",
      "args": [
        "-y",
        "@apify/actors-mcp-server",
        "--tools",
        "automationnation/google-custom-search-api"
      ],
      "env": {
        "APIFY_TOKEN": "YOUR_APIFY_TOKEN"
      }
    }
  }
}

よくある質問

Custom Search JSON API はいつ動作しなくなりますか? Google は新規顧客への提供を終了しており、既存顧客は 2027 年 1 月 1 日までに代替サービスへ移行する必要があるとしています。

コードを書き換える必要がありますか? いいえ。エンドポイントを https://automationnation--google-custom-search-api.apify.actor/customsearch/v1 に変更し、Google のキーの代わりに Apify API トークンを送信してください。パラメーターと JSON レスポンスはそのままです。

Programmable Search Engine のサイトリストを引き継げますか? cx では引き継げません。cx は無視されます。1 つのサイトを siteSearch として渡すか、クエリ内で複数のサイトを site:a.com OR site:b.com のように指定してください。

料金はいくらですか? 最大 10 件の結果を含む検索 1,000 回あたり $5(Silver では $4.50、Gold 以上では $4)で、1 日あたりの上限はありません。Google では 1 日 100 件の無料検索後、検索 1,000 回あたり $5 が課金されていました。Apify の無料プランには月額 $5 分のクレジットが含まれており、検索約 1,000 回分に相当します。

AutomationNation のその他の情報


このリポジトリには使用例が含まれています。スクレイパー自体はApify platform上で動作します。無料のApifyアカウントとAPIトークンが必要です。使用例はMITライセンスです。

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。