库存管理MCP服务器

FreshBooks库存管理MCP服务器是一个强大的模型上下文协议服务器,提供全面的库存管理功能,包括CRUD操作、高级搜索和批量操作,适用于需要与FreshBooks集成的开发者。

  • by CryptoJym
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 CryptoJym/freshbooks-mcp-server

使用说明

🚀 FreshBooks库存MCP服务器

用于FreshBooks库存管理的强大模型上下文协议服务器

专为希望将FreshBooks与AI助手无缝集成的开发人员而设计

特性 • 快速开始 • 文档 • 例子


✨ 特性

🔐 OAuth 2.0身份验证 -安全的FreshBooks API集成与自动令牌刷新
📦 完整的CRUD操作 -创建、读取、更新、删除库存项目
🔍 高级搜索 -按SKU、描述或库存级别查找商品
⚡ 批量操作 -同时更新多个项目
🛡️ 稳健的错误处理 -全面的验证和清晰的错误消息
📊 库存管理 -跟踪库存水平、成本和产品详细信息
🧪 生产就绪 -经过测试、记录并准备部署

🚀 快速开始

先决条件

  • Python 3.10+
  • 具有开发人员访问权限的FreshBooks帐户
  • MCP兼容客户端(如Claude Desktop)

1.️⃣ 克隆和安装

# Clone the repository
git clone https://github.com/h3ro-dev/freshbooks-mcp-server.git
cd freshbooks-mcp-server

# Install dependencies
pip install -r requirements.txt

2.️⃣ FreshBooks应用程序设置

  1. 首选 FreshBooks开发者门户
  2. 创建新应用程序
  3. 将重定向URI设置为: http://localhost:8080/callback
  4. 保存您的 客户端ID 和 客户端密钥

3.️⃣ 环境配置

# Copy the example environment file
cp .env.example .env

# Edit with your credentials
nano .env

添加您的FreshBooks证书:

FRESHBOOKS_CLIENT_ID=your_client_id_here
FRESHBOOKS_CLIENT_SECRET=your_client_secret_here
FRESHBOOKS_REDIRECT_URI=http://localhost:8080/callback

4.️⃣ 身份验证流程

# Start the server
python freshbooks_server.py

# In another terminal, get authorization URL
mcp call get_authorization_url

# Visit the URL, authorize, then exchange the code
mcp call exchange_authorization_code '{"authorization_code": "your_code_here"}'

将返回的令牌添加到您的 .env:

FRESHBOOKS_ACCESS_TOKEN=your_access_token_here
FRESHBOOKS_REFRESH_TOKEN=your_refresh_token_here
FRESHBOOKS_ACCOUNT_ID=your_account_id_here

5.️⃣ 测试您的设置

# List your inventory items
mcp call list_items

# Create a test item
mcp call create_item '{
  "item_data": {
    "name": "Test Product",
    "sku": "TEST-001",
    "inventory": "100"
  }
}'

🛠️ 可用工具

工具 说明 示例
list_items 使用筛选器列出库存 mcp call list_items
get_item 按ID获取项目 mcp call get_item '{"item_id": 123}'
create_item 创建新项目 mcp call create_item '{"item_data": {...}}'
update_item 更新现有项目 mcp call update_item '{"item_id": 123, "updates": {...}}'
delete_item 删除项目 mcp call delete_item '{"item_id": 123}'
search_items_by_sku 按SKU查找 mcp call search_items_by_sku '{"sku": "ABC-123"}'
get_low_inventory_items 查找低库存 mcp call get_low_inventory_items '{"threshold": 10}'
bulk_update_inventory 更新多个项目 mcp call bulk_update_inventory '{"updates": [...]}'

📚 文档

🎯 常见用例

库存补货工作流程

# Check low inventory
mcp call get_low_inventory_items '{"threshold": 20}'

# Bulk update restocked items
mcp call bulk_update_inventory '{
  "updates": [
    {"item_id": 123, "inventory": "100"},
    {"item_id": 124, "inventory": "75"}
  ]
}'

产品搜索与更新

# Find product by SKU
mcp call search_items_by_sku '{"sku": "LAPTOP-001"}'

# Update inventory count
mcp call update_inventory_count '{"item_id": 123, "new_count": "85"}'

🔧 发展

运行测试

python test_server.py

代码质量

# Format code
black freshbooks_server.py error_handling.py

# Type checking
mypy freshbooks_server.py

🤝 贡献

  1. 复刻仓库
  2. 创建要素分支: git checkout -b feature/amazing-feature
  3. 提交更改: git commit -m 'Add amazing feature'
  4. 推送到分支: git push origin feature/amazing-feature
  5. 打开拉取请求

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

🆘 支持


内置于❤️ 通过 h3ro开发

让开发者轻松管理FreshBooks库存