SoftwareStartups/google-patents-mcp
If you are the rightful owner of google-patents-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Google Patents MCP Server allows users to search and retrieve patent information using the SerpApi Google Patents API.
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.
Credits
This project is a fork of the original google-patents-mcp by Kunihiro Sasayama. We extend our gratitude for the foundational work and inspiration.
Installing via Smithery
To install Google Patents MCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @SoftwareStartups/google-patents-mcp --client claude
Features
- Provides two focused MCP tools for patent research:
search_patents- Fast metadata search via SerpApiget_patent- Comprehensive patent data retrieval (claims, description, family members, citations, metadata)
- Uses SerpApi for both search and detailed patent information via structured endpoints.
- Can be run directly using
npxwithout local installation.
Prerequisites
- Node.js: Version 18 or higher is recommended.
- npm: Required to run the
npxcommand. - 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.
npx @softwarestartups/google-patents-mcp
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_KEYenvironment variable when running the server. MCP Host configurations often allow setting environment variables for servers.Example MCP Host configuration snippet (
config.jsonor similar):{ "mcpServers": { "google-patents-mcp": { "command": "npx", "args": [ "-y", "@softwarestartups/google-patents-mcp" ], "env": { "SERPAPI_API_KEY": "YOUR_ACTUAL_SERPAPI_KEY" } } } } -
.env File: Create a
.envfile in the directory where you run thenpxcommand (for local testing or if not using an MCP Host), or in your home directory (~/.google-patents-mcp.env), with the following content:SERPAPI_API_KEY=YOUR_ACTUAL_SERPAPI_KEY # Optional: Set log level (e.g., debug, info, warn, error) # LOG_LEVEL=debugNote: While using a
.envfile 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
.envfiles in the following order:./.env(relative to wherenpxis run)~/.google-patents-mcp.env(in your home directory)
Provided MCP Tools
search_patents
Searches Google Patents via SerpApi. Returns patent metadata only (no full text).
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | No | Search query. Use semicolon to separate terms |
page | integer | No | Page number for pagination (default: 1) |
num | integer | No | Results per page (10-100, default: 10) |
sort | string | No | Sort by: 'new' (newest by filing/publication date) or 'old' (oldest by filing/publication date) |
before | string | No | Max date filter (e.g., 'publication:20231231') |
after | string | No | Min date filter (e.g., 'publication:20230101') |
inventor | string | No | Filter by inventor names (comma-separated) |
assignee | string | No | Filter by assignee names (comma-separated) |
country | string | No | Filter by country codes (e.g., 'US', 'WO,JP') |
language | string | No | Filter by language (e.g., 'ENGLISH', 'JAPANESE') |
status | string | No | Filter by status: 'GRANT' or 'APPLICATION' |
type | string | No | Filter by type: 'PATENT' or 'DESIGN' |
scholar | boolean | No | Include Google Scholar results (default: false) |
Returns: Patent metadata including title, publication number, assignee, inventor, dates, and patent_link (used for get_patent).
Example:
{
"name": "search_patents",
"arguments": {
"q": "quantum computing",
"num": 10,
"status": "GRANT",
"country": "US",
"after": "publication:20230101"
}
}
get_patent
Fetches comprehensive patent data from SerpAPI including claims, description, family members, citations, and metadata. Supports selective content retrieval through the include parameter.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
patent_url | string | No* | Full Google Patents URL (from search results) |
patent_id | string | No* | Patent ID (e.g., 'US1234567A') |
include | array | No | Array of content sections to include. Valid values (case-insensitive): "claims", "description", "abstract", "family_members", "citations", "metadata". Defaults to ["metadata", "abstract"]. |
max_length | integer | No | Maximum character length for returned content. Content will be truncated at natural boundaries (paragraph ends, complete claims). If omitted, no limit is applied. |
*At least one parameter (patent_url or patent_id) must be provided. If both are provided, patent_url takes precedence.
Returns: JSON object with requested fields:
patent_id(string): Patent identifiertitle(string): Patent title (if "metadata" is in include array)abstract(string): Patent abstract summary (if "abstract" is in include array)description(string): Full patent description text (if "description" is in include array)claims(string[]): Array of patent claims (if "claims" is in include array)family_members(array): Patent family members with region and status (if "family_members" is in include array)citations(object): Citation counts including forward_citations, backward_citations, family_to_family_citations (if "citations" is in include array)publication_number(string): Patent publication number (if "metadata" is in include array)assignee(string): Patent assignee (if "metadata" is in include array)inventor(string): Patent inventor (if "metadata" is in include array)priority_date(string): Priority filing date (if "metadata" is in include array)filing_date(string): Filing date (if "metadata" is in include array)publication_date(string): Publication date (if "metadata" is in include array)grant_date(string): Grant date (if "metadata" is in include array)
Fields are omitted from the response if they are not requested in the include array or if the content could not be retrieved.
Examples:
Fetch metadata and abstract (default):
{
"name": "get_patent",
"arguments": {
"patent_url": "https://patents.google.com/patent/US7654321B2"
}
}
Using patent ID:
{
"name": "get_patent",
"arguments": {
"patent_id": "US7654321B2"
}
}
Fetch only claims:
{
"name": "get_patent",
"arguments": {
"patent_id": "US7654321B2",
"include": ["claims"]
}
}
Fetch only abstract:
{
"name": "get_patent",
"arguments": {
"patent_id": "US7654321B2",
"include": ["abstract"]
}
}
Fetch comprehensive patent analysis with all sections:
{
"name": "get_patent",
"arguments": {
"patent_url": "https://patents.google.com/patent/US7654321B2",
"include": ["metadata", "abstract", "description", "claims", "family_members", "citations"]
}
}
Fetch content with length limit to minimize token usage:
{
"name": "get_patent",
"arguments": {
"patent_id": "US7654321B2",
"include": ["description", "claims"],
"max_length": 5000
}
}
Typical Workflow
The two tools are designed to work together:
- Search for patents using
search_patentsto find relevant patents - Get comprehensive data using
get_patentfor patents of interest
Example workflow:
// Step 1: Search for patents
const searchResult = await callTool({
name: "search_patents",
arguments: {
q: "neural network chip",
num: 10,
status: "GRANT"
}
});
// Step 2: Get comprehensive data for first result
const firstPatent = searchResult.organic_results[0];
const patentData = await callTool({
name: "get_patent",
arguments: {
patent_url: firstPatent.patent_link,
include: ["metadata", "abstract", "description", "claims", "family_members", "citations"]
}
});
// Now you have comprehensive patent data including:
// - Basic metadata (title, assignee, dates)
// - Abstract summary
// - Full description and claims
// - Patent family members across different countries
// - Citation counts for patent strength assessment
console.log(patentData.family_members);
console.log(patentData.citations);
Development
Setup
-
Clone the repository:
git clone https://github.com/SoftwareStartups/google-patents-mcp.git cd google-patents-mcp -
Install dependencies:
make install # or: npm install -
Set up environment variables:
Create a
.envfile in the project root. First, create a.env.examplefile with the following content:# SerpApi Configuration # Get your API key from https://serpapi.com/ SERPAPI_API_KEY=your_serpapi_key_here # Optional: Set log level (error, warn, info, http, verbose, debug, silly) # LOG_LEVEL=infoThen copy it to
.envand edit with your actual API key:cp .env.example .env # Edit .env and replace 'your_serpapi_key_here' with your actual SerpApi key
Development Workflow
Build the project:
make build
# or: npm run build
Format code:
make format
# or: npm run format
Check code quality (lint + typecheck):
make check
# or: npm run lint && npm run typecheck
Run tests:
make test
# or: npm test
Clean build artifacts:
make clean
Full build pipeline:
make all
# Runs: clean → install → build → check → test
Run Locally
Production mode:
npm start
Development mode (with auto-rebuild):
npm run dev
Testing
The project includes unit tests, integration tests, and end-to-end tests with real API calls:
# Install dependencies and build
make install
make build
# Set up environment variables (see Development Setup section above)
# The e2e tests will automatically load SERPAPI_API_KEY from .env file
# Run all tests (unit + integration)
make test
# Run unit tests only
make test-unit
# Run integration tests only
make test-integration
# Run end-to-end tests with real SerpAPI calls
make test-e2e
# Run all tests including e2e
make test-all
Test Types
- Unit Tests: Test individual functions and classes in isolation
- Integration Tests: Test the MCP server functionality with mocked API responses
- End-to-End Tests: Test complete workflows with real SerpAPI calls
The end-to-end tests validate that the server can successfully:
- Search for patents using real SerpAPI queries
- Fetch patent content with claims, descriptions, and metadata
- Handle various search filters and parameters
- Process patent family members and citations
- Complete full workflows from search to content retrieval
Note: End-to-end tests automatically load SERPAPI_API_KEY from the .env file and will make actual API calls, which may consume your SerpAPI quota.
Logging
- Logs are output to standard error.
- Log level can be controlled via the
LOG_LEVELenvironment 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.