MCP tool for viewing and managing the Directus activity log
npm install directus-extension-mcp-activityA Model Context Protocol (MCP) tool for viewing and managing the Directus activity log.
- View Activity Log: Query the complete activity history with flexible filtering
- Track User Actions: See who did what, when, and where
- Filter by Context: Find activities by collection, item, user, or action type
- Audit Trail: Complete audit trail of all system actions
``bash`
npm install directus-extension-mcp-activity
1. Clone this repository into your Directus extensions folder`
2. Install dependencies:
bash`
cd extensions/directus-extension-mcp-activity
npm install
`
3. Build the extension:
bash`
npm run build
4. Restart your Directus instance
This extension adds an activity tool to your Directus MCP server. It can be accessed through any MCP client connected to your Directus instance.
#### List Recent Activities
Query the activity log with filtering:
`json`
{
"action": "read",
"limit": 50,
"sort": ["-timestamp"]
}
#### Filter by Collection and Item
See all activities for a specific item:
`json`
{
"action": "read",
"collection": "posts",
"item": "post-uuid-456",
"sort": ["-timestamp"]
}
#### Filter by User
Track actions by a specific user:
`json`
{
"action": "read",
"user": "user-uuid-789",
"limit": 100
}
#### Filter by Action Type
Find specific types of actions:
`json`
{
"action": "read",
"activityAction": "create",
"limit": 50
}
- id: Unique identifier for the activityaction
- : Type of action (create, update, delete, login, comment, upload, run)user
- : User who performed the actiontimestamp
- : When the action occurredip
- : IP address of the useruser_agent
- : Browser/client informationcollection
- : Collection the action was performed on (if applicable)item
- : Primary key of the affected item (if applicable)comment
- : Optional comment associated with the actionorigin
- : Where the action originated (API, app, etc.)revisions
- : Related revision records
json
{
"action": "read",
"collection": "products",
"item": "important-product-id"
}
`$3
See what a user has been doing:
`json
{
"action": "read",
"user": "user-id",
"limit": 100
}
`$3
Check login activities:
`json
{
"action": "read",
"activityAction": "login",
"limit": 50
}
`$3
Track content changes:
`json
{
"action": "read",
"collection": "articles",
"activityAction": "update"
}
`Requirements
- Directus 10.10.0 or higher
Development
`bash
Build the extension
npm run buildWatch mode for development
npm run devValidate the extension
npm run validate
`Related Extensions
directus-extension-mcp-customization - Core framework for custom MCP tools
- directus-extension-mcp-comments - Manage comments through MCP
- directus-extension-mcp-hello-world - Example custom MCP tool
- directus-extension-mcp-presets - Manage presets/bookmarks through MCP
- directus-extension-mcp-revisions` - Manage revision history through MCPMIT
Joshua Bemenderfer
- Website: https://thederf.com
- Email: josh@thederf.com