Google Patents MCP サーバー ( google-patents-mcp )
このプロジェクトは、SerpApi Google Patents APIを介して Google Patents 情報を検索できる Model Context Protocol (MCP) サーバーを提供します。
変更履歴
v0.2.0 (2025-04-17)
修正:
resources/listおよびprompts/listMCP メソッドに空のハンドラーを実装しました。**修正:**サーバーの初期化時に
prompts機能を宣言しました。**Chore:**依存関係を更新しました。
これらの変更は、これらの標準エンドポイントを必要とする可能性のある Claude Desktop などの MCP クライアントとの互換性を向上させることを目的としていますが、Claude Desktop での直接テストはまだ実行されていません。
Related MCP server: MCP Server for Google Search
特徴
Google Patents を検索するための MCP ツール
search_patentsを提供します。バックエンドとして SerpApi を使用します。
ローカルにインストールせずに
npxを使用して直接実行できます。
前提条件
**Node.js:**バージョン 18 以上を推奨します。
npm:
npxコマンドを実行するために必要です。SerpApi API キー: Google Patents API を使用するには、 SerpApiからの有効な API キーが必要です。
クイックスタート(npx を使用)
このサーバーを実行する最も簡単な方法は、 npxを使用することです。このコマンドは、(必要に応じて)サーバーをダウンロードし、直接実行します。
npx @kunihiros/google-patents-mcp**注:**異なる場合は@kunihiros/google-patents-mcp実際の公開パッケージ名に置き換えてください。
サーバーが起動し、標準入出力で MCP 要求をリッスンします。
構成
サーバーはSerpApi APIキーを必要とします。以下のいずれかの方法で提供できます。
**環境変数(MCP ホストに推奨):**サーバー実行時に
SERPAPI_API_KEY環境変数を設定します。MCP ホスト構成では、多くの場合、サーバーの環境変数を設定できます。MCP ホスト構成スニペットの例 (
config.jsonまたは類似のもの):{ "mcpServers": { "google-patents-mcp": { "command": "npx", "args": [ "-y", // Skips confirmation if the package isn't installed locally "@kunihiros/google-patents-mcp" // Use the correct package name ], "env": { "SERPAPI_API_KEY": "YOUR_ACTUAL_SERPAPI_KEY" // Optional: Set log level // "LOG_LEVEL": "debug" } } } }.env ファイル:
npxコマンドを実行するディレクトリ (ローカルテストの場合、または MCP ホストを使用していない場合)、またはホームディレクトリ (~/.google-patents-mcp.env) に、次の内容の.envファイルを作成します。SERPAPI_API_KEY=YOUR_ACTUAL_SERPAPI_KEY # Optional: Set log level (e.g., debug, info, warn, error) # LOG_LEVEL=debug注:
.envファイルの使用はローカルテストには便利ですが、本番環境やMCPホストとの統合では、ホスト設定を介して環境変数を直接設定することが推奨され、より安全な方法です。主な使用例はnpx経由の実行であり、この場合、環境変数は通常、呼び出し元プロセスまたはMCPホストによって管理されます。
サーバーは、次の順序で.envファイルを検索します: * ./.env ( npxが実行される場所からの相対パス) * ~/.google-patents-mcp.env (ホーム ディレクトリ内)
提供されたMCPツール
search_patents
SerpApi 経由で Google 特許を検索します。
入力スキーマ:
{
"type": "object",
"properties": {
"q": {
"type": "string",
"description": "Search query (required). Although optional in SerpApi docs, a non-empty query is practically needed. Use semicolon (;) to separate multiple terms. Advanced syntax like '(Coffee) OR (Tea);(A47J)' is supported. See 'About Google Patents' for details."
},
"page": {
"type": "integer",
"description": "Page number for pagination (default: 1).",
"default": 1
},
"num": {
"type": "integer",
"description": "Number of results per page (default: 10). **IMPORTANT: Must be 10 or greater (up to 100).**",
"default": 10,
"minimum": 10,
"maximum": 100
},
"sort": {
"type": "string",
"enum": ["relevance", "new", "old"],
"description": "Sorting method. 'relevance' (default), 'new' (newest by filing/publication date), 'old' (oldest by filing/publication date).",
"default": "relevance"
},
"before": {
"type": "string",
"description": "Maximum date filter (e.g., 'publication:20231231', 'filing:20220101'). Format: type:YYYYMMDD where type is 'priority', 'filing', or 'publication'."
},
"after": {
"type": "string",
"description": "Minimum date filter (e.g., 'publication:20230101', 'filing:20220601'). Format: type:YYYYMMDD where type is 'priority', 'filing', or 'publication'."
},
"inventor": {
"type": "string",
"description": "Filter by inventor names. Separate multiple names with a comma (,)."
},
"assignee": {
"type": "string",
"description": "Filter by assignee names. Separate multiple names with a comma (,)."
},
"country": {
"type": "string",
"description": "Filter by country codes (e.g., 'US', 'WO,JP'). Separate multiple codes with a comma (,)."
},
"language": {
"type": "string",
"description": "Filter by language (e.g., 'ENGLISH', 'JAPANESE,GERMAN'). Separate multiple languages with a comma (,). Supported: ENGLISH, GERMAN, CHINESE, FRENCH, SPANISH, ARABIC, JAPANESE, KOREAN, PORTUGUESE, RUSSIAN, ITALIAN, DUTCH, SWEDISH, FINNISH, NORWEGIAN, DANISH."
},
"status": {
"type": "string",
"enum": ["GRANT", "APPLICATION"],
"description": "Filter by patent status: 'GRANT' or 'APPLICATION'."
},
"type": {
"type": "string",
"enum": ["PATENT", "DESIGN"],
"description": "Filter by patent type: 'PATENT' or 'DESIGN'."
},
"scholar": {
"type": "boolean",
"description": "Include Google Scholar results (default: false).",
"default": false
}
},
"required": ["q"]
}出力:
SerpApiからの検索結果を含むJSONオブジェクトを返します。構造はSerpApiのレスポンス形式に従います。
使用例(MCPリクエスト):
{
"mcp_version": "1.0",
"type": "CallToolRequest",
"id": "req-123",
"server_name": "google-patents-mcp",
"params": {
"name": "search_patents",
"arguments": {
"q": "organic light emitting diode",
"num": 10,
"language": "ENGLISH",
"status": "GRANT",
"after": "publication:20230101"
}
}
}発達
リポジトリをクローンします (開発に必要な場合)。
# git clone <repository-url> # cd google-patents-mcp依存関係をインストールします:
npm install.env.env.exampleを.envにコピーし、SERPAPI_API_KEYを追加します。建てる:
npm run buildローカルで実行:
npm startまたは、自動再構築を使用した開発の場合:
npm run dev
ログ記録
ログは標準エラーに出力されます。
ログレベルは
LOG_LEVEL環境変数で制御できます(error、warn、info、http、verbose、debug、silly)。デフォルトはinfoです。ログ ファイルは、プロジェクト ルート (
google-patents-server.log)、ユーザーのホーム ディレクトリ (~/.google-patents-server.log)、または/tmp/google-patents-server.logに作成されます。
ライセンス
MITライセンス(LICENSEファイルを参照)