Directus MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
npm install -g directus-mcp-server
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "DIRECTUS_URL=${DIRECTUS_URL}" directus-mcp-server -- node "<FULL_PATH_TO_DIRECTUS_MCP_SERVER>/dist/index.js"

Replace <FULL_PATH_TO_DIRECTUS_MCP_SERVER>/dist/index.js with the actual folder you prepared in step 1.

Required:DIRECTUS_URL+ 4 optional
README.md

Comprehensive management of Directus schema and content for AI assistants.

Directus MCP Server

A Model Context Protocol (MCP) server that provides comprehensive tools for managing Directus schema and content. This server enables AI assistants and other MCP clients to interact with Directus instances programmatically.

Installation

From npm (once published)

npm install -g directus-mcp-server

From source

git clone https://github.com/yourusername/directus-mcp.git
cd directus-mcp
npm install
npm run build

Features

  • Schema Management: Create, read, update, and delete collections, fields, and relations
  • Content Management: Full CRUD operations on items with advanced querying
  • Type Safety: Built with TypeScript and Zod validation
  • Official SDK: Uses the official @directus/sdk for reliable API interactions
  • Flexible Authentication: Supports both static tokens and email/password authentication

Installation

npm install

Configuration

Create a .env file in the root directory with your Directus configuration:

# Directus Instance URL
DIRECTUS_URL=https://your-directus-instance.com

# Authentication - Use either token OR email/password
DIRECTUS_TOKEN=your_static_token_here

# Alternative: Email/Password authentication
# DIRECTUS_EMAIL=admin@example.com
# DIRECTUS_PASSWORD=your_password

Authentication Options

  1. Static Token (Recommended for production):

    • Generate a static token in Directus Admin App
    • Set DIRECTUS_TOKEN environment variable
  2. Email/Password:

    • Use for development or when static tokens aren't available
    • Set DIRECTUS_EMAIL and DIRECTUS_PASSWORD environment variables

Toolset Configuration

The Directus MCP server organizes tools into logical toolsets, similar to GitHub's MCP implementation. This allows you to control which tools are exposed to the MCP client.

Available Toolsets:

  • default - Contains collections, fields, relations, and content tools (default behavior when no toolset is specified)
  • collections - Collection management tools (list, get, create, update, delete collections)
  • fields - Field management tools (list, create, update, delete fields)
  • relations - Relation management tools (list, create, delete relations)
  • schema - Schema snapshot and diff tools (get snapshot, get diff, apply diff) - NOT included in default toolset
  • content - Content management tools (items CRUD operations)
  • flow - Flow management tools (workflow automation) - NOT included in default toolset
  • dashboards - Dashboard and panel management tools (list, get, create, update, delete dashboards and panels) - NOT included in default toolset
  • all - All available tools regardless of toolset membership

Default Behavior: When MCP_TOOLSETS is not set or empty, only tools in the default toolset are exposed. The default toolset contains collections, fields, relations, and content tools, but not schema, flow, or dashboard tools. Schema, flow, and dashboard tools must be explicitly requested by including schema, flow, or dashboards in the MCP_TOOLSETS environment variable.

Configuration: Set the MCP_TOOLSETS environment variable to a comma-separated list of toolsets:

# Expose only collections tools
MCP_TOOLSETS=collections

# Expose only schema snapshot/diff tools
MCP_TOOLSETS=schema

# Expose collections and fields tools
MCP_TOOLSETS=collections,fields

# Expose only dashboard and panel tools
MCP_TOOLSETS=dashboards

# Expose all schema-related toolsets
MCP_TOOLSETS=collections,fields,relations,schema

# Expose all toolsets (includes flow and dashboard tools)
MCP_TOOLSETS=default,flow,dashboards
# OR
MCP_TOOLSETS=collections,fields,relations,schema,content,flow,dashboards
# OR simply use 'all' to expose everything
MCP_TOOLSETS=all

Examples:

{
  "mcpServers": {
    "directus-schema": {
      "command": "node",
      "args": ["/path/to/directus-mcp/dist/index.js"],
      "env": {
        "DIRECTUS_URL": "https://your-directus-instance.com",
        "DIRECTUS_TOKEN": "your_token",
        "MCP_TOOLSETS": "schema"
      }
    },
    "directus-content": {
      "command": "node",
      "args": ["/path/to/directus-mcp/dist/index.js"],
      "env": {
        "DIRECTUS_URL": "https://your-directus-instance.com",
        "DIRECTUS_TOKEN": "your_token",
        "MCP_TOOLSETS": "content"
      }
    }
  }
}

Notes:

  • Toolset names are case-insensitive
  • Invalid toolset names are ignored (with a warning)
  • If all requested toolsets are invalid, the server defaults to the default toolset
  • Collections, fields, relations, and content tools belong to both default and their specific toolset
  • Schema, flow, and dashboard tools belong ONLY to their respective toolsets (not in default)

Building

npm run build

Usage

Running the Server

npm start

Or use the built binary:

node dist/index.js

MCP Client Configuration

Add to your MCP

Tools (7)

collectionsManage collections including list, get, create, update, and delete operations.
fieldsManage fields within collections including list, create, update, and delete operations.
relationsManage relations between collections including list, create, and delete operations.
contentPerform full CRUD operations on items within collections.
schemaManage schema snapshots and diffs.
flowManage workflow automation flows.
dashboardsManage dashboards and panels.

Environment Variables

DIRECTUS_URLrequiredThe URL of your Directus instance
DIRECTUS_TOKENStatic token for authentication
DIRECTUS_EMAILEmail for email/password authentication
DIRECTUS_PASSWORDPassword for email/password authentication
MCP_TOOLSETSComma-separated list of toolsets to expose (e.g., collections,schema,content)

Configuration

claude_desktop_config.json
{
  "mcpServers": {
    "directus": {
      "command": "node",
      "args": ["/path/to/directus-mcp/dist/index.js"],
      "env": {
        "DIRECTUS_URL": "https://your-directus-instance.com",
        "DIRECTUS_TOKEN": "your_token"
      }
    }
  }
}

Try it

List all collections currently defined in my Directus instance.
Create a new collection named 'projects' with fields for title and description.
Fetch the first 10 items from the 'blog_posts' collection.
Update the status field of the item with ID 123 in the 'tasks' collection to 'completed'.
Generate a schema snapshot of the current Directus instance.

Frequently Asked Questions

What are the key features of Directus MCP Server?

Comprehensive schema management for collections, fields, and relations. Full CRUD operations for content items with advanced querying. Support for schema snapshots and diffing. Workflow automation management via Flow tools. Dashboard and panel management capabilities.

What can I use Directus MCP Server for?

Automating database schema migrations and updates via AI. Programmatically managing content entries in a headless CMS. Generating and applying schema snapshots for environment synchronization. Managing complex dashboard configurations for internal admin panels.

How do I install Directus MCP Server?

Install Directus MCP Server by running: npm install -g directus-mcp-server

What MCP clients work with Directus MCP Server?

Directus MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Directus MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare