Extra Directus MCP Tools: Give AI access to your Comments, Presets, Activity, and Revisions!

Hi there! I’ve had a good bit of fun over the weekend with my hackathon project.

Project Name: Extra Directus MCP Tools

Challenge Entered: Challenge 1 - Build a Project with MCP

Team Details: Just me, with my wife and cats providing moral support :slight_smile:

Project Description:

This project consists of six small extensions, all of which are now available on GitHub and NPM for use in your own Directus projects.

The core extension is directus-extension-mcp-customization. This provides a simple framework for extending Directus MCP with custom tools, and must be installed before any of the other extensions will work.

Then, I used Claude Code with Directus MCP to create, build, and test additional tools to access parts of the Directus API that are not currently exposed to enable some use cases not available in stock Directus MCP.

Each of the following extensions was fully vibe-coded, using Claude Code and Directus MCP to examine the schema, write the extension code, and test the tools to ensure they worked properly.

directus-extension-mcp-activity

View and query the Directus activity log through MCP.

Use-cases:

  • Audit trails: “Show me all changes to this product in the last week”
  • Security investigations: “Who logged in from this IP address?”
  • User monitoring: “What has this editor been working on?”
  • Change tracking: “Find all updates to articles by status”
  • Compliance reporting: Track who did what and when

directus-extension-mcp-comments

Create, read, update, and delete comments on Directus items.

Use-cases:

  • Collaborative workflows: AI can add review comments to drafts
  • Automated feedback: “Add a comment noting this needs fact-checking”
  • Documentation: Leave notes about content decisions
  • Task management: Comment-based todos on items
  • Editorial workflows: AI-powered content suggestions as comments

directus-extension-mcp-presets

Manage saved views, bookmarks, and collection layouts.

Use-cases:

  • Automated workspace setup: Create custom views for team members
  • Bulk bookmark creation: Generate filtered views for different content states
  • Layout management: Set up role-specific default views
  • Personalization: AI creates custom filters based on user patterns
  • Onboarding: Automatically configure helpful bookmarks for new users

directus-extension-mcp-revisions

View revision history and revert items to previous states.

Use-cases:

  • Content recovery: “Revert this article to yesterday’s version”
  • Change inspection: “What changed between these two revisions?”
  • Audit analysis: Track evolution of content over time
  • Rollback automation: Automatically revert problematic changes
  • Diff viewing: Compare current state with historical versions

directus-extension-mcp-hello-world

An example extension for developers to learn how to extend Directus MCP.

Technical Details:

The core extension intercepts requests to Directus’s /mcp endpoint and emits custom filter events allowing other extensions to inject additional tools and handle calls to them.

How it works:

  • Hooks into routes.before to intercept /mcp requests before they reach Directus’s built-in handler. Overrides res.json() to intercept responses.
  • Emits mcp.tools.list and mcp.tools.call filter events that other extensions can listen to.
  • Pulls user context from req.accountability and passes it to custom tools via a meta parameter.
  • Conditional Passthrough: If no custom handlers respond, falls through to allow Directus’s built-in MCP handler process the request.

Interestingly, this extension can also be used to modify or remove core tools.

Starting Point Details:

I’m not entirely sure what to cover in this section, but if you want to use any of these extensions yourself, you can find them on GitHub and NPM.

When building the project, I started with a basic Directus instance on a SQLite database, with a basic ecommerce schema, connected my Claude Web and Claude Code to the /mcp endpoint for it, and began building extensions in the /extensions folder. Not much else to it!

Demo Video:
In this video I describe the project, and demonstrate the process used to build the directus-extension-mcp-presets tool live.

Note: I stink at recording/editing videos, and my home is currently under renovation, so the audio and video quality is quite poor. Sorry!

4 Likes

Just a quick note to say thanks for submitting @TheDerf! We’ll have winner’s announcements next week. Have a great weekend :sunflower:

1 Like