Search by

svenjuergens / t3-mcp-addons

SvenJuergens

Additional tools for the TYPO3 MCP server (hn/typo3-mcp-server): a per-user MCP workspace and workspace publishing, plus a command for repeated scheduled publishing.

Package info

github.com/SvenJuergens/t3-mcp-addons

Type:typo3-cms-extension

pkg:composer/svenjuergens/t3-mcp-addons

Statistics

Installs: 535

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.6.0 2026-11-14 10:53 UTC

This package is auto-updated.

Last update: 2026-11-14 10:55:33 UTC


README

Additional tools for the TYPO3 MCP server (hn/typo3-mcp-server). The workspace tools work on the MCP workspace the user has chosen (see MCP workspace), so drafts written through MCP can be reviewed and published without opening the backend.

Tool Purpose
PublishWorkspace Publishes all pending changes of the current workspace. Supports dryRun to list what would go live.
GetCurrentUser Returns the backend user the MCP connection acts as: uid, username, name and email (null when not set). Read-only, no parameters, only ever the current user.

Workspace preview links come from the MCP server itself: GetPage and GetPageTree show a preview URL for every page with unpublished changes, and WriteTable and ReadTable return a preview_url for the record. The GetPreviewLink tool this add-on shipped up to version 0.5 is gone.

MCP workspace

Out of the box the MCP server works in the alphabetically first workspace the user can write to, creates a workspace of its own when there is none, or falls back to live. With several workspaces that is hard to predict. This add-on replaces the selection:

  • Every backend user chooses the MCP workspace in the user settings (User settings > MCP workspace). Only workspaces the user may write to are offered, live never.
  • MCP clients read and write only in that workspace. The workspace switcher of the backend has no influence, so the user can keep working, publishing or switching to live without moving the MCP workspace. PublishWorkspace publishes the MCP workspace.
  • Administrators can preset the choice in the backend user record (next to the workspace permissions; for administrator accounts in the options tab). The list shows the workspaces of the edited user, group memberships included. A new user has to be saved first, before that only "none" is offered. The user can change a preset in the user settings.
  • A changed choice applies from the next request on.
  • Without a valid choice - none made, workspace deleted, user removed from it - MCP access is blocked. The MCP connection still works, but every tool that touches content answers with a message that tells the user where to choose a workspace (GetCurrentUser keeps working, it reads no content). There is no fallback and no automatically created workspace.
  • After installing or updating, every MCP user is blocked until a workspace is chosen.

Uploaded files are not affected by the choice in TYPO3 terms: files are not workspace-versioned, an upload lands in the file storage at once. A workspace can restrict the file mounts, though, so the choice decides which folders MCP clients may upload to.

How it works: an XCLASS of Hn\McpServer\Service\WorkspaceContextService replaces switchToOptimalWorkspace(). As a safety net in case the XCLASS ever stops taking effect, a listener on BeforeRecordWriteEvent refuses every WriteTable call that is not in the chosen workspace.

TYPO3 13 and 14 register the setting differently: TYPO3 13 through $GLOBALS['TYPO3_USER_SETTINGS'] of EXT:setup (ext_tables.php), TYPO3 14 through ExtensionManagementUtility::addUserSetting() (Configuration/TCA/Overrides/be_users.php). The choice is stored in be_users.tx_t3mcpaddons_workspace; run the database analyzer after installing.

Results and errors

Every tool answers with a JSON object. Errors carry an error text and are flagged with isError:

{"error": "Page 999 does not exist."}

Error texts never quote messages from the system. Exceptions and database errors are written to the TYPO3 log; the client only gets a fixed hint. When publishing fails, PublishWorkspace lists the affected records with a reason taken from the error classification of the log entry, not from its message:

{
  "error": "Publishing failed, other records of the workspace may have been published. Details are in the TYPO3 log.",
  "workspace": {"uid": 1, "title": "Editing"},
  "dryRun": false,
  "count": 2,
  "records": {"tt_content": [12, 13]},
  "failed": [
    {"table": "tt_content", "uid": 13, "reason": "denied", "hint": "Publishing was refused, check permissions and workspace stage."}
  ]
}

reason is denied for user errors (permissions, stage) and system for everything else.

Command

Command Purpose
mcp-addons:workspace:publish Publishes every workspace whose publication date (publish_time) is set and lies in the past. Unlike the core command workspace:autopublish, the date is not reset afterwards, so the command can run on a schedule and publishes the current workspace content on every run. Setting a past date switches automatic publishing on, clearing it switches it off. Supports --dry-run.

Requirements

  • TYPO3 13.4 or 14.3
  • typo3/cms-workspaces
  • typo3/cms-setup (TYPO3 13; part of typo3/cms-backend in TYPO3 14)
  • hn/typo3-mcp-server 0.7 or later (below 1.0)

Installation

composer require svenjuergens/t3-mcp-addons

The tools register themselves through the mcp.tool service tag of the MCP server; no further configuration is needed. Flush the caches afterwards.

Notes

  • PublishWorkspace cannot be undone through MCP. The tool description tells the model to call it only on an explicit request and to run a dry run first. Leave the extension out, or restrict the MCP user, where publishing should stay a manual review step.
  • The same applies to mcp-addons:workspace:publish: schedule it only where workspace content may go live without a review.

License

GPL-2.0-or-later