Extension · moselwal/webmcp

webmcp — the browser MCP for your TYPO3.

Web Model Context Protocol server that exposes tools like search, navigation and page content directly via navigator.modelContext. AI agents use them straight in the browser, with SecureContext checks and a CSRF nonce — no external API needed.

Das Problem

When the AI agent gets stuck because it can't see anything.

With webmcp

  • Standardised navigator.modelContext API directly in the browser
  • Built-in tools: search, navigation, page-content
  • Custom tools registerable via ToolProviderInterface
  • SecureContext + CSRF nonce, FE group-aware

Until now

  • AI agents have to learn external REST/GraphQL APIs
  • Auth tokens, rate limits, caching problems
  • Tools aren't available in the current browser context
  • Every site implements its own tool vocabulary

Four building blocks

Optional: form tool

With typo3/cms-form as an optional dependency, form submission is also exposed as a tool — AI agents can submit enquiries directly.

Secure by default

SecureContext required (HTTPS), CSRF nonce in every tool request, access control via TYPO3 FE groups respected.

Custom tool provider

Register your own tools via ToolProviderInterface — e.g. to expose shop-specific search functions or custom forms.

Built-in tools

search, navigation, page-content — ready to use straight after installation.

Installation: composer require moselwal/webmcp

TYPO3: 13.4 – 14.0 · PHP: 8.2+ · Optional: typo3/cms-form (Form tool)

Set up the Composer repository: add gitlab.moselwal.io/api/v4/group/175/-/packages/composer/packages.json as a Composer repository in your composer.json, then composer require moselwal/webmcp.

Configuration

Enable the site set

Include the site set moselwal/webmcp in your site configuration.

Settings

In config/sites/<site>/settings.yaml:

 

webmcp:
  enabled: true
  apiBasePath: '/_webmcp/api'
  tools:
    search:
      enabled: true
      maxResults: 20
    navigation:
      enabled: true
      maxDepth: 4
    page-content:
      enabled: true

Built-in tools

All tools respect TYPO3 access restrictions (fe_group, starttime, endtime, hidden). Only content visible to the current visitor (anonymous or logged-in) is returned.

ToolDescriptionInput
searchFull-text search across pages and content elements{ query: string, limit?: int }
navigationPage tree as structured JSON{ rootPageId?: int, maxDepth?: int }
page-contentStructured content of a specific page{ pageId?: int, slug?: string }

Building custom tools

1. Implement a ToolProvider

 

<?php

use Moselwal\WebMcp\Domain\Contract\ToolProviderInterface;
use Moselwal\WebMcp\Domain\Model\ToolAnnotations;
use Moselwal\WebMcp\Domain\Model\ToolDefinition;

final class ShopToolProvider implements ToolProviderInterface
{
    public function getIdentifier(): string
    {
        return 'shop';
    }

    public function getTools(): array
    {
        return [
            new ToolDefinition(
                name: 'product-search',
                description: 'Search products in the shop',
                inputSchema: [
                    'type' => 'object',
                    'properties' => [
                        'query' => ['type' => 'string'],
                        'category' => ['type' => 'string'],
                    ],
                    'required' => ['query'],
                ],
                annotations: new ToolAnnotations(readOnlyHint: true),
            ),
        ];
    }
}

 

2. Implement a ToolHandler

 

<?php

use Moselwal\WebMcp\Domain\Contract\ToolHandlerInterface;
use Moselwal\WebMcp\Domain\Model\ToolResult;
use Psr\Http\Message\ServerRequestInterface;

final class ProductSearchHandler implements ToolHandlerInterface
{
    public function getToolName(): string
    {
        return 'product-search';
    }

    public function execute(array $input, ServerRequestInterface $request): ToolResult
    {
        // Implement product search ...
        return ToolResult::success(['products' => $results]);
    }
}

 

Both classes are auto-registered via _instanceof tags in Services.yaml — no extra configuration required.

How it works

  1. When a page is rendered, the extension injects JavaScript via AssetCollector.
  2. The JavaScript registers all enabled tools through navigator.modelContext.registerTool().
  3. When an AI agent invokes a tool, the browser sends a POST request to /_webmcp/api/{toolName}.
  4. The PSR-15 middleware validates the request (CSRF nonce, input) and delegates to the matching ToolHandler.
  5. The result is returned as JSON.

Requirements

Source code & documentation

TYPO3 Extension Repository

Not in the official TER — install via Composer only.

Composer package

moselwal/webmcp via the Moselwal Composer repo.

Open the Composer repo

GitLab (source of truth)

Primary repository including CI/CD and Composer package registry.

gitlab.moselwal.io

GitHub

GitHub mirror with issues and PRs (placeholder — verify before publish).

github.com/moselwal/webmcp
Nächster Schritt

Help with integration?

webmcp is open source and meant for self-integrators. If you want to integrate webmcp for your specific use case (custom tools, commercial AI agent integration, custom permissions), we'll help on a day rate or as part of our CMS as a Service.

Integration besprechen

Oder direkt schreiben: kontakt@moselwal.de