Packrift MCP Server
OfficialPackrift MCPサーバー
Shopifyの梱包用品ストア「Packrift」向けのプロダクション用MCP(Model Context Protocol)サーバーです。AIエージェントがカタログ検索、リアルタイムの価格・在庫取得、商品に適した箱の推奨、送料見積もり、チェックアウトURLの生成を行えるようにします。
スタック: Cloudflare Workers, TypeScript (strict), Hono, Zod, Streamable HTTP transport
バックエンド: Shopify Admin GraphQL API (
2025-04), ストアpackrift.myshopify.comエンドポイント:
POST /mcp,GET /mcp(SSE),GET /(ヘルスチェック),GET /.well-known/mcp/server-card.json
ツール
ツール | 用途 |
| カタログ全体のキーワード検索。KVで5分間キャッシュされます。 |
| バリエーション、寸法メタフィールド、重量を含む製品詳細の取得。 |
| リアルタイムの単価と合計金額。キャッシュされません。 |
| リアルタイムの在庫数。キャッシュされません。 |
| 0.5~2インチの余裕を持たせた、ランク付けされた最大5つのバリエーション提案。 |
| Shopifyの |
|
|
ローカル開発
Node 24以上をインストールし、依存関係をインストールします:
cd ~/Downloads/packrift-mcp-server
npm installローカルのシークレット — .dev.vars に作成済み(gitignored):
SHOPIFY_PACKRIFT_TOKEN=shpat_...サーバーの実行:
npx wrangler dev --port 8787 --localcurlでMCPエンドポイントの簡易テスト:
# initialize
curl -s -X POST http://127.0.0.1:8787/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'
# list tools
curl -s -X POST http://127.0.0.1:8787/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
# search
curl -s -X POST http://127.0.0.1:8787/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search_products","arguments":{"query":"poly mailer","limit":3}}}'型チェック:
npx tsc --noEmitデプロイ
Cloudflareアカウントは別途作成されます。準備が整い、wrangler にログイン(wrangler login)したら、以下の順序で実行してください:
cd ~/Downloads/packrift-mcp-server
# 1. Create the KV namespace and copy the printed id into wrangler.toml
# (replace both `id` and `preview_id` with the same value).
npx wrangler kv namespace create CATALOG_CACHE
# 2. Set the Shopify Admin token as a secret (paste shpat_... when prompted).
npx wrangler secret put SHOPIFY_PACKRIFT_TOKEN
# 3. Deploy. Initial deploy puts the worker on
# https://packrift-mcp.<account>.workers.dev
npx wrangler deploy
# 4. (Once mcp.packrift.com is CNAME'd to the worker) uncomment the [[routes]]
# block in wrangler.toml and redeploy.
npx wrangler deployデプロイ後、MCPエンドポイントは https://packrift-mcp.<account>.workers.dev/mcp (将来的には https://mcp.packrift.com/mcp)となります。サーバーカードは /.well-known/mcp/server-card.json に配置されます。
設計上の注意点 / 留意事項
cartCreateはAdmin APIではなくStorefront APIのミューテーションです。 要件には配送レート取得のためのcartCreate+cartBuyerIdentityUpdateが含まれていましたが、これらは本サーバーが使用するAdmin GraphQL APIには存在しません。サポートされているAdminのパスはdraftOrderCalculateであり、get_shipping_estimateはこれを使用しています。実際の注文を作成することなく、同じ配送業者レートデータを返します。寸法の解析。 Packriftの製品寸法は、
custom.specN_nameが「Dimensions」または「Size」であるcustom.specN_valueメタフィールドに格納されています。形式は人間が読める形式(12 1/8" L x 11 5/8" W x 2 5/8" H)です。src/dimensions.tsは混合分数を解析し、失敗した場合はタイトルをスキャンします。推奨コレクション。 要件に記載されていた
mailer-boxesコレクションは、ライブストアには存在しません。代わりにmailers-envelopes、boxes-mailers、corrugated-boxes、bubble-wrap-foam、cushioning、ecommerce-fulfillmentを使用します(2026年4月29日にcollectionsクエリで確認済み)。ユースケースのマッピング は
src/tools/recommend_packaging.ts(COLLECTIONS_BY_USE_CASE) にあります。配送レートの
handleはレスポンスに含まれる長い不透明なJWT形式の文字列です。これはShopifyが返すレートハンドルであり、必要に応じて後続の呼び出しに渡してください。エラー: ツールの例外はMCP仕様に従い
{ content: [...], isError: true }として返され、JSON-RPCの-3260xエラーとしては返されません。プロトコルレベルのエラー(不明なツール、不正なJSON)はJSON-RPCエラーを返します。
ファイルマップ
src/
index.ts Hono app + MCP JSON-RPC dispatcher
shopify.ts Admin GraphQL client + id helpers
dimensions.ts Spec-string -> structured dimensions
server-card.ts /.well-known card
tools/
search_products.ts
get_product.ts
get_pricing.ts
check_inventory.ts
recommend_packaging.ts
get_shipping_estimate.ts
create_cart_url.ts
wrangler.toml Worker config (KV binding, vars, route)
package.json
tsconfig.json
.dev.vars Local-only secrets (gitignored)Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Packrift/packrift-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server