inFlow库存MCP服务器
一个模型上下文协议(MCP)服务器,它提供了与 inFlow库存 API这使得像Claude这样的人工智能助手能够管理您的库存、订单、客户等。
特性
- 产品:列出、搜索、创建、更新产品并检查库存水平
- 销售订单:创建和管理客户订单
- 采购订单:创建和管理供应商采购订单
- 客户和供应商:管理客户和供应商记录
- 库存操作:库存调整、转移、盘点和制造订单
- 参考数据:地点、类别、定价方案、付款条件、货币、税码
- 网络钩子:订阅inFlow事件
先决条件
- Node.js 18或更高版本
- 带有API附加组件的活动inFlow库存订阅
- inFlow API证书(公司ID和API密钥)
安装
# Clone or copy the server files
cd inflow-mcp-server
# Install dependencies
npm install
# Build the TypeScript
npm run build配置
获取API凭据
- 登录您的inFlow库存帐户
- 首选 设置 > 集成
- 找到你的 公司编号 在集成页面上
- 点击 添加新的API密钥 生成新密钥
环境变量
设置以下环境变量:
# Required
export INFLOW_COMPANY_ID="your-company-id"
export INFLOW_API_KEY="your-api-key"
# Optional
export INFLOW_BASE_URL="https://cloudapi.inflowinventory.com" # Default
export INFLOW_API_VERSION="2025-06-24" # Default API version
export INFLOW_RATE_LIMIT="60" # Requests per minute (default: 60)
export INFLOW_REQUEST_TIMEOUT="30000" # Request timeout in ms (default: 30000)
export INFLOW_MAX_RETRIES="3" # Max retries on 5xx/429 errors (default: 3)
export INFLOW_RETRY_DELAY="1000" # Initial retry delay in ms (default: 1000)
export INFLOW_DEBUG="true" # Enable debug logging (default: false)Claude桌面配置
添加到您的Claude Desktop配置文件中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"inflow-inventory": {
"command": "node",
"args": ["/path/to/inflow-mcp-server/dist/index.js"],
"env": {
"INFLOW_COMPANY_ID": "your-company-id",
"INFLOW_API_KEY": "your-api-key"
}
}
}
}可用工具
产品管理
| 工具 | 说明 |
|---|---|
list_products | 搜索和筛选产品 |
get_product | 按ID获取产品详细信息(使用 include=itemBoms 物料清单) |
upsert_product | 创建或更新产品 |
get_inventory_summary | 获取不同地点的库存水平 |
get_inventory_summaries_batch | 批量获取库存水平(最大100) |
get_bill_of_materials | 获取可制造产品的BOM组件 |
销售订单
| 工具 | 说明 |
|---|---|
list_sales_orders | 搜索和筛选销售订单 |
get_sales_order | 按ID获取订单详细信息 |
upsert_sales_order | 创建或更新销售订单 |
采购订单
| 工具 | 说明 |
|---|---|
list_purchase_orders | 搜索和筛选采购订单 |
get_purchase_order | 按ID获取订单详细信息 |
upsert_purchase_order | 创建或更新采购订单 |
客户
| 工具 | 说明 |
|---|---|
list_customers | 搜索和筛选客户 |
get_customer | 按ID获取客户详细信息 |
upsert_customer | 创建或更新客户 |
供应商
| 工具 | 说明 |
|---|---|
list_vendors | 搜索和筛选供应商 |
get_vendor | 按ID获取供应商详细信息 |
upsert_vendor | 创建或更新供应商 |
库存操作
| 工具 | 说明 |
|---|---|
list_stock_adjustments | 列出库存调整 |
get_stock_adjustment | 获取调整详细信息 |
upsert_stock_adjustment | 创建/更新库存调整 |
list_stock_transfers | 列出库存转移 |
get_stock_transfer | 获取转账详细信息 |
upsert_stock_transfer | 创建/更新库存转移 |
list_stock_counts | 列出库存盘点 |
get_stock_count | 获取计数详细信息 |
upsert_stock_count | 创建/更新库存盘点 |
list_manufacturing_orders | 列出工作订单 |
get_manufacturing_order | 获取工单详细信息 |
upsert_manufacturing_order | 创建/更新工单 |
参考数据
| 工具 | 说明 |
|---|---|
list_locations | 列出仓库位置 |
get_location | 获取位置详细信息 |
get_suggested_sublocations | 获取垃圾箱/货架建议 |
list_categories | 列出产品类别 |
list_pricing_schemes | 列出定价层次 |
list_payment_terms | 列出付款条件 |
list_taxing_schemes | 列出税务方案 |
upsert_taxing_scheme | 创建/更新税务方案 |
list_tax_codes | 列出税码 |
list_currencies | 列出货币 |
list_adjustment_reasons | 列出调整原因 |
list_custom_field_definitions | 列出自定义字段 |
get_custom_field_dropdown_options | 获取下拉选项 |
list_team_members | 在Flow中列出用户 |
网络钩子
| 工具 | 说明 |
|---|---|
list_webhooks | 列出webhook订阅 |
upsert_webhook | 创建/更新webhook |
delete_webhook | 删除webhook |
使用示例
产品列表
List all active products in the "Electronics" category创建销售订单
Create a sales order for customer "Acme Corp" with:
- 5 units of product SKU-001 at $29.99 each
- 10 units of product SKU-002 at $15.00 each
Required by next Friday检查库存
What's the current stock level for product "Widget Pro" across all locations?创建库存转移
Transfer 50 units of "Widget Pro" from "Main Warehouse" to "Retail Store"API功能
过滤
大多数列表操作都支持过滤。例如:
list_products with name="Widget" and isActive=true分页
大型结果集被分页。使用 skip 和 count 参数:
count:要返回的记录数(最多100条)skip:要跳过的记录数
注: 默认页面大小为20条记录。始终指定 count 当你需要所有记录时。
排序
所有列表操作都支持排序:
sort:要排序的属性名称(例如,“name”、“modifiedDate”、“orderDate”)sortDesc:设置为true按降序排列
list_products with sort="modifiedDate" and sortDesc=true总数
要获取匹配记录的总数(对分页UI很有用),请使用 includeCount:
list_sales_orders with status="Open" and includeCount=true答复包括:
{
"data": [...],
"totalCount": 42
}智能搜索
某些端点支持 smart 用于跨多个字段进行模糊搜索的参数:
list_customers with smart="acme" // Searches name, email, phone
list_sales_orders with smart="SO-2025" // Searches order fields包含
使用 include 获取相关数据的参数:
get_sales_order with include=["customer", "lines", "lines.product"]并发控制
更新记录时,包括 timestamp 从原始记录中删除字段以防止冲突。
速率限制
inFlow API的速率限制为每分钟60个请求。此服务器实现:
- 令牌桶速率限制:自动调整请求的速度以保持在限制范围内
- 自动重试:对5xx错误和速率限制(429)响应进行检索,并采用指数回退
- 可配置的限制:通过以下方式覆盖
INFLOW_RATE_LIMIT环境变量
错误处理
服务器从inFlow API返回描述性错误消息。常见错误包括:
- 401未经授权:API密钥无效
- 404未找到:资源不存在
- 409冲突:时间戳不匹配(记录已被修改)
- 429请求太多:超出速率限制(自动重试)
发展
# Watch mode for development
npm run dev
# Build for production
npm run build
# Run the server
npm start
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverageAPI文档
许可证
麻省理工学院
