eCommerce-Context-Bridge-Node
Facilitate unified control over a WooCommerce digital storefront utilizing a standardized API endpoint via JSON-RPC transmissions. Interface with core e-commerce assets like items, transactions, patrons, delivery logistics, and levy assessments by directly leveraging the underlying WordPress Representational State Transfer (REST) interface.
Author

techspawn
Quick Info
Actions
Tags
WooCommerce Context Bridge Server
This Model Context Protocol (MCP) server implementation is designed for seamless connectivity with WooCommerce installations, supporting operation across Windows, macOS, and Linux environments.
Overview
This bridge server exposes the capabilities of the WordPress REST API for managing a WooCommerce entity. It furnishes extensive utilities for manipulating inventory (products), sales records (orders), client profiles, shipment parameters, taxation rules, promotional vouchers, and global store configuration parameters, all orchestrated through the JSON-RPC 2.0 communication standard.
Deployment Procedure
- Obtain a local copy of the repository via cloning.
-
Install necessary project dependencies: bash npm install
-
Compile the source code for execution: bash npm run build
Initialization Setup
Integrate this service into your primary MCP configuration file, mapping credentials via environment variables:
{ "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" } } } }
Runtime Variable Definitions
Mandatory for WooCommerce Interface Access:
WORDPRESS_SITE_URL: The Uniform Resource Locator for your primary WordPress installation (where WooCommerce is hosted).WOOCOMMERCE_CONSUMER_KEY: The designated key for authenticating against the WooCommerce REST API.WOOCOMMERCE_CONSUMER_SECRET: The secret credential corresponding to the consumer key.
Required Exclusively for WordPress Core Functionality:
WORDPRESS_USERNAME: An authorized user identifier with requisite administrative privileges.WORDPRESS_PASSWORD: The secret passphrase associated with the aforementioned user.
Alternatively, these authentication factors may be supplied directly within the invocation payload rather than relying on environmental provisioning.
Credential Exchange Mechanisms
WooCommerce Credentials
Access to the specialized WooCommerce endpoints necessitates API credentials, which must be provisioned through the WordPress administrative panel under the path: WooCommerce → Settings → Advanced → REST API.
WordPress Core Credentials
For functions pertaining strictly to WordPress content management (e.g., manipulating standard blog entries), the following are required: - A username/password pair for HTTP Basic Authentication. - Confirmation that the WordPress REST API feature is actively enabled on the target site.
Available Remote Procedures (API Methods)
The server exposes operational endpoints servicing both the base WordPress system and the WooCommerce extension layer. Listed below are the available functions, grouped logically:
WordPress Content Manipulation
These procedures mandate WP user credentials and function independently of WooCommerce API access.
| Procedure Name | Purpose |
|---|---|
create_post |
Instantiates a fresh WordPress article. |
get_posts |
Fetches collections of existing WordPress articles. |
update_post |
Modifies the contents of a published article. |
get_post_meta |
Retrieves associated metadata for a specific article. |
update_post_meta |
Modifies or sets post-associated metadata fields. |
create_post_meta |
Establishes new metadata entries for an article. |
delete_post_meta |
Purges specific metadata entries from an article. |
WooCommerce Inventory Management
| Procedure Name | Purpose |
|---|---|
get_products |
Retrieves listings of available stock items. |
get_product |
Fetches a solitary inventory item based on its identifier. |
create_product |
Registers a novel stock item into the catalog. |
update_product |
Alters the attributes of an existing inventory item. |
delete_product |
Removes a product from the active inventory. |
get_product_meta |
Accesses metadata specific to an inventory item. |
create_product_meta |
Adds or overwrites inventory item metadata. |
update_product_meta |
Renews inventory item metadata (synonym for create). |
delete_product_meta |
Eliminates metadata associated with an inventory item. |
Inventory Classifications
| Procedure Name | Purpose |
|---|---|
get_product_categories |
Queries the registry of item categories. |
get_product_category |
Retrieves details for one category. |
create_product_category |
Establishes a new grouping for items. |
update_product_category |
Modifies the properties of an existing category. |
delete_product_category |
Decommissions a specific item category. |
Inventory Tagging
| Procedure Name | Purpose |
|---|---|
get_product_tags |
Fetches the index of item tags. |
get_product_tag |
Retrieves data for an individual tag. |
create_product_tag |
Generates a novel tag for product categorization. |
update_product_tag |
Edits the definition of an existing tag. |
delete_product_tag |
Removes a designated product tag. |
Inventory Characteristics
| Procedure Name | Purpose |
|---|---|
get_product_attributes |
Queries the full list of product characteristics. |
get_product_attribute |
Retrieves specifics for one characteristic definition. |
create_product_attribute |
Defines a new characteristic type. |
update_product_attribute |
Updates the specification of a characteristic. |
delete_product_attribute |
Deletes a defined product characteristic. |
get_attribute_terms |
Fetches the possible values (terms) for a characteristic. |
get_attribute_term |
Retrieves data for a single characteristic value. |
create_attribute_term |
Registers a new allowed value for a characteristic. |
update_attribute_term |
Renews an existing characteristic value. |
delete_attribute_term |
Removes a specific characteristic value. |
Product Variants
| Procedure Name | Purpose |
|---|---|
get_product_variations |
Retrieves associated derivative items for a product. |
get_product_variation |
Fetches details for a solitary derivative item. |
create_product_variation |
Introduces a new derivative item. |
update_product_variation |
Modifies the configuration of a derivative item. |
delete_product_variation |
Decommissions a specific derivative item. |
Customer Feedback
| Procedure Name | Purpose |
|---|---|
get_product_reviews |
Queries all submitted evaluations for products. |
get_product_review |
Fetches the details of one specific evaluation. |
create_product_review |
Submits a new customer evaluation. |
update_product_review |
Amends an existing customer evaluation record. |
delete_product_review |
Purges a submitted customer evaluation. |
WooCommerce Transaction Management
| Procedure Name | Purpose |
|---|---|
get_orders |
Retrieves the ledger of sales transactions. |
get_order |
Fetches a solitary transaction record by its index. |
create_order |
Logs a new sales transaction into the system. |
update_order |
Revises the data associated with an existing transaction. |
delete_order |
Nullifies a sales transaction record. |
get_order_meta |
Accesses auxiliary data linked to a transaction. |
create_order_meta |
Establishes new auxiliary data for a transaction. |
update_order_meta |
Modifies auxiliary data linked to a transaction (alias for create). |
delete_order_meta |
Erases auxiliary data from a transaction record. |
Transaction Annotations
| Procedure Name | Purpose |
|---|---|
get_order_notes |
Retrieves internal notes logged against transactions. |
get_order_note |
Fetches a single internal transaction note. |
create_order_note |
Adds a new internal note to a transaction. |
delete_order_note |
Removes an internal transaction note. |
Transaction Reversals
| Procedure Name | Purpose |
|---|---|
get_order_refunds |
Queries the history of reversed transactions. |
get_order_refund |
Fetches details for a single transaction reversal. |
create_order_refund |
Records a new transaction reversal. |
delete_order_refund |
Deletes a recorded transaction reversal entry. |
WooCommerce Client Registry
| Procedure Name | Purpose |
|---|---|
get_customers |
Retrieves the roster of registered clientele. |
get_customer |
Fetches details for one specific client profile. |
create_customer |
Adds a new client profile to the registry. |
update_customer |
Modifies an existing client's registered information. |
delete_customer |
Removes a client profile from the system. |
get_customer_meta |
Accesses auxiliary data attached to a client profile. |
create_customer_meta |
Adds auxiliary data to a client profile. |
update_customer_meta |
Updates auxiliary data for a client profile (synonym for create). |
delete_customer_meta |
Removes auxiliary data associated with a client profile. |
Logistics Configuration
| Procedure Name | Purpose |
|---|---|
get_shipping_zones |
Queries the defined geographical delivery areas. |
get_shipping_zone |
Fetches specifics for one delivery area. |
create_shipping_zone |
Establishes a new geographical delivery boundary. |
update_shipping_zone |
Revises the parameters of a delivery area. |
delete_shipping_zone |
Decommissions a specific delivery area. |
get_shipping_methods |
Retrieves the catalogue of available delivery options. |
get_shipping_zone_methods |
Fetches delivery options assigned to a specific area. |
create_shipping_zone_method |
Enrolls a new delivery option into a zone. |
update_shipping_zone_method |
Modifies a delivery option's configuration within its zone. |
delete_shipping_zone_method |
Removes a delivery option assignment from a zone. |
get_shipping_zone_locations |
Retrieves geographical restrictions for a delivery area. |
update_shipping_zone_locations |
Sets or alters the geographical scope of a delivery area. |
Taxation Protocols
| Procedure Name | Purpose |
|---|---|
get_tax_classes |
Queries the defined tax rate categories. |
create_tax_class |
Establishes a new tax classification. |
delete_tax_class |
Removes a defined tax classification. |
get_tax_rates |
Retrieves the catalogue of applied tax rates. |
get_tax_rate |
Fetches details for a singular tax rate entry. |
create_tax_rate |
Implements a new tax rate into the system. |
update_tax_rate |
Modifies the structure of an existing tax rate. |
delete_tax_rate |
Deactivates a specific tax rate. |
Promotional Instruments
| Procedure Name | Purpose |
|---|---|
get_coupons |
Queries the list of active discount codes. |
get_coupon |
Retrieves data for one specific discount code. |
create_coupon |
Generates a new promotional discount code. |
update_coupon |
Modifies the terms of an existing discount code. |
delete_coupon |
Invalidates a specified discount code. |
Transaction Processors
| Procedure Name | Purpose |
|---|---|
get_payment_gateways |
Retrieves the set of activated payment handling modules. |
get_payment_gateway |
Fetches configuration details for one processor. |
update_payment_gateway |
Alters the settings of a chosen payment processor. |
Operational Metrics
| Procedure Name | Purpose |
|---|---|
get_sales_report |
Retrieves summaries of revenue generation. |
get_products_report |
Fetches metrics related to inventory performance. |
get_orders_report |
Queries transaction volume summaries. |
get_categories_report |
Retrieves performance metrics broken down by category. |
get_customers_report |
Fetches analytical data regarding client activity. |
get_stock_report |
Queries current inventory levels and status. |
get_coupons_report |
Retrieves usage statistics for promotional codes. |
get_taxes_report |
Fetches summaries detailing levied tax amounts. |
System Parameters
| Procedure Name | Purpose |
|---|---|
get_settings |
Retrieves the complete configuration manifest. |
get_setting_options |
Fetches the available choices for a specific configuration parameter. |
update_setting_option |
Modifies the value of an individual configuration setting. |
System Health Check
| Procedure Name | Purpose |
|---|---|
get_system_status |
Queries the current operational health status. |
get_system_status_tools |
Retrieves the list of available system diagnostic utilities. |
run_system_status_tool |
Executes a selected system diagnostic utility. |
Global Data Retrieval
| Procedure Name | Purpose |
|---|---|
get_data |
Fetches generalized, non-categorized store information. |
get_continents |
Queries the master list of global continents. |
get_countries |
Fetches the master list of supported nations. |
get_currencies |
Retrieves the list of recognized monetary units. |
get_current_currency |
Identifies the primary operational currency setting. |
Procedure Parameter Conventions
All remote procedures adhere to a consistent input structure. Illustrative examples follow:
Universal Parameters (Applicable to All Procedures)
siteUrl: (Optional; defaults to value specified in runtime environment) The root URL of the WordPress installation.
WooCommerce Endpoint Parameters (Optional Overrides)
consumerKey: (Optional; defaults to value specified in runtime environment) The WooCommerce access key.consumerSecret: (Optional; defaults to value specified in runtime environment) The WooCommerce secret credential.
WordPress Core Endpoint Parameters (Optional Overrides)
username: (Optional; defaults to value specified in runtime environment) The WordPress user identifier for authentication.password: (Optional; defaults to value specified in runtime environment) The corresponding WordPress secret passphrase.
Operational Examples
WordPress Content Creation Example
{ "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" } }
Product Listing Retrieval Example
{ "jsonrpc": "2.0", "id": 1, "method": "get_products", "params": { "perPage": 20, "page": 1, "filters": { "category": 19, "status": "publish" } } }
New Item Registration Example
{ "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" } ] } } }
Inventory Metadata Assignment Example
{ "jsonrpc": "2.0", "id": 1, "method": "create_product_meta", "params": { "productId": 456, "metaKey": "_custom_product_field", "metaValue": { "special_attribute": "value", "another_attribute": 42 } } }
Transaction Auxiliary Data Creation Example
{ "jsonrpc": "2.0", "id": 1, "method": "create_order_meta", "params": { "orderId": 789, "metaKey": "_delivery_instructions", "metaValue": "Leave package at the back door" } }
Security Advisory
To enable interaction with the WooCommerce REST API, the necessary access tokens must be generated within the administrative interface via: WooCommerce → Settings → Advanced → REST API.
Prerequisites
- A runtime environment supporting Node.js version 20.0.0 or newer.
- An active WordPress installation possessing the WooCommerce extension.
- Valid, configured WooCommerce REST API credential pairs.
Licensing
This software is distributed under the terms of the MIT License. Consult the LICENSE file for comprehensive details.
WIKIPEDIA: The XMLHttpRequest (XHR) construct represents an interface, implemented as a JavaScript object, whose member functions facilitate the dispatching of HTTP requests from a client web browser toward an origin web server. These functions empower browser-resident applications to initiate server communications subsequent to page rendering completion, and subsequently ingest returned data. XHR is a fundamental constituent of the Ajax programming paradigm. Preceding Ajax, the standard methods for server interchange were document hyperlinks and form submissions, actions that frequently necessitated a full page reload.
== Historical Context == The conceptual foundation for XMLHttpRequest was devised in the year 2000 by the engineering team responsible for Microsoft Outlook. This concept was subsequently integrated into the Internet Explorer 5 browser release (1999). Nevertheless, the initial invocation syntax did not employ the standard XMLHttpRequest identifier. Instead, developers utilized the object constructors ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP"). As of the release of Internet Explorer 7 (2006), all contemporary web browsers officially recognize and support the XMLHttpRequest identifier. The XMLHttpRequest identifier has since cemented its status as the universal convention across all major browser rendering engines, including Mozilla's Gecko (2002), Safari 1.2 (2004), and Opera 8.0 (2005).
=== Formal Specifications === The World Wide Web Consortium (W3C) formally published a Working Draft specification detailing the XMLHttpRequest entity on April 5, 2006. On February 25, 2008, the W3C issued the subsequent Working Draft Level 2 specification. Level 2 introduced capabilities enabling event progress monitoring, permitting requests across different domains (cross-site), and facilitating the handling of raw byte streams. By the close of 2011, the Level 2 specifications were consolidated back into the primary document. In late 2012, development stewardship transitioned to the WHATWG, which currently maintains the living document utilizing Web IDL definitions.
== Operational Utilization == Generally, the transmission of a request via XMLHttpRequest entails several discrete programming stages.
Instantiate an XMLHttpRequest object by invoking its constructor: Invoke the "open" method to designate the request methodology, pinpoint the targeted resource endpoint, and select either synchronous or asynchronous execution mode: For asynchronous operations, establish a callback handler intended to receive notifications when the request status transitions: Commence the data transmission by calling the "send" method: Process state changes within the designated event listener. If the server returns payload data, it is, by default, aggregated within the "responseText" attribute. Once the object ceases response processing, its state transitions to 4, signifying the "completion" state. Beyond these fundamental steps, XMLHttpRequest provides numerous configurable parameters to govern request initiation and response parsing. Custom header fields can be injected into the outgoing request to convey specific instructions to the server regarding fulfillment, and data payload can be uploaded by supplying it as an argument to the "send" call. The received response can be parsed from its raw text format into a immediately usable JavaScript structure, or it can be processed incrementally as segments arrive, negating the need to await the complete transmission. Furthermore, the request can be terminated prematurely or configured to time out if completion is not achieved within a predetermined interval.
== Inter-Domain Communications ==
During the nascent phases of the World Wide Web's evolution, it became apparent that circumvention of security restrictions regarding requests between distinct origins was possible...

