Local MCP

Prompts

Configure stored prompts with the local MCP server using environment variables and manual collection setup.

The local MCP server supports the same prompt functionality as the remote MCP server, but requires manual configuration through environment variables and collection setup.

Client Support: Not all AI clients support prompts. Check the MCP clients compatibility matrix for your specific client.
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.

Setup Differences

The local MCP server requires manual configuration where the remote MCP provides UI-based setup:

AspectRemote MCPLocal MCP
Collection CreationAuto-generated through settingsManual creation required
ConfigurationAdmin UI settingsEnvironment variables
Field SetupAutomaticManual field configuration

Collection Setup

Create the prompts collection manually in your Directus instance:

  1. Log in to your Directus admin
  2. Navigate to Settings → Data Model
  3. Click Create Collection
  4. Name it ai_prompts (or customize)
  5. Add these required fields:
Field NameField TypeInterfacePurpose
nameStringInputPrompt identifier
descriptionTextInput MultilinePrompt description
system_promptTextInput MultilineAI system context
messagesJSONInput JSONMessage 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:

  1. Navigate to Settings → Roles & Permissions
  2. Find your prompts collection
  3. 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:

  1. Enable remote MCP in Directus settings (Settings → AI → Model Context Protocol)
  2. Select your existing collection in the AI Prompts Collection dropdown - no need to create a new one
  3. 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. 🐰