使用说明
Brewfather MCP服务器
一个模型上下文协议(MCP)服务器,它与Brewford API集成,以提供酿造库存管理和配方分析功能。此服务器允许像Claude这样的MCP客户端与您的Brewfather酿造数据进行交互。
特性
- 库存管理:列出并管理发酵物、啤酒花、酵母和其他酿造用品
- 配方分析:访问详细的配方信息,包括成分和工艺细节
- 批量跟踪:监控酿造批次、更新测量值并跟踪进度
- 酿造见解:获取酿造过程指南和传感器读数
先决条件
- Python 3.13或更高版本
- 拥有API访问权限的Brewford帐户
- Brewford API证书(用户ID和API密钥)
获取您的啤酒酿造商API证书
- 登录您的Brewfather帐户
- 导航到“设置”→ API
- 生成或复制您的API用户ID和API密钥
- 确保这些凭据的安全-您需要它们进行配置
安装
选项1:使用uvx直接安装(推荐)
使用此MCP服务器的最简单方法是 uvx,直接从GitHub存储库:
# Set your credentials as environment variables
export BREWFATHER_API_USER_ID="your-api-user-id"
export BREWFATHER_API_KEY="your-api-key"
# Run the server
uvx --from git+https://github.com/mindsocket/brewfather-mcp.git brewfather-mcp
调试:
uvx --from git+https://github.com/mindsocket/brewfather-mcp.git brewfather-mcp --debug
选项2:本地开发安装
- 克隆此存储库
- 安装依赖项:
uv sync
配置
Claude桌面配置
选项1:使用uvx(推荐)
要通过uvx将此服务器与Claude Desktop一起使用,请将以下内容添加到您的Claude Desktop配置文件中:
配置文件的位置:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - 窗户:
%APPDATA%\\Claude\\claude_desktop_config.json
配置:
{
"mcpServers": {
"brewfather": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/mindsocket/brewfather-mcp.git",
"brewfather-mcp"
],
"env": {
"BREWFATHER_API_USER_ID": "your-api-user-id",
"BREWFATHER_API_KEY": "your-api-key"
}
}
}
}
选项2:使用本地安装
要从本地克隆将此服务器与Claude Desktop一起使用,请使用与上述配置相同的配置文件位置:
{
"mcpServers": {
"brewfather": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"mcp",
"run",
"/absolute/path/to/brewfather-mcp/src/main.py"
],
"cwd": "/absolute/path/to/brewfather-mcp",
"env": {
"BREWFATHER_API_USER_ID": "your-api-user-id",
"BREWFATHER_API_KEY": "your-api-key"
}
}
}
}
替换:
/absolute/path/to/brewfather-mcp包含克隆存储库的完整路径your-api-user-id使用您的Brewfather API用户IDyour-api-key使用您的Brewford API密钥
您可能还需要提供uv命令的完整路径。
其他MCP客户端
对于支持stdio传输的其他MCP客户端,请使用:
- 命令:
uv run --with mcp[cli] mcp run src/main.py - 工作目录:此存储库的路径
- 环境变量:
BREWFATHER_API_USER_ID和BREWFATHER_API_KEY
用于本地开发和测试
在本地开发或测试服务器时,可以选择通过 .env 文件改为:
cp .env.example .env
# Edit .env with your Brewfather API credentials
可用工具
服务器提供以下MCP工具:
库存管理
list_fermentables-列出所有可发酵物(麦芽、辅料、谷物)get_fermentable_detail(identifier)-获取详细的可发酵信息list_hops-列出所有具有α酸等特性的啤酒花get_hop_detail(identifier)-获取详细的跳数信息list_yeasts-列出所有具有衰减和类型的酵母get_yeast_detail(identifier)-获取详细的酵母信息list_misc_items-列出各种酿造用品get_misc_detail(item_id)-获取详细的杂项信息inventory_summary-获取全面的库存概览
食谱管理
list_recipes-列出所有食谱get_recipe_detail(recipe_id)-获取详细的配方信息
批次管理
list_batches-列出所有酿造批次get_batch_detail(batch_id)-获取详细的批次信息update_batch(batch_id, ...)-更新批量测量和状态get_batch_brewtracker(batch_id)-获取酿造工艺指导get_batch_last_reading(batch_id)-获取最新的传感器读数get_batch_readings_summary(batch_id)-获取传感器读数摘要
库存更新
update_fermentable_inventory(item_id, amount)-更新可发酵库存update_hop_inventory(item_id, amount)-更新库存update_yeast_inventory(item_id, amount)-更新酵母库存update_misc_inventory(item_id, amount)-更新杂项库存
发展
运行测试
uv run pytest
在本地测试服务器
mcptools 可以方便地进行本地测试:
# List available tools
mcpt tools uv run --with 'mcp[cli]' mcp run src/main.py
# Call a specific tool
mcpt call list_inventory_categories uv run --with 'mcp[cli]' mcp run src/main.py
HTTP/SSE服务器(用于云部署)
PYTHONPATH=src uv run python src/http_runner.py --port 8000
故障排除
常见问题
-
导入错误:确保你跑过了
uv sync安装所有依赖项 -
API身份验证错误:
- 对于MCP客户端:检查客户端配置中是否正确设置了凭据
- 对于当地发展:确保您的
.env文件存在有效凭据 - 验证您的Brewfather API证书是否正确并具有必要的权限
-
连接超时:检查您的互联网连接和Brewford API状态
-
Claude Desktop中的路径问题:确保在配置文件中使用绝对路径
调试模式
启用调试模式将API响应保存到调试文件夹中以进行故障排除:
BREWFATHER_MCP_DEBUG=1 mcpt call get_batch_detail --params '{"batch_id": "your-batch-id"}' uv run --with 'mcp[cli]' mcp run src/main.py