Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sulu Mcp Server Bundle Laravel Package

alengo/sulu-mcp-server-bundle

Read-only Sulu bundle exposing local template XML via authenticated admin API endpoints for MCP servers. Lists templates by type and returns raw XML. Secured by Sulu admin session plus required Bearer token; disabled if token is empty.

View on GitHub
Deep Wiki
Context7

SuluMcpServerBundle

Read-only HTTP API exposing local Sulu template XML files (pages, articles, blocks, snippets, properties) for use by an MCP (Model Context Protocol) server.

What it does

Provides two authenticated endpoints mounted under the project's admin API prefix (typically /admin/api):

Method Path Returns
GET /admin/api/mcp/templates/{type} JSON list of template names available for a type
GET /admin/api/mcp/templates/{type}/{name} Raw XML body of a single template

Defense-in-depth auth:

  1. Sulu admin session — the endpoints live under /admin/api/*, so the standard admin firewall applies. A request without a valid admin session (cookies) is rejected with 401 before reaching the controller.
  2. Bearer token — the controller additionally verifies an Authorization: Bearer <token> header. This restricts access to a specific MCP-server client even among logged-in admin users.

If the token is not configured (or empty), the API is fully disabled and returns 403.

Installation

composer require alengo/sulu-mcp-server-bundle

Register the bundle in config/bundles.php:

Alengo\SuluMcpServerBundle\McpServerBundle::class => ['all' => true],

Import the routing in config/routes/alengo_mcp_server.yaml:

alengo_mcp_server:
    resource: "@McpServerBundle/Resources/config/routing_admin_api.yaml"
    prefix: /admin/api

Set the bearer token in .env.local:

MCP_SERVER_TOKEN=<random-secret>

Generate one with e.g. openssl rand -hex 32.

The MCP client must send both the admin session cookies (after authenticating against /admin/login with a Sulu admin user) and the Authorization: Bearer <token> header. The standard Sulu admin firewall (^/admin) protects the path; no PUBLIC_ACCESS exception is required in security.yaml.

Configuration

The bundle ships with sensible defaults — no configuration file is required.

To override defaults, create config/packages/alengo_mcp_server.yaml:

alengo_mcp_server:
    # Bearer token. Empty string disables the API. Defaults to the MCP_SERVER_TOKEN env var.
    token: '%env(string:default::MCP_SERVER_TOKEN)%'

    # Template type => directory mapping (paths relative to %kernel.project_dir%).
    template_dirs:
        page:     config/templates/pages
        article:  config/templates/articles
        block:    config/templates/blocks/content
        snippet:  config/templates/snippets
        property: config/templates/properties

You can add additional template types by extending template_dirs — the controller will resolve any configured type.

Security model

  • Two-factor auth. Both a valid Sulu admin session AND the configured bearer token are required.
  • Admin firewall first. The path lives under /admin/api/*. Requests without a session never reach the controller.
  • Bearer token narrows further. Even logged-in admins cannot call the endpoint without the MCP token — this prevents accidental misuse from other admin tooling.
  • Constant-time comparison via hash_equals to avoid timing attacks.
  • Read-only. No write endpoints.
  • Token rotation: change MCP_SERVER_TOKEN, clear cache. The next request with the old token returns 403.

Requirements

Package Version
PHP ^8.2
Symfony ^7.0

License

MIT — alengo.dev

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle