Installation

Set up the Directus MCP server and connect your AI tools in under 5 minutes.

Get AI assistants connected to your Directus instance in three simple steps. The MCP server is built into Directus with no additional setup required.

MCP requires Directus v11.12+. For older versions, use the Local MCP alternative.

Quick Setup

The Directus MCP server is disabled by default and must be manually enabled. When enabled, it uses the same permissions as the user account you connect with. AI tools can only access what that user is allowed to see and do.

System administrators can completely disable MCP functionality through configuration environment variables.

Choose a Tool Mode

Tool definitions include names, descriptions, and input schemas. When an MCP client loads every definition into the model prompt, those definitions consume context before the model receives your conversation, data, or tool results. This cost grows as you connect more MCP servers.

Directus supports two tool modes so you can choose where tool discovery happens:

ModeTool discoveryUse it when
DefaultYour MCP client selects from the individual Directus toolsYour client searches or loads tools on demand, or you want per-tool approval controls
RegistryDirectus exposes a small registry that the model searchesYour client loads every tool definition upfront, has a tool-count limit, or spends too much context on unused tools
Use one discovery layer. Prefer the default mode when your client already provides tool search or deferred loading. Otherwise, use registry mode to protect the model's context window.

Default Mode

The default MCP URL exposes each Directus tool separately to the client:

https://your-directus-url.com/mcp

Prefer this mode when your client provides its own tool search or deferred loading. The client can keep unused schemas out of the model context while preserving the names, descriptions, annotations, and approval settings of individual Directus tools.

For example, Claude Code enables MCP Tool Search by default on supported models, and current versions of Cursor dynamically load the MCP tools they need. Custom clients using supported OpenAI models can also opt into tool search. In these cases, registry mode usually duplicates work the client already performs.

Some clients use tool search only after reaching a threshold. For example, VS Code's experimental virtual tools setting only activates above a default threshold of 128 tools. Registry mode can still reduce upfront context below that threshold.

Client-side search can also depend on the client version, selected model, model provider, proxy, or settings. Use registry mode if your client falls back to loading every tool upfront.

Registry Mode

Registry mode exposes only search, execute, and schema to the client. The model searches for the right Directus tool, loads only its input details, then calls it through execute.

https://your-directus-url.com/mcp?tool_mode=registry

Use registry mode when your client sends all available tool definitions to the model, does not support tool search, or fails because too many tools are enabled. It keeps the initial Directus tool surface fixed at three tools regardless of how many tools Directus provides.

This smaller initial surface leaves more of the context window for your instructions, conversation history, Directus schema, and results. It can also make tool selection easier by removing unrelated definitions from the model's immediate choices.

Registry mode has two trade-offs:

  • The model normally makes extra search calls before execute, which can add latency and tool-call overhead.
  • The MCP client shows most operations as execute, with the underlying Directus tool nested in its input. Tool pickers, call history, approval rules, and allow lists cannot treat items, files, collections, or other inner tools separately.

Authentication, Directus permissions, admin-only restrictions, and the Allow Deletes setting work the same in both modes. When using a static token in the URL, combine the parameters like this:

https://your-directus-url.com/mcp?tool_mode=registry&access_token=your-generated-token
Do not automatically approve execute. It can run both read and write operations, and the client cannot apply the underlying tool's individual approval policy. Use scoped Directus permissions and keep the Allow Deletes setting disabled unless you need it.

Choose an Authentication Method

Directus supports two ways to authenticate remote MCP clients. Use OAuth when your client supports remote server OAuth discovery and browser authorization. Use a static access token when your client requires a manually configured bearer token, header, or query parameter.

Enable MCP in Directus

  1. Log into your Directus admin as an administrator
  2. Go to Settings → AI → Model Context Protocol
  3. Click Enabled under MCP Server to activate the MCP server MCP Server Enabled
  4. Save the AI settings
Most users can keep the default settings. The MCP server is now ready at https://your-directus-url.com/mcp.

Configure Authentication

OAuth lets users sign in to Directus in the browser and approve MCP access from a consent page. The issued token is scoped to the MCP endpoint.

For self-hosted projects, enable the OAuth server and a client registration method. Prefer Client ID Metadata Document registration when your client supports it because it avoids unauthenticated local client creation:

.env
MCP_OAUTH_ENABLED=true
MCP_OAUTH_CIMD_ENABLED=true
PUBLIC_URL=https://directus.example.com

Use MCP_OAUTH_CIMD_ENABLED=true for Client ID Metadata Document registration, MCP_OAUTH_DCR_ENABLED=true for Dynamic Client Registration, or both if you intentionally support both onboarding paths.

After restarting Directus, go to Settings > AI > Model Context Protocol, enable OAuth Enabled, and enable the matching client registration setting for the project.

MCP OAuth settings with OAuth, Dynamic Client Registration, and Client ID Metadata Document enabled

Read the MCP OAuth guide for the full authorization flow, client registration behavior, and revocation steps.

Fallback: Static Access Token

Static access tokens work with clients that do not support MCP OAuth. Use a dedicated Directus user when possible.

  1. Navigate to User Directory.
  2. Click Create User.
  3. Configure the user:
    • Name: Your Name - MCP User or similar
    • Email: Email is not required for MCP operations.
    • Role: Create a new role or use an existing role with appropriate permissions.
  4. Open the user profile.
  5. Scroll to the Token field and generate a new token.
  6. Copy the token, then save the user. ::
Avoid using your personal admin account for AI operations. If you must use an existing user, open that user profile, generate a token from the Token field, copy it, and save the user.

Connect Your AI Client

You control the LLM integration. This tool connects to your own language model - either self-hosted or via a public service like OpenAI, Anthropic, or others.

If your client supports MCP OAuth, connect to https://your-directus-url.com/mcp without adding an access token to the URL or headers. Use Client ID Metadata Document registration when your client supports it. Use Dynamic Client Registration when the client requires it.

::

Verify Connection

Once connected, test your setup with a simple question about your Directus instance:

:::chat

chatId: "verify-connection" messages:

  • role: user content: "Can you tell me about my Directus schema?"
  • role: assistant content: "I'll help you explore your Directus schema. Let me start by getting my role information and then examine your database structure." toolInvocations:
    • toolCallId: "system-prompt" toolName: "system-prompt" state: "result"
    • toolCallId: "schema" toolName: "schema" state: "result"

:::

User Permissions

Configure your AI user's role based on what you want them to do:

Content Editor Role (recommended for most users):

  • Collections: Read/Create/Update on your content collections
  • Files: Read/Create/Update/Delete
  • Folders: Read/Create/Update/Delete
  • System Collections: Read only

Developer Role (required for schema management):

  • All content permissions above, plus:
  • Collections: Full CRUD access
  • Fields: Full CRUD access
  • Relations: Full CRUD access
  • Flows: Full CRUD access

or add the administrator role to your MCP user.

Note: The MCP server uses your existing permissions and access policy settings. AI tools can only access what you explicitly allow - just like any other Directus user. See Access Control for more information.

MCP Server Settings

MCP Server Settings

Access advanced options in Settings → AI → Model Context Protocol:

SettingTypeDefaultDescription
MCP ServerToggleDisabledConnect AI/LLM tools to your Directus project via Model Context Protocol (MCP). This enables AI assistants to read and interact with your Directus data securely.
Allow DeletesToggleDisabledEnable deletion of items, files, flows, fields, relations, and collections through MCP tools. WARNING: May cause data loss. Disabled by default for safety.
AI Prompts CollectionSelectNo collection selectedSelect a collection to enable reusable prompt templates. Select existing collection or click "Generate AI Prompts collection..." to create one automatically.
Use System PromptToggleEnabledUse the default system prompt to guide LLM behavior. Disable to remove or override with your own prompt below.
Custom System PromptRich TextEmptyCustom system prompt to replace the default. Leave empty to use default (if enabled above).

Next Steps

Your MCP server is ready! Here's what to explore:

See What's Possible

Real examples of AI-powered content workflows that save hours of manual work.

Available Tools

Complete reference of MCP tools and their capabilities.

Custom Prompts

Create reusable prompt templates for consistent AI interactions.

Security Guide

Essential security practices for using MCP safely with your Directus data.

Troubleshooting

Common issues and solutions when setting up and using the Directus MCP server.

Get once-a-month release notes & real‑world code tips...no fluff. 🐰