The TYPO3 MCP Server needs to handle both workspace overlays and language overlays while maintaining workspace transparency for MCP clients. Initially, both types of overlays were implemented manually with custom database queries.
We use TYPO3's built-in PageRepository API for language overlays while maintaining custom implementation for workspace overlays.
-
Language overlays are different from workspace overlays
- Language overlays are content variations, not versioning
- They should be transparent to MCP clients (clients request content in a specific language)
- TYPO3's PageRepository handles language fallbacks and overlay modes correctly
-
Workspace transparency requirement
- MCP clients should not be aware of workspace operations
- The MCP server handles workspace switching internally
- Live IDs are always exposed to clients, workspace IDs are hidden
-
PageRepository can be used safely for languages
- When created with proper Context API, PageRepository respects current workspace
- Language overlays don't conflict with workspace transparency
- We get TYPO3's battle-tested language handling for free
// Create context with language aspect
$context = GeneralUtility::makeInstance(Context::class);
if ($languageId > 0) {
$languageAspect = new LanguageAspect(
$languageId,
$languageId,
LanguageAspect::OVERLAYS_MIXED,
[$languageId]
);
$context->setAspect('language', $languageAspect);
}
// Create PageRepository with context
$pageRepository = GeneralUtility::makeInstance(PageRepository::class, $context);
// Get page with automatic language overlay
$page = $pageRepository->getPage($uid);
if ($languageId > 0) {
$page = $pageRepository->getPageOverlay($page, $languageId);
}- Reduced code complexity: No need to manually implement language overlay logic
- TYPO3 compatibility: Uses standard TYPO3 APIs, ensuring compatibility with future versions
- Correct behavior: Handles edge cases like language fallbacks, overlay modes, etc.
- Maintainability: Less custom code to maintain
None identified. This approach maintains all requirements while reducing complexity.
Classes/MCP/Tool/GetPageTool.php- Uses PageRepository for page data with language overlaysClasses/MCP/Tool/GetPageTreeTool.php- Uses PageRepository for page tree with language overlaysClasses/MCP/Tool/Record/AbstractRecordTool.php- Base class ensures workspace context initialization
If TYPO3 changes its language overlay implementation, we only need to update our Context/PageRepository usage rather than rewriting custom overlay logic.