How to Connect B2B for WooCommerce to Claude and Codex with MCP

This guide explains how to connect B2B for WooCommerce (Version 4.0.0 or above) to Claude or Codex through the Model Context Protocol (MCP).

After connecting, an authorized store manager can use normal-language requests to inspect and manage supported B2B features, including customer roles, pricing rules, product visibility, quotation rules, quotes, cart discounts, registration requests, order restrictions, and approved B2B settings using Claud or Codex AI.

Values used in this guide

Replace these example values with your own:

ExampleReplace with
https://yourwebsite.comYour store URL, without a trailing slash
mcp_store_userThe WordPress username created for MCP. It can be admin or anyother username that you want to create
xxxx xxxx xxxx xxxx xxxx xxxxThat user’s WordPress Application Password
addify-b2b-storeAny friendly connection name you prefer

Your Addify MCP endpoint is:

https://yourwebsite.com/wp-json/addify-b2b-mcp/mcp

Do not use your normal WordPress password in the connection settings.

Part 1: Prepare the WooCommerce store

↑ Back to top

Step 1: Check the permalinks

↑ Back to top
  1. Sign in to WordPress Admin.
  2. Go to Settings → Permalinks.
  3. Select any structure except Plain. Post name is a suitable option.
  4. Click Save Changes, even if the correct structure is already selected.

Step 2: Check the MCP Adapter

↑ Back to top

Use one of these methods:

  1. Download the latest release from the official WordPress MCP Adapter releases page, then install and activate its plugin ZIP; or
  2. Enable WooCommerce’s MCP integration if your WooCommerce version includes the shared MCP Adapter.

The B2B plugin uses the shared WordPress/WooCommerce MCP Adapter. It does not install a second copy.

Step 3: Enable the Addify MCP server

↑ Back to top
  1. Go to B2B → AI Assistant.
  2. Find Model Context Protocol (MCP).
  3. Turn on Enable MCP tools.
  4. Leave Allow MCP write requests turned off for the first connection test.
  5. Under Execution style, select Approval Mode (Recommended).
  6. Under Allowed B2B Features, enable only the features Claude or Codex should be allowed to access.
  7. Click Save AI Assistant Settings.
  8. Reload the page.
  9. Confirm that the MCP status says the server is enabled and displays this endpoint:
/wp-json/addify-b2b-mcp/mcp

The server ID is:

addify-b2b-mcp-server

The AI provider used by the plugin’s built-in chat assistant is separate from MCP. Claude or Codex uses its own model and calls the plugin’s MCP tools.

Step 4: Create an Application Password

↑ Back to top
  • Go to Users → Add New User or use any existing admin user.
  • Open Users → Profile for the MCP user.
  • Scroll to Application Passwords.
  • Enter a name such as Claude MCP or Codex MCP.
  • Click Add New Application Password.
  • Copy the generated password immediately.
  • Store it securely. WordPress will not show it again.

Application Passwords are separate from the user’s normal login password and can be revoked without changing the login password.

Step 6: Check the WordPress REST API

↑ Back to top

Open this address in a browser:

https://yourwebsite.com/wp-json

You should see a JSON response. If this address returns a normal website 404 page, fix the permalink or server rewrite configuration before continuing.

Do not expect the MCP endpoint itself to display a normal web page. Depending on the request, an authentication error, method error, or MCP protocol response can be normal.

Part 2: Connect Claude

↑ Back to top

You may connect with Claude Desktop or Claude Code. You only need one method.

Method 1: Claude Desktop

↑ Back to top

Step 1: Open the Claude configuration

  1. Open Claude Desktop.
  2. Go to Claude → Settings → Developer.
  3. Under Local MCP servers, select Edit Config.

Step 2: Add the server

Add the following entry to the mcpServers object. Replace the URL, username, and Application Password first.

{
  "mcpServers": {
    "addify-b2b-store": {
      "command": "npx",
      "args": ["-y", "@automattic/mcp-wordpress-remote@latest"],
      "env": {
        "WP_API_URL": "https://yourwebsite.com/wp-json/addify-b2b-mcp/mcp",
        "WP_API_USERNAME": "mcp_store_user",
        "WP_API_PASSWORD": "xxxx xxxx xxxx xxxx xxxx xxxx"
      }
    }
  }
}

If your configuration already contains other MCP servers, add addify-b2b-store inside the existing mcpServers object. Do not replace the other entries, and make sure the JSON commas remain valid.

Step 3: Restart Claude Desktop

  1. Save the configuration file.
  2. Fully quit Claude Desktop.
  3. Open Claude Desktop again.
  4. Return to Settings → Developer.
  5. Confirm that addify-b2b-store shows a running or connected status.

Step 4: Perform a read-only test

Start a new conversation and enter:

Use the Addify B2B MCP tools to list the B2B customer roles in my WooCommerce store. This is a read-only request. Do not make any changes.

Claude may ask for permission before calling a tool. Review the request and allow it.

Method 2: Claude Code

↑ Back to top

Step 1: Add the server

Open a terminal on the computer where Claude Code is installed and run this command after replacing the three connection values:

claude mcp add addify-b2b-store \
  --scope user \
  --transport stdio \
  --env 'WP_API_URL=https://yourwebsite.com/wp-json/addify-b2b-mcp/mcp' \
  --env 'WP_API_USERNAME=mcp_store_user' \
  --env 'WP_API_PASSWORD=xxxx xxxx xxxx xxxx xxxx xxxx' \
  -- npx -y @automattic/mcp-wordpress-remote@latest

Step 2: Confirm the connection

Run:

claude mcp list

The addify-b2b-store entry should show Connected. Inside Claude Code, you can also run:

/mcp

Step 3: Perform a read-only test

Enter:

Use the Addify B2B store tools to show the B2B dashboard summary. Do not change the store.

Official reference: Connect Claude Code to tools via MCP.

Part 3: Connect Codex

↑ Back to top

The easiest method is to add the server with Codex CLI. The Codex desktop app, CLI, and IDE extension share the MCP configuration on the same Codex host.

Step 1: Add the server

↑ Back to top

Open a terminal on the computer where Codex is installed. Replace the URL, username, and Application Password, then run:

<!-- wp:paragraph -->
<p>codex mcp add addify-b2b-store \<br>  --env 'WP_API_URL=https://yourwebsite.com/wp-json/addify-b2b-mcp/mcp' \<br>  --env 'WP_API_USERNAME=mcp_store_user' \<br>  --env 'WP_API_PASSWORD=xxxx xxxx xxxx xxxx xxxx xxxx' \<br>  -- npx -y @automattic/mcp-wordpress-remote@latest</p>
<!-- /wp:paragraph -->

Step 2: Confirm the connection

↑ Back to top

Run:

codex mcp list

Confirm that addify-b2b-store is listed.

Step 3: Restart Codex

↑ Back to top

If the Codex desktop app or IDE extension was open when you added the server:

  1. Open Settings → MCP servers.
  2. Confirm that addify-b2b-store is enabled.
  3. Restart Codex or restart the IDE extension.
  4. Type /mcp in the composer to view the connected servers.

Step 4: Perform a read-only test

↑ Back to top

Start a new task and enter:

Use the Addify B2B MCP tools to list the B2B customer roles in my WooCommerce store. This is a read-only request. Do not make changes.

Official reference: Connect Codex to MCP servers.

Part 4: Safely test a store change

↑ Back to top

Complete the read-only test before enabling writes.

Step 1: Enable guarded write requests

↑ Back to top
  1. In WordPress Admin, go to B2B → AI Assistant.
  2. Keep Execution style set to Approval Mode.
  3. Turn on Allow MCP write requests.
  4. Click Save AI Assistant Settings.
  5. Reload the page.

Step 2: Request a test role

↑ Back to top

Ask Claude or Codex:

Create a B2B user role titled Test Dealer. Show me what will happen and submit it for approval. Do not apply it automatically.

The plugin automatically:

  • Creates the role slug from the title, such as test_dealer.
  • Copies the WordPress Customer role capabilities by default.
  • Records the request in the audit history.

Step 3: Review and approve the request

↑ Back to top
  1. In WordPress Admin, go to B2B → AI Assistant.
  2. Open Activity & Audit Log.
  3. Review the requested action, target, risk, and proposed values.
  4. Click Approve to apply it, or Deny to reject it.
  5. Open the appropriate B2B settings screen and confirm the result.

Execution styles

↑ Back to top
ModeResult
Advisory ModeReturns complete numbered instructions and does not modify the store.
Approval ModeQueues write requests in Activity & Audit Log for an administrator to approve or deny. Recommended for production.
Automatic ModeApplies enabled write requests immediately and records them in audit history. Use only after testing.

The Allow MCP write requests switch is an additional safety control. When it is off, MCP cannot submit store changes even if the selected execution style normally allows changes.

Example requests

↑ Back to top

Read-only requests

↑ Back to top

Show my B2B dashboard summary for the last 30 days.

List all B2B customer roles and their slugs.

List the active role-based pricing rules.

Show pending B2B registration requests.

Write requests

↑ Back to top

Use Approval Mode for these examples.

Create a B2B role named Wholesale Gold and submit it for approval.

Create a quote for customer@customeremail.com containing 5 units of Blue T-Shirt and submit it for approval.

For quote creation:

  • If the email belongs to a WordPress user, the plugin uses that user’s ID.
  • If the email does not belong to a user, the plugin prepares the quote for guest customer ID 0.
  • If several products match a product name, the plugin asks you to choose the correct product before it creates or queues the quote.

Create a 10% cart discount for the Wholesale Gold role and submit it for approval.

Always review the exact target, values, dates, product IDs, role IDs, and customer details before approving a write request.

Optional: Use the WooCommerce MCP endpoint

↑ Back to top

If WooCommerce MCP integration is enabled, the guarded Addify tools are also available through:

https://example.com/wp-json/woocommerce/mcp

This alternative uses a WooCommerce REST API key in the X-MCP-API-Key header instead of a WordPress Application Password. The header value has this format:

consumer_key:consumer_secret

The key owner must have permission to manage WooCommerce. The key’s Read, Write, or Read/Write scope is enforced. Use the dedicated Addify endpoint described earlier unless you specifically need one shared WooCommerce MCP connection.

Troubleshooting

↑ Back to top

The REST API or MCP endpoint returns 404

↑ Back to top
  1. Go to Settings → Permalinks.
  2. Select anything except Plain.
  3. Click Save Changes.
  4. Test https://yourwebsite.com/wp-json/ again.
  5. If it still returns a website 404 page, ask the hosting provider to enable WordPress rewrite rules and REST API access.

The plugin says “MCP Adapter not detected”

↑ Back to top
  1. Confirm WordPress is version 6.9 or later.
  2. Install and activate the official WordPress MCP Adapter, or enable the WooCommerce MCP integration that supplies it.
  3. Reload B2B → AI Assistant.

Claude or Codex reports “Failed to connect”

↑ Back to top
  1. Confirm Node.js and npx are installed:

   node –version
  npx –version

  1. Check that WP_API_URL contains the complete endpoint and no trailing spaces.
  2. Check that the WordPress username is correct.
  3. Generate a new Application Password and replace the old value.
  4. Restart the AI client after changing its configuration.

Authentication returns 401

↑ Back to top
  • Use the WordPress username, not the email address unless the username is the email.
  • Use the generated Application Password, not the normal login password.
  • Confirm HTTPS is working correctly.
  • Check whether a security plugin, proxy, CDN, or web server is removing the HTTP Authorization header.

A tool returns 403

↑ Back to top
  • Confirm Enable MCP tools is on.
  • Confirm the MCP user has manage_woocommerce.
  • Confirm the requested feature is enabled under Allowed B2B Features.
  • For a write request, confirm Allow MCP write requests is on.
  • If using the WooCommerce endpoint, confirm the API key has the required Read or Write scope.

The server connects but no Addify tools appear

↑ Back to top
  1. Confirm at least one feature is enabled under Allowed B2B Features.
  2. Save the settings and reload WordPress Admin.
  3. Restart Claude or Codex so it refreshes the tool list.
  4. Check /mcp in the AI client.

A requested change was not applied

↑ Back to top
  • In Advisory Mode, the plugin only returns instructions.
  • In Approval Mode, open B2B → AI Assistant → Activity & Audit Log and approve the pending request.
  • If writes are disabled, enable Allow MCP write requests before trying again.

A firewall or security service blocks the connection

↑ Back to top

Ask the host or security provider to allow authenticated requests to:

/wp-json/addify-b2b-mcp/mcp

The route must accept MCP HTTP requests and WordPress Application Password authentication. Do not disable the entire firewall just to test MCP.

Security recommendations

↑ Back to top
  1. Use a dedicated MCP user rather than a personal administrator account.
  2. Give the user only the permissions it needs. The plugin requires manage_woocommerce.
  3. Begin with MCP writes disabled.
  4. Use Approval Mode on production stores.
  5. Enable only the B2B features customers need.
  6. Test write workflows on a staging store first.
  7. Review Activity & Audit Log regularly.
  8. Never share an Application Password in a support ticket, screenshot, chat message, or published configuration.
  9. Revoke unused passwords under Users → Profile → Application Passwords.
  10. If a computer containing the MCP configuration is lost or compromised, revoke that Application Password immediately.

Disconnect the store

↑ Back to top

From WordPress

↑ Back to top
  1. Go to B2B → AI Assistant.
  2. Turn off Enable MCP tools and save.
  3. Go to the MCP user’s WordPress profile.
  4. Revoke the relevant Application Password.

From Claude Code

↑ Back to top

claude mcp remove addify-b2b-store

From Codex

↑ Back to top

codex mcp remove addify-b2b-store

For Claude Desktop, remove the addify-b2b-store entry from the mcpServers configuration and restart Claude.

Official references

↑ Back to top
Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.