Prompts
The local MCP server supports the same prompt functionality as the remote MCP server, but requires manual configuration through environment variables and collection setup.
Setup Differences
The local MCP server requires manual configuration where the remote MCP provides UI-based setup:
Aspect | Remote MCP | Local MCP |
---|---|---|
Collection Creation | Auto-generated through settings | Manual creation required |
Configuration | Admin UI settings | Environment variables |
Field Setup | Automatic | Manual field configuration |
Collection Setup
Create the prompts collection manually in your Directus instance:
- Log in to your Directus admin
- Navigate to Settings → Data Model
- Click Create Collection
- Name it
ai_prompts
(or customize) - Add these required fields:
Field Name | Field Type | Interface | Purpose |
---|---|---|---|
name | String | Input | Prompt identifier |
description | Text | Input Multiline | Prompt description |
system_prompt | Text | Input Multiline | AI system context |
messages | JSON | Input JSON | Message templates |
Environment Configuration
Configure your local MCP server with these environment variables:
{
"mcpServers": {
"directus": {
"command": "npx",
"args": ["@directus/content-mcp@latest"],
"env": {
"DIRECTUS_URL": "https://your-directus-instance.com",
"DIRECTUS_TOKEN": "your_directus_token",
"DIRECTUS_PROMPTS_COLLECTION_ENABLED": "true",
"DIRECTUS_PROMPTS_COLLECTION": "ai_prompts",
"DIRECTUS_PROMPTS_NAME_FIELD": "name",
"DIRECTUS_PROMPTS_DESCRIPTION_FIELD": "description",
"DIRECTUS_PROMPTS_SYSTEM_PROMPT_FIELD": "system_prompt",
"DIRECTUS_PROMPTS_MESSAGES_FIELD": "messages"
}
}
}
}
Field Mapping: If you used different field names in your collection, update the corresponding environment variables.
Permissions
Ensure your MCP user has appropriate permissions:
- Navigate to Settings → Roles & Permissions
- Find your prompts collection
- Enable permissions:
- Read: Access existing prompts
- Create: Allow AI to create new prompts
- Update: Allow AI to modify prompts
Using Prompts
For detailed examples on using prompts, templating syntax, and best practices, refer to the main Prompts documentation.
Migration from Local to Remote
If you upgrade to Directus v11.12+ and want to switch to the remote MCP:
- Enable remote MCP in Directus settings (Settings → AI → Model Context Protocol)
- Select your existing collection in the AI Prompts Collection dropdown - no need to create a new one
- Update client configuration to use the remote MCP endpoint instead of the local server
Since the remote MCP can use your existing prompts collection, there's no data migration required.
Get once-a-month release notes & real‑world code tips...no fluff. 🐰