使用说明
专利范围
通过CLI搜索和检索谷歌专利数据 SerpApi Google 专利 API. 也作为一个 主控程序 用于人工智能辅助专利研究的服务器。
学分
这个项目是原始项目的一个分支 谷歌专利mcp 通过 你应该后悔。。我们对基础工作和灵感表示感谢。
快速开始
# Install
bun add -g @softwarestartups/patentscope
# Or run without installing
bunx @softwarestartups/patentscope search "quantum computing"
预构建的二进制文件(无需运行时)可在 GitHub发布 页面。
与Claude Code一起使用
这个repo是一个Claude Code插件市场。安装配套技能,以便Claude Code能够驾驶 patentscope 为你:
/plugin marketplace add SoftwareStartups/patentscope
/plugin install patentscope@softwarestartups-patentscope
安装后,只需用简单的语言询问Claude(例如,“搜索Inventor X的自适应光学专利”),该技能就会自动激活。该插件跟踪此仓库的发布——run /plugin marketplace update softwarestartups-patentscope 获取最新的技能修订。
先决条件
- 面包: 1.0或更高版本(使用预构建二进制文件时不需要)。
- SerpApi API密钥: 来自的有效密钥 SerpApi.
配置
使用保存API密钥一次 login 命令:
patentscope login
# Enter your SerpApi API key: ****
# Or non-interactively
patentscope login --api-key YOUR_KEY
密钥存储在 ~/.config/patentscope/config.json 具有严格的文件权限。
要删除存储的密钥,请执行以下操作:
patentscope logout
这 SERPAPI_API_KEY 环境变量优先于存储的配置,这对CI或临时覆盖很有用。
CLI使用情况
Usage: patentscope <command> [flags]
Commands:
login Save your SerpApi API key
logout Remove saved API key
search [query] Search Google Patents
get <patentId> Get patent details
serve Start the MCP server on stdio
Flags:
-h, --help Show this help message
-v, --version Show version information
--json Output as JSON
所有人类可读的输出都转到 标准错误.Stdout保留用于 --json 结构化输出和MCP JSON-RPC传输(in serve 模式)。
专利检索
# Basic search
patentscope search "neural network chip"
# With filters
patentscope search "battery" --status GRANT --country US --num 20
# Date range
patentscope search "CRISPR" --after publication:20230101 --before publication:20231231
# Filter by inventor or assignee
patentscope search --inventor "John Smith" --assignee "Google"
# JSON output
patentscope search "quantum computing" --json
搜索标志:
| 标志 | 描述 |
|---|---|
-p, --page |
页码(默认值:1) |
-n, --num |
每页结果数(10-100,默认值:10) |
--sort |
排序方式 new 或 old |
--before |
最大日期(例如。 publication:20231231) |
--after |
最小日期(例如。 publication:20230101) |
--inventor |
按发明人筛选 |
--assignee |
按受让人筛选 |
--country |
国家代码(例如。 US, WO,JP) |
--language |
语言(例如。 ENGLISH, JAPANESE) |
--status |
GRANT 或 APPLICATION |
--type |
PATENT 或 DESIGN |
--scholar |
包含谷歌学术搜索结果 |
检索专利详细信息
# Get metadata and abstract (default)
patentscope get US7654321B2
# Get specific sections
patentscope get US7654321B2 --include claims,description
# Get everything
patentscope get EP3456789A1 --include metadata,abstract,claims,description,family_members,citations
# Limit content length
patentscope get US7654321B2 --include description,claims --maxLength 5000
# JSON output
patentscope get US7654321B2 --json
获取标志:
| 标志 | 描述 |
|---|---|
-i, --include |
逗号分隔的部分: metadata, abstract, claims, description, family_members, citations (默认值: metadata,abstract) |
--maxLength |
返回内容的最大字符长度 |
JSON输出模式
添加 --json 对于stdout上用于结构化输出的任何命令:
patentscope search "quantum computing" --json
patentscope get US7654321B2 --json
patentscope --version --json
patentscope --help --json
MCP服务器
这 serve 该命令启动stdio上的MCP服务器,提供两个工具:
search_patents 和 get_patent.
MCP主机配置
使用预构建的二进制文件(从下载 GitHub发布):
{
"mcpServers": {
"patentscope": {
"command": "/path/to/patentscope-darwin-arm64",
"args": ["serve"]
}
}
}
使用 bunx:
{
"mcpServers": {
"patentscope": {
"command": "bunx",
"args": ["@softwarestartups/patentscope", "serve"]
}
}
}
MCP服务器使用的API密钥来自 ~/.config/patentscope/config.json (通过设置 patentscope login).用覆盖 SERPAPI_API_KEY 环境变量(如果需要)。
MCP工具
search_patents
通过SerpApi搜索谷歌专利。返回专利元数据(标题、出版物编号、受让人、发明人、日期和 patent_link).
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
q |
string | 否 | 搜索查询(以分号分隔的术语) |
page |
integer | 否 | 页码(默认值:1) |
num |
integer | 否 | 每页结果数(10-100,默认值:10) |
sort |
string | 否 | new 或 old |
before |
string | 否 | 最大日期(例如。 publication:20231231) |
after |
string | 否 | 最小日期(例如。 publication:20230101) |
inventor |
string | 否 | 发明人姓名(逗号分隔) |
assignee |
string | 否 | 受让人姓名(逗号分隔) |
country |
string | 否 | 国家代码(例如。 US, WO,JP) |
language |
string | 否 | 语言(例如。 ENGLISH, JAPANESE) |
status |
string | 否 | GRANT 或 APPLICATION |
type |
string | 否 | PATENT 或 DESIGN |
scholar |
boolean | 否 | 包括谷歌学术搜索结果(默认值:false) |
get_patent
获取全面的专利数据,包括权利要求、描述、家族成员、引用和元数据。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
patent_url |
string | 否* | 完整的谷歌专利URL |
patent_id |
string | 否* | 专利ID(例如。 US1234567A) |
include |
array | 否 | 要包含的节(默认值: ["metadata", "abstract"]) |
max_length |
integer | 否 | 内容的最大字符长度 |
*至少一个 patent_url 或 patent_id 必须提供。如果两者都给出, patent_url 优先。
二进制版本
所有支持平台的预构建二进制文件均可在 GitHub发布 页面。 无需安装Bun或Node.js。
| 平台 | 架构 | 二进制 |
|---|---|---|
| Linux | x64 | patentscope-linux-x64 |
| Linux | arm64 | patentscope-linux-arm64 |
| macOS | x64 | patentscope-darwin-x64 |
| macOS | arm64 | patentscope-darwin-arm64 |
curl -L https://github.com/SoftwareStartups/patentscope/releases/latest/download/patentscope-darwin-arm64 -o patentscope
chmod +x patentscope
./patentscope login
./patentscope search "quantum computing"
释放
按下semver标签以触发发布工作流:
git tag v1.2.3
git push origin v1.2.3
发展
设置
git clone https://github.com/SoftwareStartups/patentscope.git
cd patentscope
bun install
patentscope login # or: export SERPAPI_API_KEY=your_key
工作流程
task build # Build
task format # Format code
task check # Lint + typecheck
task test # Unit + integration tests
task test:e2e # End-to-end tests (real API calls)
task all # clean -> install -> build -> check -> test
在本地运行
bun src/index.ts search "quantum computing"
bun src/index.ts get US7654321B2
bun src/index.ts serve
日志记录
日志将转到stderr。通过以下方式控制液位 LOG_LEVEL (错误、警告、信息、http、详细、调试、愚蠢)。默认为 info.