Download the PHP package tmonier/sylius-b2b-mcp-plugin without Composer

On this page you can find all versions of the php package tmonier/sylius-b2b-mcp-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sylius-b2b-mcp-plugin

Sylius B2B MCP Plugin

Français : README.fr.md

Build

B2B tools for the official Sylius MCP server: your business customers connect Claude or ChatGPT to their own shop account to find past orders, reorder, quick order by SKU, request quotes and check their trade credit. They still place and pay their orders on your website.

sylius/mcp-server-plugin exposes a Sylius shop to AI assistants through the Model Context Protocol, as a guest: catalog search and a guest checkout. A purchasing manager who reorders every month needs their account instead: their orders, their prices, their company, their quotes, their credit.

This plugin adds that to the same MCP server (it is not a second server): OAuth 2.1 sign-in with the customer's shop account, and tools scoped to that customer and to the channel. The assistant prepares the cart; the customer reviews it and orders on the shop, where the order button, the legal information and the payment stay under your control.

It is a B2B tool for customers who add the connector themselves. It does not list your shop in the ChatGPT or Claude directories (that needs their review), and it does not sell "in" ChatGPT, Gemini or Claude: no order and no payment happen in the assistant.

Features

Need What the plugin does
Sign in with the shop account OAuth 2.1 authorization server for the MCP endpoint: authorization code with PKCE (S256 only), rotating refresh tokens, dynamic client registration (RFC 7591), discovery metadata (RFC 8414, RFC 9728), revocation (RFC 7009). The customer signs in on the shop and approves the assistant on a consent page of their account. Built on league/oauth2-server.
Find past orders list_my_orders, get_order: placed orders of the customer on the channel, with lines, SKU, prices, totals and states.
Reorder reorder: the items of a past order go into the cart at today's prices; each line says added, adjusted, or why not (no longer sold, out of stock, quantity rules), and whether the price changed.
Quick order by SKU quick_order_add (with tmonier/sylius-quick-order-plugin): preview first, then add with the same validation as the quick order page (pack sizes, stock, partial or all-or-nothing).
Request a quote request_quote, list_my_quotes (with tmonier/sylius-quote-request-plugin): from the cart or from SKU lines, with a message; the merchant answers in the shop as usual.
Know the credit left get_trade_credit_statement (with tmonier/sylius-trade-credit-plugin): limit, committed, available, open items, overdue amount and ageing.
Company buyers With tmonier/sylius-company-accounts-plugin: list_my_orders with scope: company, get_order and reorder on the company orders, as the company roles allow (its voters decide).
Approve purchase orders (1.1) With tmonier/sylius-purchase-approval-plugin: list_pending_approvals for approvers (buyer, total against the limit, age, whether they may approve); get_order shows the approval of an order; opt-in decide_approval (approve or reject with a comment, same rules as the shop page) behind its own permission b2b:approve.
Hand over to the checkout get_checkout_link: the cart and the link to review it and check out on the website, signed in with the same account (Sylius loads the latest cart of the customer).
Keep the assistant out of the checkout The guest cart and checkout tools of the official server (create_order, complete_checkout, ...) are hidden by default; its catalog tools stay.
One audit trail (1.1) With tmonier/sylius-audit-log-plugin: tool calls (without arguments), consents and revocations also appear in its log and in the customer history.
Stay in control One connection per customer, assistant and channel: listed in My account > AI assistants (disconnect) and in the admin (Customers > AI assistant connections, revoke). Audit log of every tool call (customer, assistant, arguments, outcome, duration) in the admin. Rate limits per connection and on the OAuth endpoints.

Tools whose plugin is not installed are simply not registered. Translations in English, French, German, Spanish, Italian, Dutch and Polish; MySQL, MariaDB and PostgreSQL.

Tools

Tool Scope Changes Needs
list_my_orders b2b:read nothing -
get_order b2b:read nothing -
reorder b2b:cart the cart (idempotency key) -
get_checkout_link b2b:read nothing -
quick_order_add b2b:read to preview, b2b:cart to add the cart (idempotency key) quick order plugin
request_quote b2b:cart sends a quote request (idempotency key) quote request plugin
list_my_quotes b2b:read nothing quote request plugin
get_trade_credit_statement b2b:read nothing trade credit plugin
list_pending_approvals b2b:read nothing purchase approval plugin
decide_approval b2b:approve approves or rejects (a rejected order is cancelled; idempotency key) purchase approval plugin + approvals.allow_decisions: true

No tool places an order, pays, or changes the account, the addresses or the payment methods.

Approval decisions from an assistant (opt-in)

decide_approval is off by default. With approvals.allow_decisions: true, the shop offers the b2b:approve permission; on the consent page it is a separate, never pre-ticked checkbox with a warning, and a client asking for no scope never gets it. The tool applies the rules of the shop page (approver of the order's company, no self-approval, approval limit, order still new, one decision under a lock) and records the approver as the decider.

The risk is prompt injection: text the assistant reads (a product name, an order, a quote message, a web page) could try to make it approve an order. Mitigations: the tool description tells the model to call it only on the user's explicit request after showing the order; the decision is limited by the approver's approval limit; every call is audited; and keep tool confirmations on in your assistant (Claude and ChatGPT ask before running a tool that is not read-only: decide_approval is annotated as destructive). Enable it only for approvers who understand this.

Turning allow_decisions off takes b2b:approve away from every connection for good (at the cache warmup of the deployment, else on the first MCP request or token refresh, and in tmonier:b2b-mcp:purge); the connections keep b2b:read and b2b:cart and their refresh keeps working. Turning it back on never restores the permission: each approver ticks it again on a new consent.

Screenshots

Requirements

Version
PHP 8.2+ (8.3+ with Sylius 2.3)
Sylius 2.2.9+, 2.3
Symfony 7.4 (Sylius 2.2); 7.4, 8.x (Sylius 2.3)
sylius/mcp-server-plugin 0.2 (installed as a dependency, with symfony/mcp-bundle 0.3)
league/oauth2-server 9 (installed as a dependency)

Symfony 6.4 is not supported: symfony/mcp-bundle, which the official MCP plugin is built on, requires Symfony 7.3 or later. The official plugin is beta (0.x); see Limitations.

The shop must be reachable over HTTPS on a public host name: Claude and ChatGPT connect to it from their servers. Behind a reverse proxy, configure the trusted proxies so that the URLs of the OAuth metadata use https and the public host.

Installation

  1. Require the package:

  2. Register the bundles in config/bundles.php (the first two may already be there):

  3. Import the configuration and the routes of both plugins:

    No change to security.yaml is needed (see How it works).

  4. Run the migration (plugin tables only, core tables are not changed):

  5. Set a dedicated encryption key (it protects authorization codes and refresh tokens; it defaults to the kernel secret):

  6. Schedule the clean-up once a day: bin/console tmonier:b2b-mcp:purge (expired tokens, clients registered but never connected, old idempotency keys, audit entries older than the retention period).

The MCP endpoint is the HTTP path of symfony/mcp-bundle: https://your-shop.example.com/_mcp with sylius/mcp-server-plugin 0.2.

Connecting an assistant

The customer needs a shop account on the channel (host name) of the URL.

Claude (custom connector)

  1. In Claude (web or desktop): Settings > Connectors > Add custom connector.
  2. Name it after the shop, URL https://your-shop.example.com/_mcp, no client ID needed (Claude registers itself).
  3. Connect: Claude opens the shop; the customer signs in and clicks Allow on the consent page. On Team and Enterprise plans, an owner may have to add the connector first.

Claude uses the callback https://claude.ai/api/mcp/auth_callback (and claude.com), allowed by default. Claude Code connects from a local callback (claude mcp add --transport http shop https://your-shop.example.com/_mcp): enable allow_loopback_redirect_uris for it.

ChatGPT (developer mode, Business and Enterprise)

  1. Enable developer mode (Settings > Apps & Connectors > Advanced settings), or ask the workspace admin on Business and Enterprise plans.
  2. Create a connector (app) with the URL https://your-shop.example.com/_mcp and OAuth authentication; ChatGPT registers itself.
  3. Connect: ChatGPT opens the shop for the sign-in and the consent.

ChatGPT uses https://chatgpt.com/connector_platform_oauth_redirect or a per-app callback https://chatgpt.com/connector/oauth/{id}, both allowed by default.

The availability of custom connectors depends on the plan and the country of the user, and changes often: check the current documentation of Anthropic and OpenAI. Listing the shop in a public directory (ChatGPT apps, Claude connectors directory) requires their review and is outside the scope of this plugin.

Fixed client ID instead of dynamic registration

Some setups prefer to register the assistant once:

and enter the client ID (and secret) in the advanced settings of the connector. Dynamic registration can then be switched off (oauth.dynamic_client_registration: false).

Recommended in production when your customers can be given a client ID: disable dynamic registration and create one client per assistant with the command. With dynamic registration on (needed for the one-click "Add connector" flow), anyone can register a client and choose its name; the redirect URI allow-list keeps the codes on the assistants' own hosts, and the consent page names the assistant after that verified host (Claude, ChatGPT), shows the host prominently and flags self-registered clients ("registered itself on under the name ... not verified by the shop").

Restricting the accounts that may connect an assistant (extension point)

By default any enabled shop account may connect an assistant and call the endpoint. To add a rule of your application (registration not approved, account suspended, contract ended...), implement Tmonier\SyliusB2bMcpPlugin\Account\AccountUsabilityCheckerInterface; it is tagged tmonier_b2b_mcp.account_usability_checker by autoconfiguration (a tag priority orders several checkers):

Configuration

Optional, with the defaults:

hidden_official_tools: [] keeps the whole guest checkout of the official server (the guest tools then work next to the B2B ones, with a separate guest cart).

How it works

Personal data

Demo data

The test application loads the fixtures of the companion plugins: [email protected] / sylius (trade credit account with open items), the Acme Industries company ([email protected], buyer@..., approver@... / sylius, with orders) and quote requests.

Limitations

Development

See SPEC.md for the research and design decisions.

B2B demo

This plugin is used in the Sylius B2B demo: a Sylius 2.3 shop with fictitious sample data where the B2B plugins work together. The source code, setup and fixtures of the demo are in that repository.

The demo is an example, not a production setup.

License

MIT, see LICENSE.


All versions of sylius-b2b-mcp-plugin with dependencies

PHP Build Version
Package Version
Requires league/oauth2-server Version ^9.2
mcp/sdk Version ^0.3
nyholm/psr7 Version ^1.8
php Version ^8.2
sylius/mcp-server-plugin Version ^0.2
sylius/sylius Version ^2.2.9 || ^2.3
symfony/clock Version ^7.4 || ^8.0
symfony/lock Version ^7.4 || ^8.0
symfony/psr-http-message-bridge Version ^7.4 || ^8.0
symfony/rate-limiter Version ^7.4 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tmonier/sylius-b2b-mcp-plugin contains the following files

Loading the files please wait ...