sylius / admin-mcp-server-plugin
Sylius Admin MCP Server Plugin — exposes Sylius Admin API as an MCP server with OAuth 2.0 PKCE authentication.
Package info
github.com/Sylius/AdminMcpServerPlugin
Type:sylius-plugin
pkg:composer/sylius/admin-mcp-server-plugin
Fund package maintenance!
Requires
- php: ^8.2
- league/oauth2-server-bundle: ^1.1
- sylius/sylius: ^2.1
- sylius/telemetry: ^1.0
- symfony/mcp-bundle: ^0.11
Requires (Dev)
- behat/behat: ^3.16
- cweagans/composer-patches: ^2.0
- dbrekelmans/bdi: ^1.4
- dmore/behat-chrome-extension: ^1.4
- dmore/chrome-mink-driver: ^2.9
- friends-of-behat/mink: ^1.11
- friends-of-behat/mink-browserkit-driver: ^1.6
- friends-of-behat/mink-debug-extension: ^2.1
- friends-of-behat/mink-extension: ^2.7
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.1
- friends-of-behat/symfony-extension: ^2.6
- friends-of-behat/variadic-extension: ^1.6
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^1.12
- phpstan/phpstan-doctrine: ^1.3
- phpstan/phpstan-webmozart-assert: ^1.2
- phpunit/phpunit: ^10.5
- sylius-labs/coding-standard: ^4.4
- sylius-labs/suite-tags-extension: ~0.2
- sylius/sylius-rector: ^2.0
- sylius/test-application: ^2.0.0@alpha
- symfony/browser-kit: ^6.4 || ^7.4
- symfony/debug-bundle: ^6.4 || ^7.4
- symfony/dotenv: ^6.4 || ^7.4
- symfony/http-client: ^6.4 || ^7.4
- symfony/intl: ^6.4 || ^7.4
- symfony/runtime: ^6.4 || ^7.4
- symfony/web-profiler-bundle: ^6.4 || ^7.4
- symfony/webpack-encore-bundle: ^2.2
This package is auto-updated.
Last update: 2026-07-24 11:47:10 UTC
README
Sylius Admin MCP Server Plugin
Exposes Sylius Admin API as a Model Context Protocol (MCP) server with OAuth 2.0 PKCE authentication.
This plugin turns your Sylius store into an MCP server, allowing AI assistants (Claude, Cursor, etc.) to manage your store through natural language. It provides 171 tools covering all major Sylius resources - products, orders, customers, promotions, shipping, and more - secured by a full OAuth 2.0 Authorization Code + PKCE flow.
Requirements
- PHP 8.2+
- Sylius 2.1 or 2.2
- Symfony 7.4
- MySQL or PostgreSQL
- Node.js 20+ and Yarn (for frontend assets)
Installation
Installation with Symfony Flex recipe
When Symfony Flex is active, composer require sylius/admin-mcp-server-plugin automatically registers the bundles, imports the plugin configuration, and imports the routes. Continue from Step 2 below.
Note on
symfony/type-infopatch (Sylius 2.2.x): A bug insymfony/type-info v7.4.xcauses a cache warmup error:Cannot create union with both "object" and class type. Apply the patch that ships with the plugin:patch vendor/symfony/type-info/TypeContext/TypeContextFactory.php \ vendor/sylius/admin-mcp-server-plugin/patches/symfony-type-info-union-fix.patchTo re-apply this patch automatically after every
composer update, you can use cweagans/composer-patches:
composer require --dev cweagans/composer-patches- Copy the patch to your project:
mkdir -p patches && cp vendor/sylius/admin-mcp-server-plugin/patches/symfony-type-info-union-fix.patch patches/- Add to your
composer.json:"config": { "allow-plugins": { "cweagans/composer-patches": true } }, "extra": { "patches": { "symfony/type-info": { "Fix: Cannot create union with both object and class type": "patches/symfony-type-info-union-fix.patch" } } }- Run
composer install
Step 1 - Add the plugin via Composer
composer require sylius/admin-mcp-server-plugin
Note on
league_oauth2_server.yaml: the plugin ships its ownconfig/packages/league_oauth2_server.yamlthat configures the OAuth2 server usingSYLIUS_ADMIN_MCP_SERVER_OAUTH_*environment variables. If theleague/oauth2-server-bundleFlex recipe has already created aconfig/packages/league_oauth2_server.yamlandconfig/routes/league_oauth2_server.yamlin your project, replace both with empty stubs — otherwise the Flex-generated config conflicts with the plugin's own configuration and causes errors:echo "# Managed by sylius/admin-mcp-server-plugin" > config/packages/league_oauth2_server.yaml echo "# Routes provided by sylius/admin-mcp-server-plugin" > config/routes/league_oauth2_server.yaml
Step 2 - Generate OAuth keypair
The plugin uses a dedicated RSA keypair (separate from Lexik JWT) for signing OAuth tokens:
mkdir -p config/jwt openssl genrsa -out config/jwt/mcp_private.pem 4096 openssl rsa -in config/jwt/mcp_private.pem -pubout -out config/jwt/mcp_public.pem
The keys default to config/jwt/mcp_private.pem and config/jwt/mcp_public.pem. Override via env vars if you want a different location.
Step 3 - Configure environment variables
Add to your .env (or .env.local):
###> sylius/admin-mcp-server-plugin ### # URL of this application's Admin API (used by MCP tools to call the API) SYLIUS_ADMIN_MCP_SERVER_API_URL=https://your-domain.com/api/v2/admin/ # Admin API user credentials - only required if you use the credentials-based token provider. # By default the plugin reuses the OAuth Bearer token of the logged-in admin user. # To switch to credential-based login, alias the service in your config/services.php: # ->alias('sylius_admin_mcp_server.provider.token', 'sylius_admin_mcp_server.provider.token.credentials'); SYLIUS_ADMIN_MCP_SERVER_API_EMAIL=api@example.com SYLIUS_ADMIN_MCP_SERVER_API_PASSWORD=your-api-password # Set to false to disable SSL verification (useful for local HTTPS) SYLIUS_ADMIN_MCP_SERVER_VERIFY_SSL=true # OAuth RSA keypair generated in Step 2 (separate from Lexik JWT keys) SYLIUS_ADMIN_MCP_SERVER_OAUTH_PRIVATE_KEY=%kernel.project_dir%/config/jwt/mcp_private.pem SYLIUS_ADMIN_MCP_SERVER_OAUTH_PUBLIC_KEY=%kernel.project_dir%/config/jwt/mcp_public.pem SYLIUS_ADMIN_MCP_SERVER_OAUTH_PASSPHRASE= # Random hex string for OAuth token encryption - generate with: openssl rand -hex 32 SYLIUS_ADMIN_MCP_SERVER_OAUTH_ENCRYPTION_KEY=your-32-byte-hex-key-here ###< sylius/admin-mcp-server-plugin ###
Generate the encryption key:
openssl rand -hex 32
Step 4 - Run database migrations
php bin/console doctrine:migrations:migrate -n
This creates three OAuth tables: sylius_admin_mcp_oauth_clients, sylius_admin_mcp_oauth_authorization_codes, sylius_admin_mcp_oauth_refresh_tokens.
Step 5 - Clear cache
php bin/console cache:clear php bin/console cache:warmup
Step 6 - Build frontend assets
The admin authorization page requires Sylius admin panel assets. If you haven't already:
yarn install yarn build php bin/console assets:install
Step 7 - Grant API access to an admin user
Only admin users with ROLE_API_ACCESS can authorize via the OAuth consent page. Grant it to an existing user via SQL:
UPDATE sylius_admin_user SET roles = JSON_ARRAY_APPEND(roles, '$', 'ROLE_API_ACCESS') WHERE email = 'your@admin.com';
Or create a dedicated API user in your fixtures.
Manual Installation (without Symfony Flex)
If your project does not use Symfony Flex, the bundles, configuration, and routes are not registered automatically. See docs/manual-installation.md for step-by-step instructions.
Verification
After installation, verify everything is working:
# 1. Check services registered php bin/console debug:container --tag=mcp.tool | grep "Sylius" # 2. Check routes registered php bin/console debug:router | grep mcp # 3. Check OAuth discovery endpoint curl -sk https://your-domain.com/.well-known/oauth-authorization-server | python3 -m json.tool
Expected routes: /.well-known/oauth-authorization-server, /_mcp/oauth/register, /admin/mcp/oauth/authorize, /_mcp/oauth/token, /_mcp.
Connecting MCP Clients
Once the plugin is installed and running, connect an AI assistant using one of the options below.
Option A - Claude Desktop (local or remote)
Claude Desktop supports both local and remote MCP servers and works out of the box with any HTTPS URL - including localhost with a self-signed certificate.
Edit your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"sylius-admin": {
"type": "http",
"url": "https://your-domain.com/_mcp"
}
}
}
Claude Desktop reads the OAuth discovery endpoint (/.well-known/oauth-authorization-server) automatically and opens the consent page in your default browser when you first use the server. No manual token management is required.
Local development: Use
"url": "https://127.0.0.1:8003/_mcp". Claude Desktop accepts self-signed certificates, so no tunnelling is needed.
Option B - Claude.ai in the browser (Custom Connectors)
Requirements: Claude.ai Pro or Max plan. The server must be publicly accessible over HTTPS with a valid (non-self-signed) SSL certificate.
localhostdoes not work - Anthropic's servers call your endpoint from their own IP ranges.
- Open claude.ai → click your avatar → Customize Claude → Connectors → + → Add custom connector
- Paste your server URL:
https://your-domain.com/_mcp - Click Connect. Claude.ai reads the
/.well-known/oauth-authorization-serverdiscovery document automatically and redirects you to your Sylius admin consent page. - Log in as an admin user with
ROLE_API_ACCESSand click Allow.
Claude.ai uses https://claude.ai/api/mcp/auth_callback as its redirect URI, which the plugin's dynamic client registration endpoint accepts automatically.
Local development without a public server: Tunnel your local server through a public HTTPS URL using ngrok, Cloudflare Tunnel, or LocalCan:
# Example with ngrok: ngrok http https://127.0.0.1:8003 # Then use the generated https://xxxx.ngrok-free.app/_mcp URL in claude.ai
Option C - Claude Code (CLI)
claude mcp add --transport http sylius-admin https://your-domain.com/_mcp
Claude Code handles the full OAuth PKCE flow automatically on first use (opens a browser window for the consent step).
Option D - Cursor
In Cursor settings → MCP → Add server:
{
"sylius-admin": {
"url": "https://your-domain.com/_mcp",
"type": "http"
}
}
Security
- All
/_mcprequests require a valid OAuth 2.0 Bearer token (returns401otherwise) - Authorization is limited to admin users with
ROLE_API_ACCESS - Tokens expire after 1 hour; refresh tokens are valid for 30 days
- PKCE (Proof Key for Code Exchange) prevents authorization code interception attacks
Documentation
- Authentication Flow (OAuth 2.0 PKCE)
- Available MCP Tools - 171 tools across 34 resource groups
- Configuration Reference - selectively disabling tool groups
- Manual Installation - step-by-step guide for projects without Symfony Flex
- Troubleshooting
Telemetry
This plugin enforces telemetry data collection when used with Sylius. Details are described in TELEMETRY_POLICY.md.
License
This plugin is released under the MIT License.