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 专利 MCP 服务器 ( google-patents-mcp
)
该项目提供了一个模型上下文协议 (MCP) 服务器,允许通过SerpApi Google Patents API搜索 Google Patents 信息。
特征
- 提供 MCP 工具
search_patents
来搜索 Google Patents。 - 使用 SerpApi 作为后端。
- 无需本地安装即可直接使用
npx
运行。
先决条件
- **Node.js:**建议使用 18 或更高版本。
- **npm:**运行
npx
命令所需。 - **SerpApi API 密钥:**您需要来自SerpApi的有效 API 密钥才能使用 Google Patents API。
快速启动(使用 npx)
运行此服务器最简单的方法是使用npx
。此命令会直接下载(如有必要)并运行服务器。
**注意:**如果@kunihiros/google-patents-mcp
名称不同,请将其替换为实际发布的包名称。
服务器将启动并监听标准输入/输出上的 MCP 请求。
配置
服务器需要您的 SerpApi API 密钥。您可以通过以下方式之一提供该密钥:
- **环境变量(推荐用于 MCP 主机):**运行服务器时设置
SERPAPI_API_KEY
环境变量。MCP 主机配置通常允许为服务器设置环境变量。MCP 主机配置片段示例(config.json
或类似文件):Copy - **.env 文件:**在运行
npx
命令的目录中创建一个.env
文件(用于本地测试或不使用 MCP 主机时),或者在您的主目录(~/.google-patents-mcp.env
)中创建一个 .env 文件,其中包含以下内容:**注意:**虽然使用Copy.env
文件方便进行本地测试、生产环境或与 MCP 主机集成,但直接通过主机配置设置环境变量是推荐且更安全的方法。主要用例是通过npx
执行,其中环境变量通常由调用进程或 MCP 主机管理。
服务器按以下顺序搜索.env
文件:* ./.env
(相对于npx
运行的位置)* ~/.google-patents-mcp.env
(在您的主目录中)
提供MCP工具
search_patents
通过 SerpApi 搜索 Google 专利。
输入模式:
输出:
返回包含 SerpApi 搜索结果的 JSON 对象。其结构遵循 SerpApi 响应格式。
使用示例(MCP 请求):
发展
- 克隆存储库(如果开发需要):Copy
- 安装依赖项:Copy
- **创建
.env
文件:**将.env.example
复制到.env
并添加您的SERPAPI_API_KEY
。 - 建造:Copy
- 本地运行:或者对于具有自动重建的开发:CopyCopy
日志记录
- 日志输出到标准错误。
- 日志级别可以通过
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 文件)
You must be authenticated.
Tools
模型上下文协议服务器,可通过 SerpApi Google Patents API 搜索 Google Patents 信息,允许用户使用各种过滤器和排序选项查询专利数据。