home / mcp / directus mcp server
Provides a Directus MCP server to query, create, update, and manage Directus data via natural language prompts.
Configuration
View docs{
"mcpServers": {
"joshthederf-directus-extension-mcp": {
"url": "https://YOUR_DIRECTUS_URL/directus-extension-mcp/mcp?access_token=YOUR_ACCESS_TOKEN",
"headers": {
"MCP_SYSTEM_PROMPT": "<MCP_SYSTEM_PROMPT>",
"MCP_SYSTEM_PROMPT_ENABLED": "<MCP_SYSTEM_PROMPT_ENABLED>",
"DIRECTUS_PROMPTS_COLLECTION": "<DIRECTUS_PROMPTS_COLLECTION>",
"DIRECTUS_PROMPTS_NAME_FIELD": "<DIRECTUS_PROMPTS_NAME_FIELD>",
"DIRECTUS_PROMPTS_MESSAGES_FIELD": "<DIRECTUS_PROMPTS_MESSAGES_FIELD>",
"DIRECTUS_PROMPTS_DESCRIPTION_FIELD": "<DIRECTUS_PROMPTS_DESCRIPTION_FIELD>",
"DIRECTUS_PROMPTS_COLLECTION_ENABLED": "<DIRECTUS_PROMPTS_COLLECTION_ENABLED>",
"DIRECTUS_PROMPTS_SYSTEM_PROMPT_FIELD": "<DIRECTUS_PROMPTS_SYSTEM_PROMPT_FIELD>"
}
}
}
}The Directus MCP Server Extension lets any MCP client connect to your Directus instance, enabling content editors to manage content and data analysts to query collections through natural language. It provides safe, streaming HTTP communication and a curated set of tools to interact with Directus without risking destructive actions.
You connect an MCP client to your Directus instance using either a remote URL configuration or a local, npx-based bridge. Once connected, you can browse your Directus schema, read collections and items, manage files and fields, run automation flows, and interact with content through natural language prompts. The server limits destructive actions such as deleting fields or collections to protect your data while still offering powerful reading, creating, updating, and commenting capabilities.
Prerequisites you need before starting:
Install Directus extension and prepare credentials as described below.
MCP connection methods are provided for HTTP remote access and for local bridging via a command runner. The HTTP configuration uses a shared URL, while the local bridge uses a command that runs an MCP bridge client (for clients that lack native remote support). You can structure your setup to immediately connect and begin querying Directus data.
You can customize the system prompt for guiding the LLM’s tool usage by setting MCP_SYSTEM_PROMPT in your Directus environment. You can also disable it by setting MCP_SYSTEM_PROMPT_ENABLED to false. For prompts stored inside Directus, enable the prompts collection and set the corresponding field mappings to define names, descriptions, system prompts, and messages. You can use mustache templating to substitute variables in prompts with values you supply at call time.
The extension is designed to be safe by default, avoiding destructive changes. Always protect access tokens and use HTTPS URLs to prevent token leakage.
The MCP server provides a comprehensive set of tools to interact with Directus data and metadata, including reading schema, reading and creating items, updating fields, managing files, and running automations. This enables you to perform content operations, data analysis, and workflow actions from MCP-enabled clients.
Provides context to the LLM about its role and session start, guiding tool usage
Fetches current user information to tailor responses and permissions
Retrieves the schema of all collections to explore structure and relationships
Fetches items from a collection for display or searching
Creates new items in collections to add content or records
Updates existing items to modify content or statuses
Removes items from collections to clean up outdated content
Accesses file metadata or content to locate assets
Imports files from URLs to add external media
Updates file metadata for organization and tagging
Gets field definitions for collections to understand data structure
Gets specific field information for detailed configuration
Adds new fields to collections to extend data models
Modifies existing fields including validation and UI options
Lists available automation flows for discovery
Executes automation flows for bulk operations or status changes
Views comments on items to retrieve feedback and discussions
Adds or updates comments to document decisions or feedback
Converts between markdown and HTML for WYSIWYG fields
Lists available prompt templates for reuse
Executes a stored prompt template for consistent interactions