MCP Server

Installation

The Directus Content MCP Server allows you to interact with your Directus data through AI tools using the Model Context Protocol.

The local MCP server is a standalone Node.js application that provides an alternative way to connect AI tools to your Directus instance using the Model Context Protocol.

Remote vs Local MCP: Directus v11.12+ now includes a built-in remote MCP server that's easier to set up and doesn't require Node.js. We highly recommend using the newer remote MCP server. The local MCP server remains available as an alternative for users who prefer a local setup or need specific Node.js-based functionality.

When to Use Local MCP

Consider using the local MCP server if you:

  • Need to run MCP in local environments without internet access to your Directus instance
  • Prefer Node.js-based tooling and local development workflows
  • Want to customize or extend the MCP server functionality
  • Are working with older Directus versions that don't support the remote MCP
  • Need to run MCP operations through a proxy or custom network setup

Comparison with Remote MCP

FeatureRemote MCPLocal MCP
Setup ComplexitySimple (built into Directus)Requires Node.js installation
Node.js RequirementNoneNode.js v22.12+
ConfigurationUI-based settingsEnvironment variables
UpdatesAutomatic with DirectusManual npm updates
CustomizationLimited to settingsFull source code access
Network RequirementsDirect Directus accessCan work through proxies

This guide will cover how to set up and use the local MCP server as an alternative to the built-in remote option.

View the local Directus Content MCP Server repository on GitHub.

Prerequisites

Before starting, ensure you have:

  • Node.js v22.12 or newer installed on your computer
  • An existing Directus project with access credentials
  • One of the supported MCP clients: Claude Desktop, Cursor, or Raycast

If you don't have an existing Directus project, you can:

  • Start a free trial on Directus Cloud
  • Create a local instance with npx directus-template-cli@latest init

Get Directus Credentials

You'll need either a static token or your email and password to connect to your Directus instance:

To get a static access token:

  1. Log in to your Directus instance.
  2. Navigate to the User Directory and select your user profile.
  3. Scroll down to the Token field.
  4. Generate a token and copy it.
  5. Save the user (do not forget this step).

Installation

Choose your AI tool and follow the setup:

Using Email/Password Authentication

If you prefer using email and password instead of a token, use this configuration format for any of the platforms:

{
    "mcpServers": {
        "directus": {
            "command": "npx",
            "args": ["@directus/content-mcp@latest"],
            "env": {
                "DIRECTUS_URL": "https://your-directus-url.com",
                "DIRECTUS_USER_EMAIL": "user@example.com",
                "DIRECTUS_USER_PASSWORD": "your_password"
            }
        }
    }
}

Advanced Configuration

System Prompt

The MCP server includes a default system prompt that helps guide the LLM's behavior. You can:

  • Override it by setting the MCP_SYSTEM_PROMPT variable.
  • Disable it by setting MCP_SYSTEM_PROMPT_ENABLED to false.

Example: Advanced Configuration

{
    "mcpServers": {
        "directus": {
            "command": "npx",
            "args": ["@directus/content-mcp@latest"],
            "env": {
                "DIRECTUS_URL": "https://your-directus-instance.com",
                "DIRECTUS_TOKEN": "your_directus_token",
                "DISABLE_TOOLS": ["delete-item", "update-field"],
                "MCP_SYSTEM_PROMPT_ENABLED": "true",
                "MCP_SYSTEM_PROMPT": "You are an assistant specialized in managing content for our marketing website.",
                "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"
            }
        }
    }
}

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