Introducing MCP Support in Textstem

Introducing MCP Support in Textstem

We've just shipped a major new feature in the Textstem CMS package: a built-in Model Context Protocol (MCP) server. With a single environment variable you can expose your site's content and actions to AI assistants such as Claude, Cursor, and Windsurf — giving them direct, structured access to your pages, posts, and tools.

What is MCP?

The Model Context Protocol is an open standard that lets AI assistants connect to external data sources and callable tools over HTTP. Instead of copy-pasting content into a chat window, an MCP-enabled assistant can read your site's pages directly, search your posts, and even submit contact forms — all through a clean, well-defined interface.

What's included

Textstem's MCP server ships with three built-in resources and one built-in tool, all registered automatically when you enable the feature.

Built-in resources

  • textstem://site-info — general information about the site: name, URL, description, and contact details.
  • textstem://pages and textstem://pages/{slug} — all published CMS pages, or a single page by slug.
  • textstem://posts/{type} and textstem://posts/{type}/{slug} — published posts for any content type registered in your CMS (news, project, or any custom collection).

Built-in tool

  • search_content — fulltext search across published posts by keyword, with optional post-type filtering.

Enabling MCP

Add one line to your .env file:

MCP_ENABLED=true

That's it. The package registers GET /mcp and POST /mcp endpoints automatically. No new dependencies, no migrations, no published assets.

Additional options let you customise the server name, set a rate limit, provide instructions to the AI client, and configure a site description:

MCP_SERVER_NAME="My Site"
MCP_RATE_LIMIT=60
MCP_INSTRUCTIONS="This is a digital agency site. Focus on services and projects."
MCP_SITE_DESCRIPTION="A Melbourne-based studio specialising in web design and development."

Adding your own tools

The real power is in registering site-specific tools — actions an AI assistant can perform on your behalf. For example, submitting a contact enquiry:

// app/Mcp/Tools/ContactTool.php
class ContactTool extends McpTool
{
    public function name(): string { return 'submit_contact'; }

    public function call(array $arguments): array
    {
        $contact = Contact::create([...]);
        (new ContactFormSubmitted)->contacted($contact);
        return $this->success('Enquiry submitted.');
    }
}

Register it in AppServiceProvider::boot():

$this->app->make(McpRegistry::class)
    ->registerTool(new ContactTool)
    ->registerTool(new SubscribeTool);

Use the generator to scaffold the boilerplate:

php artisan textstem:make:mcp-tool ContactTool
php artisan textstem:make:mcp-resource EventsResource

Connecting to Claude Desktop

Add your site to Claude Desktop's claude_desktop_config.json:

{
  "mcpServers": {
    "my-site": {
      "url": "https://your-site.com/mcp"
    }
  }
}

After restarting Claude Desktop, your site's pages, posts, and tools appear in the context panel. You can ask Claude to summarise your services, find relevant projects, or submit an enquiry — all without leaving the conversation.

Full documentation

Complete documentation — including configuration reference, security considerations, and the full JSON-RPC method table — is available in the docs site.