mcpField
G
google-search-console

google-search-console

github.com/acedatacloudマーケティング・グロース17178 回インストール今日更新
リポジトリ

google-search-console について

curl と jq で Google Search Console API を呼び出すコマンドラインスキルです。サイト管理者が検索パフォーマンス、送信済みサイトマップ、URL のインデックス状況を調べられます。

主な機能

  1. 01確認済みサイトプロパティの一覧表示
  2. 02検索分析のディメンション別クエリ
  3. 03分析結果のフィルタリング
  4. 04サイトマップ状態の確認
  5. 05URL のインデックス状況確認

活用シーン

  1. 01クエリ別のクリック数と表示回数の確認
  2. 02ページや国ごとのパフォーマンス比較
  3. 03サイトマップのエラーと警告の確認
  4. 04URL のインデックス登録状況の確認

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/acedatacloud/skills --skill google-search-console

インストール後、Claude Code で/google-search-consoleを入力して読み込まれたか確認します。

詳細

curl + jq を使用して Google Search Console をクエリします。ユーザーの OAuth ベアラートークンは $GOOGLE_SEARCH_CONSOLE_TOKEN にあり、スコープは webmasters.readonly です。すべての呼び出しで Authorization: Bearer $GOOGLE_SEARCH_CONSOLE_TOKEN が必要です。ベース URL: https://searchconsole.googleapis.com。

失敗時は {"error":{"code","message","status"}} が返されます。内容をそのまま表示してください。401 = 再インストールしてください。403 = トークンのアカウントがそのサイトの所有者ではないか、所有権を確認できていません。

AUTH="Authorization: Bearer $GOOGLE_SEARCH_CONSOLE_TOKEN"
# Verified sites (siteUrl is the property — URL-encode it in later calls)
curl -sS -H "$AUTH" "https://searchconsole.googleapis.com/webmasters/v3/sites" \
  | jq '.siteEntry[] | {siteUrl, permissionLevel}'

検索アナリティクス

# Top queries by clicks for the last 28 days. siteUrl must be URL-encoded
# (https%3A%2F%2Fexample.com%2F  or  sc-domain%3Aexample.com).
SITE="https%3A%2F%2Fexample.com%2F"
curl -sS -X POST -H "$AUTH" -H "Content-Type: application/json" -d '{
  "startDate":"2026-05-24","endDate":"2026-06-21",
  "dimensions":["query"],"rowLimit":10
}' "https://searchconsole.googleapis.com/webmasters/v3/sites/$SITE/searchAnalytics/query" \
  | jq '.rows[] | {query: .keys[0], clicks, impressions, ctr, position}'

dimensions を ["page"]、["country"]、["date"] に置き換えるか、["query","page"] のように組み合わせます。 ページや国で絞り込むには "dimensionFilterGroups" を追加します。

サイトマップと URL 検査

# Submitted sitemaps
curl -sS -H "$AUTH" "https://searchconsole.googleapis.com/webmasters/v3/sites/$SITE/sitemaps" \
  | jq '.sitemap[] | {path, lastDownloaded, errors, warnings}'

# Is a URL indexed?
curl -sS -X POST -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"inspectionUrl":"https://example.com/page","siteUrl":"https://example.com/"}' \
  "https://searchconsole.googleapis.com/v1/urlInspection/index:inspect" \
  | jq '.inspectionResult.indexStatusResult | {verdict, coverageState, lastCrawlTime}'

注意点

  • プロパティの形式は 2 種類あります: URL プレフィックス(https://example.com/)とドメイン (sc-domain:example.com)です。サイト一覧にある siteUrl を URL エンコードして、そのまま使用してください。
  • データの反映には約 2~3 日かかります。直近の日付のデータは不完全または空の場合があるため、安定した数値を得るには endDate を数日前に設定してください。
  • ctr の範囲は 0~1 で、position は平均順位です(数値が小さいほど上位です)。

コメント