npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

directus-extension-mcp-comments

v1.0.1

Published

MCP tool for managing comments on Directus items

Readme

Directus MCP Comments Extension

A Directus extension that adds a comments tool to the MCP (Model Context Protocol) interface, allowing AI agents to create, read, update, and delete comments on Directus items.

Features

  • Create comments on any item in any collection
  • Read comments with filtering by collection and item
  • Update existing comments
  • Delete comments
  • Full integration with Directus user system and permissions
  • Automatic timestamp tracking

Prerequisites

This extension requires the directus-extension-mcp-customization extension to be installed and enabled.

Installation

Install via npm:

npm install directus-extension-mcp-comments

Or manually:

  1. Install dependencies:
npm install
  1. Build the extension:
npm run build
  1. The extension will be automatically loaded by Directus when the server starts.

Usage

The comments tool supports four operations:

Create a Comment

{
  "action": "create",
  "collection": "posts",
  "item": "abc-123",
  "comment": "This is a great post!"
}

Read Comments

Read all comments for a collection:

{
  "action": "read",
  "collection": "posts",
  "limit": 10
}

Read comments for a specific item:

{
  "action": "read",
  "collection": "posts",
  "item": "abc-123",
  "limit": 10
}

Update a Comment

{
  "action": "update",
  "id": "comment-id-123",
  "comment": "Updated comment text"
}

Delete a Comment

{
  "action": "delete",
  "id": "comment-id-123"
}

Technical Details

Architecture

This extension uses the Directus hook system to:

  1. Register the comments tool in the MCP tools list via the mcp.tools.list filter
  2. Handle tool execution via the comments.mcp.tools.call filter event
  3. Receive user accountability from the meta parameter passed by the customization extension
  4. Use CommentsService with proper accountability for permission-aware operations

Filter Event Handler

emitter.onFilter("comments.mcp.tools.call", async (toolCall, meta) => {
  // Extract accountability from meta parameter
  const { accountability } = meta;

  // Get input arguments from toolCall
  const input = commentInputSchema.parse(toolCall.arguments);

  // Create service with accountability for proper permissions
  const commentsService = new CommentsService({
    schema: await getSchema(),
    accountability,  // Ensures user context and permissions
  });

  // Perform operations with permission enforcement
  // ...
});

Development

Watch mode for development:

npm run dev

Validate the extension:

npm run validate

Related Extensions

License

MIT