Amazon FBA Ops MCP Server

Amazon FBA Ops MCP Server

A local MCP server that enables querying Amazon Selling Partner API for profitability analysis (revenue, fees, COGS, net margin) and inventory alerts (FBA stock levels and low-stock warnings) using read-only operations.

Category
访问服务器

README

Amazon FBA Ops MCP Server

A local MCP server that lets Claude query your Amazon Selling Partner API (SP-API) account directly, for two things:

  • Profitability — revenue, Amazon fees, reimbursements, cost-of-goods (COGS), and net margin, grouped by SKU / order / day.
  • Inventory alerts — FBA stock levels and low-stock warnings based on estimated days-of-supply.

Everything this server does against SP-API is read-only (GET requests). The only writes are to a local JSON file you control (data/sku_costs.json), which stores your own product costs since Amazon has no concept of COGS.

Not built yet (future phases): Amazon Ads/PPC, keyword research, Slack notifications, scheduled/cron runs, a dashboard UI.

1. Get SP-API credentials

You need three values from Amazon: an LWA app ID, an LWA client secret, and a refresh token. No AWS IAM / AWS keys are needed — SP-API dropped that requirement in October 2023.

  1. Seller Central → gear icon → Apps and Services → Develop Apps → Add new app client. Choose Private app (not "Publish for others") — this is for your own seller account only.
  2. When prompted for API access/roles, select the roles that cover Orders, Finances, Inventory and Order Tracking, and Product Listing (label wording can shift in the Seller Central UI — pick whatever maps to those four areas). Amazon may take a short time to approve the role grant even for a private app.
  3. Open the app's detail page and copy the LWA Client ID and LWA Client Secret.
  4. Still under Develop Apps, click Authorize on your app (self-authorization — since you're authorizing against the same account that created the app, no OAuth redirect server is needed). Confirm, and copy the refresh token shown — it's shown only once; if you lose it, re-run Authorize to get a new one.
  5. Find your marketplace (e.g. US, UK, DE, JP) — this determines both the API endpoint region and the encoded marketplace_id.

2. Configure

cp .env.example .env

Fill in .env:

LWA_APP_ID=...
LWA_CLIENT_SECRET=...
SP_API_REFRESH_TOKEN=...
SP_API_DEFAULT_MARKETPLACE=US   # match your seller's marketplace

.env is gitignored — never commit it.

3. Install

python3 -m venv .venv
.venv/bin/pip install -e .

4. Sanity-check credentials before wiring into Claude

PYTHONPATH=src .venv/bin/python3 -c "
from amazon_mcp.orders_service import get_orders
from datetime import datetime, timedelta, timezone
end = datetime.now(timezone.utc)
start = end - timedelta(days=7)
print(get_orders(start.strftime('%Y-%m-%d'), end.strftime('%Y-%m-%d')))
"

If this prints an orders list (even an empty one) instead of an error, your credentials work. If it errors, re-check .env against step 1 before touching the MCP server itself.

5. Set your product costs

Profitability can't be computed without knowing what each SKU costs you to make/source. Use the set_sku_cost tool from Claude once the server is registered, or seed data/sku_costs.json directly (see data/sku_costs.example.json for the shape). SKUs with no configured cost show up in missing_cogs_skus in the profitability output rather than silently being treated as free.

6. Register with Claude Code

A .mcp.json is already checked into this project root. It points at .venv/bin/python, so make sure step 3's install happened inside this directory. Claude Code will pick it up automatically when you open this project — restart Claude Code (or run /mcp to reload) if it doesn't appear right away.

To also register it in Claude Desktop, add the same entry under mcpServers in ~/Library/Application Support/Claude/claude_desktop_config.json.

7. Verify end-to-end

All of these are safe, read-only checks against your real seller account:

  • get_orders over a known recent window — cross-check the count/total against Seller Central's own Orders report.
  • get_inventory_summary() — cross-check fulfillable quantities against the FBA inventory dashboard for 2-3 known SKUs.
  • get_catalog_item(asin) for a known ASIN — confirm title/image match the live listing.
  • calculate_profitability over a short window — manually reconstruct expected profit for 1-2 orders (revenue from Seller Central, fees from the Payments view, COGS from what you entered) and compare.
  • get_low_stock_alerts — temporarily lower days_of_supply_threshold to confirm it flags a SKU you know is low.

Run the unit tests (mocked, no network) any time after changing code:

.venv/bin/pip install -e ".[dev]"
PYTHONPATH=src .venv/bin/pytest

Tools

Tool Purpose
get_orders(start_date, end_date, order_status?) List orders in a date range
get_order_items(order_id) Line items for one order
get_financial_events(start_date, end_date) Raw fee/refund/reimbursement events
calculate_profitability(start_date, end_date, group_by?) Revenue/fees/COGS/net profit, grouped by sku|order|day
get_inventory_summary(sku?) Current FBA inventory levels
get_low_stock_alerts(days_of_supply_threshold?, lookback_days?) SKUs at risk of stocking out
get_catalog_item(asin) Product title/image/dimensions
set_sku_cost(sku, cost, effective_date?) Record a SKU's cost-of-goods
list_sku_costs() List configured SKU costs

Known limitations

  • Orders and financial events have a ~48-hour lag on Amazon's side — very recent orders won't show up yet.
  • get_low_stock_alerts and calculate_profitability (when grouped by SKU) derive sales velocity/units by calling get_order_items once per order in the window, capped at 200 orders (velocity_sampled / truncated flags tell you if a cap was hit). High-volume sellers will eventually want a Reports-API-based bulk pull instead — not built in this MVP.
  • Financial-event field parsing (finances_service.py) is based on Amazon's documented Finances v0 schema but has not yet been checked against a live response — if the shapes don't match exactly, cross-check get_financial_events's raw output the first time you run it for real and adjust _flatten_* in finances_service.py if needed.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选