SerpApi MCP Server

by ilyazub
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Manages environment variables for the MCP server, specifically for storing and accessing the SerpApi API key

  • Retrieves parsed search results from Baidu search engine via SerpApi

  • Performs searches on DuckDuckGo and retrieves parsed search results via SerpApi

SerpApi MCP サーバー

次の機能を備えた MCP サーバーを構築します。

  • APIキーを使用してSerpApi経由で解析された検索エンジンの結果ページを高速に取得します

このMCP(モデルコンテキストプロトコル)サーバーはSerpApiと統合されており、様々な検索エンジンで検索を実行し、ライブ検索結果とアーカイブ検索結果の両方を取得します。GrokやClaude for DesktopなどのMCPクライアントやホストとのシームレスな連携を可能にするツールとリソースを公開しています。


インストール

SerpApi MCP サーバーをセットアップするには、必要な Python ライブラリをインストールします。

pip install mcp serpapi python-dotenv

SerpApi APIキーも必要です。SerpApiにサインアップして取得してください。

クイックスタート

  1. サーバー コードを保存します。サーバー コードをファイル (例: server.py) に配置します。
  2. API キーを設定します。SerpApi API キーと同じディレクトリに .env ファイルを作成します。
SERPAPI_API_KEY=your_api_key_here
  1. サーバーの実行: 次のコマンドでサーバーを起動します。
python server.py
  1. MCPクライアントとの統合:サーバーをMCPクライアントまたはホスト(例:Claude for Desktop)に接続します。Claudeの場合は、Claude_desktop_config.jsonを更新します。
{ "mcpServers": { "serpapi": { "command": "python", "args": ["path/to/server.py"] } } }

サーバーをロードするにはクライアントを再起動します。

特徴

  • サポートされているエンジン: Google、Google Light、Bing、Walmart、Yahoo、eBay、YouTube、DuckDuckGo、Yandex、Baidu
  • ツール:
  • search: クエリとオプションのパラメータを使用して、指定されたエンジンで検索を実行します。
  • リソース
  • 場所: Google ロケーションを検索します。

使用例

これらの例では、MCPクライアント(例:MCPクライアントSDKを使用してPythonで記述されたもの)がサーバーに接続されていることを前提としています。サポートされている検索エンジンの一覧を取得するには、次のようにします。

engines = await session.read_resource("locations") print(engines)

検索の実行 場所フィルターを使用して Google で「コーヒー」を検索します。

result = await session.call_tool("search", { "query": "coffee", "engine": "google", "location": "Austin, TX" })

print(結果)

構成

API キー: .envファイルで SerpApi API キーをSERPAPI_API_KEYとして設定します。

サーバーの実行

プロダクション モード: 次のコマンドでサーバーを起動します。

python server.py

開発モード: デバッグには MCP インスペクタを使用します。

mcp dev server.py

テスト

MCP Inspector または MCP クライアントを使用してサーバーをテストします。Claude for Desktop の場合は、 Claude_desktop_config.jsonでサーバーを設定し、アプリを再起動して、ハンマーアイコンを使用して利用可能なツールを調べ、テストします。

-
security - not tested
F
license - not found
-
quality - not tested

SerpApi と統合して、Google、Bing、Yahoo などの複数の検索エンジンから検索結果を取得し、ライブ検索データとアーカイブ検索データの両方に高速アクセスできるようにする MCP サーバーです。

  1. Installation
    1. Quick Start
      1. Features
        1. Usage Examples
          1. Configuration
            1. Running the Server
          2. Testing
            ID: ps1js70fi2