- How do I install and enable this bundle in a Laravel/Sulu project?
- Run `composer require alengo/sulu-mcp-server-bundle`, add the bundle to `config/bundles.php`, import the routing in `config/routes/alengo_mcp_server.yaml`, and set the `MCP_SERVER_TOKEN` in your `.env.local` file. No additional configuration is required for basic use.
- What Laravel/Sulu versions does this bundle support?
- This bundle is designed for Symfony 7.x and Sulu CMS 3.x+. It leverages Sulu’s admin API and firewall, so ensure your Sulu installation meets these requirements. Laravel compatibility is indirect via Sulu’s Symfony integration.
- How do MCP servers authenticate to access the API?
- MCP servers must provide both a valid Sulu admin session (via cookies) and a Bearer token in the `Authorization` header. The token is configured in `.env.local` as `MCP_SERVER_TOKEN`, and the admin session is managed by Sulu’s built-in `/admin/login` endpoint.
- Can I customize the template directories this bundle scans?
- Yes, override the `template_dirs` configuration in `config/packages/alengo_mcp_server.yaml` to map custom paths for template types like `page`, `article`, or `block`. Default paths are relative to `%kernel.project_dir%` and align with Sulu’s standard structure.
- Is there a way to disable the API entirely if needed?
- Set the `MCP_SERVER_TOKEN` to an empty string in `.env.local` or configure `token: ''` in your bundle settings. The API will return a `403 Forbidden` response, effectively disabling access without modifying code.
- How do I generate a secure Bearer token for MCP servers?
- Use a cryptographically secure method like `openssl rand -hex 32` to generate a 32-character hex token. Store it in `.env.local` as `MCP_SERVER_TOKEN`. Avoid hardcoding tokens in configuration files or version control.
- Will this bundle work with non-standard Sulu template structures?
- Yes, the bundle supports custom template directories via the `template_dirs` configuration. If your Sulu setup uses non-standard paths (e.g., for custom template types), fully customize this mapping to ensure the API scans the correct locations.
- Are there performance concerns with frequent API calls?
- The bundle does not include built-in caching, so high request volumes (e.g., live previews) may strain filesystem I/O. Mitigate this by implementing external caching (e.g., Varnish, Redis) for `/admin/api/mcp/*` endpoints or adding a cache layer to the bundle.
- Does this bundle support JSON responses instead of raw XML?
- Currently, the API returns raw XML for template content. While there’s no built-in JSON conversion, you can parse the XML on the client side or extend the bundle to add a `?format=json` query parameter for backward compatibility with MCP servers.
- What happens if an MCP server provides an invalid Bearer token?
- The API will return a `401 Unauthorized` response if the Bearer token is missing or invalid. The Sulu admin session is also validated, so both authentication factors must be correct for access to be granted.