content/guides/11.ai/2.mcp/7.local-mcp/2.prompts.md
The local MCP server supports the same prompt functionality as the remote MCP server, but requires manual configuration through environment variables and collection setup.
::callout{icon="material-symbols:info" color="info"} Client Support: Not all AI clients support prompts. Check the MCP clients compatibility matrix for your specific client. ::
::callout{icon="material-symbols:lightbulb" color="primary"} For detailed information about creating prompts, templating, examples, and best practices, see the main Prompts guide. This page covers only the local MCP-specific 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 |
Create the prompts collection manually in your Directus instance:
ai_prompts (or customize)| 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 |
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.
Ensure your MCP user has appropriate permissions:
For detailed examples on using prompts, templating syntax, and best practices, refer to the main Prompts documentation.
If you upgrade to Directus v11.12+ and want to switch to the remote MCP:
Since the remote MCP can use your existing prompts collection, there's no data migration required.