# 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.

<callout color="info" icon="i-lucide-info">

**Client Support**: Not all AI clients support prompts. Check the [MCP clients compatibility matrix](https://modelcontextprotocol.io/clients) for your specific client.

</callout>

<callout color="primary" icon="i-lucide-lightbulb">

For detailed information about creating prompts, templating, examples, and best practices, see the main [Prompts guide](/guides/ai/mcp/prompts). This page covers only the local MCP-specific setup differences.

</callout>

## Setup Differences

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

<table>
<thead>
  <tr>
    <th>
      Aspect
    </th>
    
    <th>
      Remote MCP
    </th>
    
    <th>
      Local MCP
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Collection Creation
      </strong>
    </td>
    
    <td>
      Auto-generated through settings
    </td>
    
    <td>
      Manual creation required
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Configuration
      </strong>
    </td>
    
    <td>
      Admin UI settings
    </td>
    
    <td>
      Environment variables
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Field Setup
      </strong>
    </td>
    
    <td>
      Automatic
    </td>
    
    <td>
      Manual field configuration
    </td>
  </tr>
</tbody>
</table>

## 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:

<table>
<thead>
  <tr>
    <th>
      Field Name
    </th>
    
    <th>
      Field Type
    </th>
    
    <th>
      Interface
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      Input
    </td>
    
    <td>
      Prompt identifier
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        description
      </code>
    </td>
    
    <td>
      Text
    </td>
    
    <td>
      Input Multiline
    </td>
    
    <td>
      Prompt description
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        system_prompt
      </code>
    </td>
    
    <td>
      Text
    </td>
    
    <td>
      Input Multiline
    </td>
    
    <td>
      AI system context
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        messages
      </code>
    </td>
    
    <td>
      JSON
    </td>
    
    <td>
      Input JSON
    </td>
    
    <td>
      Message templates
    </td>
  </tr>
</tbody>
</table>

## Environment Configuration

Configure your local MCP server with these environment variables:

```json
{
  "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](/guides/ai/mcp/prompts).

## 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.
