Google Patents MCP Server
Integrations
Supports configuration via .env files, allowing users to securely provide API keys and configure logging levels without exposing sensitive information.
Provides a tool for searching Google Patents information, allowing users to query patent data with various filters like dates, inventors, assignees, countries, and languages via the SerpApi Google Patents API.
Offers optional inclusion of Google Scholar results when searching for patents, allowing users to retrieve academic research related to patent searches.
Google Patents MCP Server (google-patents-mcp
)
This project provides a Model Context Protocol (MCP) server that allows searching Google Patents information via the SerpApi Google Patents API.
Features
- Provides an MCP tool
search_patents
to search Google Patents. - Uses SerpApi as the backend.
- Can be run directly using
npx
without local installation.
Prerequisites
- Node.js: Version 18 or higher is recommended.
- npm: Required to run the
npx
command. - SerpApi API Key: You need a valid API key from SerpApi to use the Google Patents API.
Quick Start (Using npx)
The easiest way to run this server is using npx
. This command downloads (if necessary) and runs the server directly.
Note: Replace @kunihiros/google-patents-mcp
with the actual published package name if it differs.
The server will start and listen for MCP requests on standard input/output.
Configuration
The server requires your SerpApi API key. You can provide it in one of the following ways:
- Environment Variable (Recommended for MCP Hosts):
Set the
SERPAPI_API_KEY
environment variable when running the server. MCP Host configurations often allow setting environment variables for servers.Example MCP Host configuration snippet (config.json
or similar):Copy - .env File:
Create a
.env
file in the directory where you run thenpx
command (for local testing or if not using an MCP Host), or in your home directory (~/.google-patents-mcp.env
), with the following content:Note: While using aCopy.env
file is convenient for local testing, for production or integration with MCP Hosts, setting the environment variable directly via the host configuration is the recommended and more secure approach. The primary intended use case is execution vianpx
, where environment variables are typically managed by the calling process or MCP Host.
The server searches for .env
files in the following order:
* ./.env
(relative to where npx
is run)
* ~/.google-patents-mcp.env
(in your home directory)
Provided MCP Tool
search_patents
Searches Google Patents via SerpApi.
Input Schema:
Output:
Returns a JSON object containing the search results from SerpApi. The structure follows the SerpApi response format.
Example Usage (MCP Request):
Development
- Clone the repository (if needed for development):Copy
- Install dependencies:Copy
- Create
.env
file: Copy.env.example
to.env
and add yourSERPAPI_API_KEY
. - Build:Copy
- Run locally:Or for development with auto-rebuild:CopyCopy
Logging
- Logs are output to standard error.
- Log level can be controlled via the
LOG_LEVEL
environment variable (error
,warn
,info
,http
,verbose
,debug
,silly
). Defaults toinfo
. - A log file is attempted to be created in the project root (
google-patents-server.log
), user's home directory (~/.google-patents-server.log
), or/tmp/google-patents-server.log
.
License
MIT License (See LICENSE file)
You must be authenticated.
A Model Context Protocol server that enables searching Google Patents information via the SerpApi Google Patents API, allowing users to query patent data with various filters and sorting options.