Search by

MCP server for the Blackcube admin data layer

Package info

github.com/blackcubeio/mcp

pkg:composer/blackcube/mcp

Statistics

Installs: 29

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.3 2026-11-12 19:01 UTC

This package is auto-updated.

Last update: 2026-11-12 19:03:16 UTC


README

MCP server exposing the content administration operations of the Blackcube ecosystem, on top of blackcube/dcore. Opaque MCP keys or OAuth2 access tokens issued by the dboard authorization server, tools gated on dboard permissions, Streamable HTTP transport mounted as a PSR-15 middleware.

You generate an MCP key, or let an LLM client register itself and ask an administrator for consent; then the agent drives the content tree, blocs, taxonomy and discoverability through dcore — no parallel data path, no business logic duplicated.

Authentication

Two credentials open the server, both carrying dboard permissions:

  • an opaque MCP key, generated in the dboard "MCP keys" screen or in the console, for the agents you run yourself;
  • an OAuth2 access token issued by the dboard authorization server, for LLM clients: the client registers itself (RFC 7591), sends the administrator to the consent screen (authorization code + PKCE), and receives a token bounded by the permissions that administrator holds. The bound is checked again on every request: a right lost in dboard is lost on the server at once.

The server publishes its protected resource metadata (RFC 9728) under /.well-known/oauth-protected-resource followed by the endpoint path, and points at /dboard/oauth/mcp, its population on the dboard side. Each tool declares the dboard permissions it gates on (PERMISSIONS), and MCP:CONNECT is required for any credential.

License Packagist Version

Quickstart

composer require blackcube/mcp

The package is a dcore add-on administered by dboard. Its DI, routes and parameters are merged by yiisoft/config, and it declares itself to dcore ('blackcube/dcore' => ['addons' => ['mcp' => McpAddon::class]]): the host application declares nothing about it, its migrations are played by its activation, never by migrate:up. The host sets its own parameters:

return [
    'blackcube/mcp' => [
        'endpoint' => '/mcp',
        'locale' => 'en',
        'maxTtlDays' => 180,
        'defaultTtlDays' => 90,
        'allowedHosts' => ['cms.example.com'],
    ],
];

Psr\Clock\ClockInterface is expected from the host application (blackcube/oauth2 provides one); the package does not bind it.

locale (default en) is set on the translator for the endpoint only: every message sent back to the client, validation errors included, stays in that locale whatever the application locale.

allowedHosts (default []) lists the host names the endpoint answers to; any other Host header gets a 403. Left empty, only the host of the current request is allowed. An application usually fills it from a comma-separated environment variable (MCP_ALLOWED_HOSTS="cms.example.com, localhost", split on /\s*,\s*/).

The endpoint and its metadata document answer 404 until the add-on is active. Activate the add-on, from the Addons screen of dboard or from the console (migrations, registry row and permissions in one go), then create a key. Scopes are dboard permissions: MCP:CONNECT is mandatory, the others are the permissions the tools gate on (McpAddon::getScopes() lists them all). The token is printed once.

php yii.php dboard:addonActivate mcp
php yii.php mcp:keyCreate --name="content agent" --scopes=MCP:CONNECT,CONTENT:VIEW

A base migrated under the former migration names: run php yii.php upgrade first, the activation then writes the registry row alone.

mcp:keyList, mcp:keyRevoke and mcp:keyGc complete the console side; the dboard "MCP keys" screen does the same, rotation included.

Point the MCP client at the endpoint (Streamable HTTP) with the token as a bearer:

{
    "mcpServers": {
        "blackcube": {
            "type": "http",
            "url": "https://cms.example.com/mcp",
            "headers": {
                "Authorization": "Bearer <token>"
            }
        }
    }
}

An OAuth2-capable client needs no key: it discovers the authorization server from /.well-known/oauth-protected-resource/mcp, registers itself and asks an administrator for consent.

Tests

vendor/bin/codecept run

License

BSD-3-Clause. See LICENSE.md.

Author

Philippe Gaultier philippe@blackcube.io