酿造库存管理服务器

一个与Brewfather API集成的模型上下文协议(MCP)服务器,提供酿造库存管理和配方分析功能。

  • by andyonholiday
  • Python
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 andyonholiday/brewfather-mcp

使用说明

Brewfather MCP服务器

一个模型上下文协议(MCP)服务器,它与Brewford API集成,以提供酿造库存管理和配方分析功能。此服务器允许像Claude这样的MCP客户端与您的Brewfather酿造数据进行交互。

特性

  • 库存管理:列出并管理发酵物、啤酒花、酵母和其他酿造用品
  • 配方分析:访问详细的配方信息,包括成分和工艺细节
  • 批量跟踪:监控酿造批次、更新测量值并跟踪进度
  • 酿造见解:获取酿造过程指南和传感器读数

先决条件

  • Python 3.13或更高版本
  • 拥有API访问权限的Brewford帐户
  • Brewford API证书(用户ID和API密钥)

获取您的啤酒酿造商API证书

  1. 登录您的Brewfather帐户
  2. 导航到“设置”→ API
  3. 生成或复制您的API用户ID和API密钥
  4. 确保这些凭据的安全-您需要它们进行配置

安装

选项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:本地开发安装

  1. 克隆此存储库
  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用户ID
  • your-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

故障排除

常见问题

  1. 导入错误:确保你跑过了 uv sync 安装所有依赖项

  2. API身份验证错误:

    • 对于MCP客户端:检查客户端配置中是否正确设置了凭据
    • 对于当地发展:确保您的 .env 文件存在有效凭据
    • 验证您的Brewfather API证书是否正确并具有必要的权限
  3. 连接超时:检查您的互联网连接和Brewford API状态

  4. 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