WooCommerce MCP Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Enables comprehensive management of WooCommerce stores, including products, orders, customers, shipping, taxes, discounts, and store configuration through the WooCommerce REST API.

  • Provides content management capabilities for WordPress sites, including creating, retrieving, updating, and deleting posts and managing post metadata independently of WooCommerce functionality.

WooCommerce MCP サーバー

WooCommerce 統合用の Model Context Protocol (MCP) サーバー。Windows、macOS、Linux と互換性があります。

概要

このMCPサーバーは、WordPress REST APIを介してWooCommerceストアとの連携を可能にします。JSON-RPC 2.0プロトコルを使用して、商品、注文、顧客、配送、税金、割引、ストア設定など、あらゆる側面を管理するための包括的なツールを提供します。

インストール

  1. リポジトリをクローンする
  2. 依存関係をインストールします:
npm install
  1. プロジェクトをビルドします。
npm run build

構成

資格情報の環境変数を使用して、サーバーを MCP 設定ファイルに追加します。

{ "mcpServers": { "woocommerce": { "command": "node", "args": ["path/to/build/index.js"], "env": { "WORDPRESS_SITE_URL": "https://your-wordpress-site.com", "WOOCOMMERCE_CONSUMER_KEY": "your-woocommerce-consumer-key", "WOOCOMMERCE_CONSUMER_SECRET": "your-woocommerce-consumer-secret", "WORDPRESS_USERNAME": "your-wordpress-username", "WORDPRESS_PASSWORD": "your-wordpress-password" } } } }

環境変数

WooCommerce API アクセスに必要なもの:

  • WORDPRESS_SITE_URL : WordPress サイトの URL (WooCommerce は WordPress プラグインです)
  • WOOCOMMERCE_CONSUMER_KEY : WooCommerce REST API コンシューマーキー
  • WOOCOMMERCE_CONSUMER_SECRET : WooCommerce REST API コンシューマーシークレット

WordPress API メソッドにのみ必須:

  • WORDPRESS_USERNAME : 適切な権限を持つWordPressユーザー名
  • WORDPRESS_PASSWORD : 認証用のWordPressパスワード

環境変数を使用したくない場合は、リクエストパラメータでこれらの資格情報を提供することもできます。

認証オプション

WooCommerce認証

WooCommerce API アクセスには、WordPress ダッシュボードの「WooCommerce」→「設定」→「詳細設定」→「REST API」で生成できるコンシューマー キーが必要です。

WordPress認証

WordPress 固有の方法 (投稿の管理など) の場合は、以下を提供する必要があります。

  • 基本認証のユーザー名/パスワード資格情報
  • WordPress REST APIがサイトで有効になっている必要があります

APIメソッド

サーバーはWordPressとWooCommerceの両方のAPIメソッドをサポートしています。利用可能なメソッドをカテゴリ別にまとめたリストを以下に示します。

WordPressコンテンツ管理

これらのメソッドでは WordPress のユーザー名/パスワードの資格情報が必要であり、WooCommerce API とは独立しています。

方法説明
create_post新しいWordPress投稿を作成する
get_postsWordPressの投稿を取得する
update_post既存のWordPress投稿を更新する
get_post_meta投稿のメタデータを取得する
update_post_meta投稿のメタデータを更新する
create_post_meta投稿メタデータを作成する
delete_post_meta投稿のメタデータを削除する

WooCommerce製品

方法説明
get_products製品リストを取得する
get_productIDで単一の製品を取得する
create_product新しい製品を作成する
update_product既存の製品を更新する
delete_product製品を削除する
get_product_meta製品のメタデータを取得する
create_product_meta製品メタデータの作成/更新
update_product_meta製品メタデータの更新(create のエイリアス)
delete_product_meta製品メタデータを削除する

製品カテゴリー

方法説明
get_product_categories製品カテゴリを取得する
get_product_category単一の製品カテゴリを取得する
create_product_category新しい製品カテゴリを作成する
update_product_category製品カテゴリを更新する
delete_product_category商品カテゴリーを削除する

製品タグ

方法説明
get_product_tags商品タグを取得する
get_product_tag単一の商品タグを取得する
create_product_tag新しい商品タグを作成する
update_product_tag商品タグを更新する
delete_product_tag商品タグを削除する

製品属性

方法説明
get_product_attributes製品属性を取得する
get_product_attribute単一の製品属性を取得する
create_product_attribute新しい製品属性を作成する
update_product_attribute製品属性を更新する
delete_product_attribute製品属性を削除する
get_attribute_terms属性用語を取得する
get_attribute_term単一の属性用語を取得する
create_attribute_term新しい属性用語を作成する
update_attribute_term属性用語を更新する
delete_attribute_term属性用語を削除する

製品バリエーション

方法説明
get_product_variations商品のバリエーションを取得する
get_product_variation単一の製品バリエーションを取得する
create_product_variation新しい製品バリエーションを作成する
update_product_variation商品のバリエーションを更新する
delete_product_variation商品バリエーションを削除する

製品レビュー

方法説明
get_product_reviews製品レビューを取得する
get_product_review単一の製品レビューを取得する
create_product_review新しい製品レビューを作成する
update_product_review製品レビューを更新する
delete_product_review製品レビューを削除する

WooCommerce 注文

方法説明
get_orders注文リストを取得する
get_orderIDで単一の注文を取得する
create_order新しい注文を作成する
update_order既存の注文を更新する
delete_order注文を削除する
get_order_meta注文メタデータを取得する
create_order_meta注文メタデータの作成/更新
update_order_meta注文メタデータの更新(create のエイリアス)
delete_order_meta注文メタデータを削除する

注文メモ

方法説明
get_order_notes注文メモを取得する
get_order_note単一の注文書を取得する
create_order_note新しい注文メモを作成する
delete_order_note注文メモを削除する

注文の払い戻し

方法説明
get_order_refunds注文の払い戻しを取得する
get_order_refund単一注文の払い戻しを受ける
create_order_refund新しい注文の払い戻しを作成する
delete_order_refund注文の払い戻しを削除する

WooCommerceのお客様

方法説明
get_customers顧客リストを取得する
get_customerIDで単一の顧客を取得する
create_customer新しい顧客を作成する
update_customer既存の顧客を更新する
delete_customer顧客を削除する
get_customer_meta顧客メタデータを取得する
create_customer_meta顧客メタデータの作成/更新
update_customer_meta顧客メタデータの更新(作成のエイリアス)
delete_customer_meta顧客メタデータを削除する

配送

方法説明
get_shipping_zones配送ゾーンを取得する
get_shipping_zone単一の配送ゾーンを取得する
create_shipping_zone新しい配送ゾーンを作成する
update_shipping_zone配送ゾーンを更新する
delete_shipping_zone配送ゾーンを削除する
get_shipping_methods配送方法を取得する
get_shipping_zone_methodsゾーンの配送方法を取得する
create_shipping_zone_methodゾーンに新しい配送方法を作成する
update_shipping_zone_methodゾーンの配送方法を更新する
delete_shipping_zone_methodゾーンから配送方法を削除する
get_shipping_zone_locations配送ゾーンの場所を取得する
update_shipping_zone_locations配送ゾーンの場所を更新する

税金

方法説明
get_tax_classes税金の区分を取得する
create_tax_class新しい税金クラスを作成する
delete_tax_class税金クラスを削除する
get_tax_rates税率を取得する
get_tax_rate単一の税率を取得する
create_tax_rate新しい税率を作成する
update_tax_rate税率を更新する
delete_tax_rate税率を削除する

割引/クーポン

方法説明
get_couponsクーポンを取得する
get_couponクーポンを1枚入手
create_coupon新しいクーポンを作成する
update_couponクーポンを更新する
delete_couponクーポンを削除する

決済ゲートウェイ

方法説明
get_payment_gateways決済ゲートウェイを取得する
get_payment_gateway単一の決済ゲートウェイを取得する
update_payment_gateway支払いゲートウェイを更新する

レポート

方法説明
get_sales_report売上レポートを取得する
get_products_report製品レポートを取得する
get_orders_report注文レポートを取得する
get_categories_reportカテゴリレポートを取得する
get_customers_report顧客レポートを取得する
get_stock_report株価レポートを取得する
get_coupons_reportクーポンレポートを取得する
get_taxes_report税金レポートを取得する

設定

方法説明
get_settingsすべての設定を取得する
get_setting_options設定のオプションを取得する
update_setting_option設定オプションを更新する

システムステータス

方法説明
get_system_statusシステムステータスの取得
get_system_status_toolsシステムステータスツールを取得する
run_system_status_toolシステムステータスツールを実行する

データ

方法説明
get_data店舗データを取得する
get_continents大陸データを取得する
get_countries国データを取得する
get_currencies通貨データを取得する
get_current_currency現在の通貨を取得する

メソッドパラメータ

すべてのメソッドは同様のパラメータ構造に従います。以下に例を示します。

すべてのメソッドに共通するパラメータ

  • siteUrl : (env で設定されている場合オプション) WordPress サイトの URL

WooCommerceメソッドの追加パラメータ

  • consumerKey : (env で設定されている場合オプション) WooCommerce コンシューマーキー
  • consumerSecret : (env で設定されている場合オプション) WooCommerce コンシューマー シークレット

WordPressメソッドの追加パラメータ

  • username : (envで設定されている場合オプション) WordPressユーザー名
  • password : (envで設定されている場合オプション) WordPressのパスワード

使用例

WordPress APIの例

{ "jsonrpc": "2.0", "id": 1, "method": "create_post", "params": { "siteUrl": "https://your-wordpress-site.com", "username": "your-wordpress-username", "password": "your-wordpress-password", "title": "My New Blog Post", "content": "This is the content of my new blog post.", "status": "publish" } }

WooCommerce製品の例

{ "jsonrpc": "2.0", "id": 1, "method": "get_products", "params": { "perPage": 20, "page": 1, "filters": { "category": 19, "status": "publish" } } }

製品例の作成

{ "jsonrpc": "2.0", "id": 1, "method": "create_product", "params": { "productData": { "name": "Premium T-Shirt", "type": "simple", "regular_price": "29.99", "description": "Comfortable cotton t-shirt, available in various sizes.", "short_description": "Premium quality t-shirt.", "categories": [ { "id": 19 } ], "images": [ { "src": "http://example.com/wp-content/uploads/2022/06/t-shirt.jpg" } ] } } }

製品メタデータの例

{ "jsonrpc": "2.0", "id": 1, "method": "create_product_meta", "params": { "productId": 456, "metaKey": "_custom_product_field", "metaValue": { "special_attribute": "value", "another_attribute": 42 } } }

注文メタデータの例

{ "jsonrpc": "2.0", "id": 1, "method": "create_order_meta", "params": { "orderId": 789, "metaKey": "_delivery_instructions", "metaValue": "Leave package at the back door" } }

セキュリティに関する注意事項

WooCommerce REST APIにアクセスするには、APIキーを生成する必要があります。WordPressダッシュボードの「WooCommerce」→「設定」→「詳細設定」→「REST API」で作成できます。

要件

  • Node.js 20.0.0以上
  • WooCommerceプラグインがインストールされたWordPressサイト
  • WooCommerce REST APIキー

ライセンス

MITライセンス - 詳細はLICENSEファイルを参照

ID: 6cg08xtbwq