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.
- PHP 8.2+
- Sylius 2.1 or 2.2
- Symfony 7.4
- MySQL or PostgreSQL
- Node.js 20+ and Yarn (for frontend assets)
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
composer require sylius/admin-mcp-server-pluginNote 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
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.pemThe keys default to config/jwt/mcp_private.pem and config/jwt/mcp_public.pem. Override via env vars if you want a different location.
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 32php bin/console doctrine:migrations:migrate -nThis creates three OAuth tables: sylius_admin_mcp_oauth_clients, sylius_admin_mcp_oauth_authorization_codes, sylius_admin_mcp_oauth_refresh_tokens.
php bin/console cache:clear
php bin/console cache:warmupThe admin authorization page requires Sylius admin panel assets. If you haven't already:
yarn install
yarn build
php bin/console assets:installOnly 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.
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.
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.toolExpected routes: /.well-known/oauth-authorization-server, /_mcp/oauth/register, /admin/mcp/oauth/authorize, /_mcp/oauth/token, /_mcp.
Once the plugin is installed and running, connect an AI assistant using one of the options below.
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.
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
claude mcp add --transport http sylius-admin https://your-domain.com/_mcpClaude Code handles the full OAuth PKCE flow automatically on first use (opens a browser window for the consent step).
In Cursor settings → MCP → Add server:
{
"sylius-admin": {
"url": "https://your-domain.com/_mcp",
"type": "http"
}
}- 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
- 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
This plugin enforces telemetry data collection when used with Sylius. Details are described in TELEMETRY_POLICY.md.
This plugin is released under the MIT License.