OpenPlantbook MCP服务器
 ](https://golang.org)
MCP(模型上下文协议)服务器,为克劳德等人工智能助手提供访问 OpenPlantbook API -植物护理信息的众包数据库。
特性
- 5个MCP工具 对于工厂数据访问:
- search_plants -按名称搜索植物 - get_plant_care -获取详细的护理要求 - get_care_summary -人类可读的护理总结 - compare_conditions -将传感器读数与理想范围进行比较 - server_info -获取构建元数据和运行时状态
- 双重身份验证:同时支持API密钥和OAuth2
- 结构化日志记录:JSON日志记录到STDERR或具有跟踪ID的文件
- 调试日志记录:可配置的日志文件输出,用于故障排除
- 优雅地关闭:正确的信号处理
- 基于官方SDK构建:用途 openplantbook go v1.0.1
快速开始
安装
🎉 一键安装(推荐)
从以下网址下载适用于您平台的MCPB包 最新版本 并在Claude Desktop中打开它:
- macOS 苹果芯片:
openplantbook-mcp-darwin-arm64.mcpb - macOS英特尔:
openplantbook-mcp-darwin-amd64.mcpb - Linux(x64):
openplantbook-mcp-linux-amd64.mcpb - Linux(ARM64):
openplantbook-mcp-linux-arm64.mcpb - 视窗:
openplantbook-mcp-windows-amd64.mcpb
Claude Desktop将自动:
- 安装服务器
- 提示您输入OpenPlantbook API密钥
- 为您配置一切
获取您的免费API密钥:https://open.plantbook.io/apikey/show/
📦 手动安装
或者,从源代码构建或下载独立二进制文件:
# Install from source
git clone https://github.com/rmrfslashbin/openplantbook-mcp.git
cd openplantbook-mcp
make install
# Or build locally
make build或者从以下网址下载预构建的二进制文件 最新版本.
手动配置
如果使用手动安装,请配置Claude Desktop:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"openplantbook": {
"command": "/path/to/openplantbook-mcp",
"args": [],
"env": {
"OPENPLANTBOOK_API_KEY": "your_api_key_here"
}
}
}
}重新启动Claude Desktop以加载服务器。
用法
配置后,您可以向Claude提出以下问题:
- “美味虫的护理要求是什么?”
- “寻找和平百合”
- “将我的工厂传感器读数与理想条件进行比较”
- “给我一份罗勒护理要求的总结”
交互示例
寻找植物:
User: "Search for monstera plants"
Claude: [Uses search_plants tool]
Found 3 Monstera varieties:
- Monstera deliciosa (Swiss Cheese Plant)
- Monstera adansonii (Monkey Mask)
- Monstera friedrichsthalii获取护理细节:
User: "What are the care requirements for monstera deliciosa?"
Claude: [Uses get_plant_care tool]
Monstera deliciosa needs:
- Light: 1500-3000 lux (Medium indirect light)
- Temperature: 18-27°C
- Humidity: 60-80%
- Soil Moisture: 25-60% (Keep evenly moist)比较条件:
User: "My monstera has 15% moisture, 22°C temp, and 1800 lux light. How does that compare?"
Claude: [Uses compare_conditions tool]
Analysis for Monstera deliciosa:
- ❌ Soil Moisture Too Low: 15% (needs 25-60%, 10% below minimum)
- ✅ Temperature: 22°C (within 18-27°C range)
- ✅ Light: 1800 lux (within 1500-3000 lux range)
Summary: 1 condition needs attention - increase watering.可用工具
关于工厂ID(PID)的说明: OpenPlantbook API使用具有空格作为标识符的小写植物名称(例如。,"monstera deliciosa","ocimum basilicum").始终使用精确的pid返回的值search_plants调用其他工具时。
搜索植物
按常用名称或学名搜索植物。返回带空格的小写植物ID。
参数:
query(字符串,必填):要搜索的植物名称limit(数字,可选):最大结果(默认值:10)
例子:
{
"query": "tomato",
"limit": 5
}get_plant_care
获取特定植物的详细护理要求。
参数:
pid(字符串,必填):搜索结果中的植物IDlanguage(字符串,可选):语言代码(例如,“en”、“de”、“es”)
例子:
{
"pid": "monstera deliciosa",
"language": "en"
}get_care_summary
获取一份人类可读的护理总结,其中包含解释范围。
参数:
pid(字符串,必填):搜索结果中的植物IDmetric(布尔值,可选):使用公制单位(默认值:true)
例子:
{
"pid": "ocimum basilicum",
"metric": true
}比较条件
将当前传感器读数与理想的植物护理范围进行比较。
参数:
pid(字符串,必填):搜索结果中的植物IDcurrent_conditions(对象,必填):传感器读数
- moisture (数字):土壤湿度百分比(0-100) - temperature (数字):温度(摄氏度) - light_lux (数字):照度(勒克斯) - humidity (数字):湿度百分比(0-100)
例子:
{
"pid": "monstera deliciosa",
"current_conditions": {
"moisture": 45,
"temperature": 22,
"light_lux": 2000,
"humidity": 65
}
}服务器信息
获取服务器版本、构建信息和运行时状态。
参数: 无
退货:
- 服务器版本和构建元数据
- SDK版本(openplantbook go)
- MCP框架详细信息(MCP来自mark3labs)
- 运行时状态(PID、刀具计数)
- 配置(缓存、日志级别、身份验证方法)
例子:
{}答复:
{
"server": {
"name": "openplantbook-mcp",
"version": "v1.0.0"
},
"sdk": {
"name": "openplantbook-go",
"version": "v1.0.1"
},
"mcp_framework": {
"name": "mcp-go",
"vendor": "mark3labs",
"version": "v0.43.0"
},
"runtime": {
"pid": 12345,
"tools_available": 5
},
"config": {
"auth_method": "api_key",
"cache_enabled": true,
"cache_ttl_hours": 24,
"default_language": "en",
"log_level": "INFO",
"log_file": ""
}
}配置选项
环境变量
| 变量 | 描述 | 默认值 |
|---|---|---|
OPENPLANTBOOK_API_KEY | 用于身份验证的API密钥 | - |
OPENPLANTBOOK_CLIENT_ID | OAuth2客户端ID | - |
OPENPLANTBOOK_CLIENT_SECRET | OAuth2客户端机密 | - |
OPENPLANTBOOK_LOG_LEVEL | 日志级别(调试、信息、警告、错误) | info |
OPENPLANTBOOK_LOG_FILE | 日志文件的路径(如果未设置,则记录到stderr) | - |
OPENPLANTBOOK_CACHE_ENABLED | 启用缓存 | true |
OPENPLANTBOOK_CACHE_TTL_HOURS | 缓存TTL(小时) | 24 |
OPENPLANTBOOK_DEFAULT_LANGUAGE | 默认语言代码 | en |
配置文件
或者,创建 ~/.config/openplantbook-mcp/config.json:
{
"api_key": "your_api_key_here",
"log_level": "info",
"cache_enabled": true,
"cache_ttl_hours": 24,
"default_language": "en"
}或者指定自定义配置文件:
openplantbook-mcp -config /path/to/config.json发展
建筑
# Build for current platform
make build
# Build for all platforms
make build-all
# Run tests
make test
# Run linters
make lint项目结构
openplantbook-mcp/
├── cmd/
│ └── openplantbook-mcp/ # Main entry point
│ └── main.go
├── internal/
│ └── server/ # MCP server implementation
│ ├── server.go # Core server with tool handlers
│ └── config.go # Configuration management
├── examples/
│ ├── config.example.json
│ └── claude_desktop_config.json
├── Makefile
├── README.md
└── LICENSE故障排除
服务器未在Claude中显示
- 检查Claude Desktop配置文件位置是否正确
- 验证
command路径指向已构建的二进制文件 - 配置更改后重新启动Claude Desktop
- 在Claude Desktop中检查日志:帮助→ 查看日志
身份验证错误
Configuration error: authentication required解决方案: 集 OPENPLANTBOOK_API_KEY 或两者 OPENPLANTBOOK_CLIENT_ID 和 OPENPLANTBOOK_CLIENT_SECRET 在环境或配置文件中。
多个身份验证方法错误
Configuration error: multiple authentication methods provided解决方案: 使用API密钥或OAuth2凭据之一,而不是同时使用两者。
查看日志
服务器以JSON格式记录到STDERR(或在以下情况下记录到文件 OPENPLANTBOOK_LOG_FILE 已设置)。在Claude Desktop中,日志包括:
- 用于请求跟踪的跟踪ID
- 带参数的工具调用
- API调用结果
- 错误详细信息
启用调试日志记录:
{
"mcpServers": {
"openplantbook": {
"command": "/path/to/openplantbook-mcp",
"env": {
"OPENPLANTBOOK_API_KEY": "your_api_key",
"OPENPLANTBOOK_LOG_LEVEL": "debug",
"OPENPLANTBOOK_LOG_FILE": "/path/to/logs/mcp-server.log"
}
}
}
}响应时间慢
MCP服务器禁用SDK的默认速率限制器,以防止请求之间出现7+分钟的延迟。如果您需要速率限制,请考虑在应用程序级别实现它或使用SDK WithRateLimit() 创建客户端时的选项。
演出
- 缓存:默认情况下,API响应缓存24小时(可配置)
- 速率限制:禁用MCP服务器使用的SDK速率限制器(防止多分钟延迟)
- 快速响应:典型的API调用在<2秒内完成
- 并发安全:所有操作都是线程安全的
贡献
欢迎投稿!拜托:
- 分叉存储库
- 创建要素分支
- 通过测试进行更改
- 提交拉取请求
许可证
MIT许可证-请参阅 许可证 文件以获取详细信息。
相关项目
- OpenPlantbook SDK: https://github.com/rmrfslashbin/openplantbook-go
- OpenPlantbook API: https://open.plantbook.io
- MCP规范: https://spec.modelcontextprotocol.io/
- MCP Go SDK: https://github.com/mark3labs/mcp-go
鸣谢
- 内置 mark3labs/mcp go
- 用途 openplantbook去SDK
- 数据来自 OpenPlantbook 社区
支持
- 问题: https://github.com/rmrfslashbin/openplantbook-mcp/issues
- OpenPlantbook Discord: https://discord.gg/dguPktq9Zh
- 电子邮件:code@sigler.io
