Skip to main content
Glama

Directus MCP-Server

Ein Node.js-Server, der das Model Context Protocol (MCP) für Directus CMS implementiert. Ermöglichen Sie KI-Clients die Interaktion mit der Directus-API über das Model Context Protocol (MCP).

ℹ Voraussetzungen

Related MCP server: Directus MCP Server

▶️ Schnellstart

  1. Holen Sie sich Ihre Directus-API-Zugangsdaten

    • Gehen Sie zu Ihrer Directus-Instanz

    • Erstellen Sie ein statisches Zugriffstoken oder verwenden Sie Ihre E-Mail-Adresse und Ihr Passwort

    • Bewahren Sie diese Zugangsdaten sicher auf

  2. Zu Ihrem KI-Editor hinzufügen

    {
      "mcpServers": {
        "directus": {
          "command": "npx",
          "args": ["-y", "@pixelsock/directus-mcp@latest"],
          "env": {
            "DIRECTUS_URL": "https://your-directus-instance.com",
            "DIRECTUS_ACCESS_TOKEN": "YOUR_ACCESS_TOKEN"
          }
        }
      }
    }

    Alternativ können Sie die E-Mail/Passwort-Authentifizierung verwenden:

    {
      "mcpServers": {
        "directus": {
          "command": "npx",
          "args": ["-y", "@pixelsock/directus-mcp@latest"],
          "env": {
            "DIRECTUS_URL": "https://your-directus-instance.com",
            "DIRECTUS_EMAIL": "your-email@example.com",
            "DIRECTUS_PASSWORD": "your-password"
          }
        }
      }
    }

    Für Cursor:

    1. Gehen Sie zu Settings → Cursor Settings → MCP

    2. Klicken Sie auf + Add New Global MCP Server

    3. Fügen Sie die Konfiguration ein

    4. Ersetzen Sie die Platzhalterwerte durch Ihre Directus-Zugangsdaten

    5. Speichern und starten Sie Cursor neu

    Für Claude Desktop:

    1. Öffnen Sie Settings → Developer

    2. Klicken Sie auf Edit Config

    3. Öffnen Sie claude_desktop_config.json in einem Code-Editor und fügen Sie die Konfiguration ein

    4. Ersetzen Sie die Platzhalterwerte durch Ihre Directus-Zugangsdaten

    5. Speichern und starten Sie Claude neu

❓ Fehlerbehebung

Wenn Sie Probleme beim Starten des Servers in Ihrem MCP-Client haben (z. B. Cursor oder Claude Desktop), versuchen Sie bitte Folgendes.

Stellen Sie sicher, dass Sie gültige Directus-Zugangsdaten haben

  1. Überprüfen Sie, ob Ihre Directus-URL korrekt und erreichbar ist

  2. Überprüfen Sie, ob Ihr Zugriffstoken oder Ihre E-Mail/Passwort-Zugangsdaten gültig sind

  3. Ersetzen Sie die Zugangsdaten in Ihrer MCP-Client-Konfiguration

  4. Speichern und starten Sie Ihren MCP-Client neu

Stellen Sie sicher, dass Node und NPM installiert sind

Führen Sie die folgenden Befehle aus, um zu bestätigen, dass Node und NPM installiert sind:

node -v
npm -v

Leeren Sie Ihren NPM-Cache

Manchmal kann das Leeren Ihres NPM-Caches Probleme mit npx lösen.

npm cache clean --force

🛠️ Verfügbare Tools

Sammlungen und Elemente

getItems                // Get items from a collection
getItem                 // Get a single item from a collection by ID
createItem              // Create a new item in a collection
updateItem              // Update an existing item in a collection
deleteItem              // Delete an item from a collection
getCollections          // Get all collection schemas
getFields               // Get fields for a collection
getRelations            // Get relations for a collection

Dateien

getFiles                // Get files from Directus
uploadFile              // Upload a file to Directus

Benutzer und Berechtigungen

login                   // Login to Directus and get an access token
getUsers                // Get users from Directus
getCurrentUser          // Get the current user info
getRoles                // Get roles from Directus
getPermissions          // Get permissions from Directus

System

getSystemInfo           // Get system information from Directus
getActivity             // Get activity logs from Directus
getConfig               // Get current configuration information

🚧 Entwicklungsmodus

Wenn Sie den Server im Entwicklungsmodus ausführen möchten:

  1. Klonen und installieren:

    git clone https://github.com/pixelsock/directus-mcp.git
    cd directus-mcp
    npm install
  2. Fügen Sie Ihre Zugangsdaten zu .env hinzu:

    # .env
    DIRECTUS_URL=https://your-directus-instance.com
    DIRECTUS_ACCESS_TOKEN=your_token_here
    # Or use email/password
    DIRECTUS_EMAIL=your-email@example.com
    DIRECTUS_PASSWORD=your-password
  3. Starten Sie den Entwicklungsserver:

    npm run dev

🌐 HTTP-Transport (Multi-User / Remote-Bereitstellungen)

Standardmäßig verwendet der Server den stdio-Transport, der ideal für lokale KI-Editoren für einzelne Benutzer (Cursor, Claude Desktop usw.) ist.

Für Multi-User- oder Remote-Umgebungen können Sie zum Streamable HTTP-Transport wechseln, indem Sie die Umgebungsvariable MCP_TRANSPORT festlegen.

Konfiguration

Umgebungsvariable

Standard

Beschreibung

MCP_TRANSPORT

stdio

Transportmodus: stdio oder http / streamable-http

MCP_PORT

3000

TCP-Port, auf dem der HTTP-Server lauscht

MCP_HOST

127.0.0.1

Host/Schnittstelle zum Binden. Verwenden Sie 0.0.0.0, um alle Schnittstellen zu binden

Sie können auch --transport=http als CLI-Argument übergeben, anstatt die Umgebungsvariable festzulegen.

Ausführen des HTTP-Servers

# Via environment variable
MCP_TRANSPORT=http MCP_PORT=3000 MCP_HOST=0.0.0.0 node dist/index.js

# Via CLI argument
node dist/index.js --transport=http

Docker-Beispiel

docker run -p 3000:3000 \
  -e DIRECTUS_URL=https://your-directus-instance.com \
  -e DIRECTUS_ACCESS_TOKEN=your_token_here \
  -e MCP_TRANSPORT=http \
  -e MCP_HOST=0.0.0.0 \
  ghcr.io/pixelsock/directus-mcp

Verbinden eines MCP-Clients mit dem HTTP-Server

Sobald der Server läuft, konfigurieren Sie Ihren MCP-Client für die Verbindung mit:

http://<host>:<port>/mcp

Zum Beispiel mit einem Client, der den Streamable HTTP-Transport unterstützt:

{
  "mcpServers": {
    "directus": {
      "url": "http://localhost:3000/mcp"
    }
  }
}

📄 Directus-Entwicklerressourcen

Available Tools

18 tools
createItemC

Create a new item in a collection

Inputs: collection (required), data (required), token, url.

deleteItemC

Delete an item from a collection

Inputs: collection (required), id (required), token, url.

getActivityC

Get activity logs from Directus

Inputs: query, token, url.

getCollectionsC

Get all collection schemas from Directus

Inputs: token, url.

getConfigB

Get current configuration information (without secrets)

Inputs: no named parameters.

getCurrentUserC

Get the current user info

Inputs: token, url.

getFieldsC

Get fields for a collection

Inputs: collection (required), token, url.

getFilesC

Get files from Directus

Inputs: query, token, url.

getItemC

Get a single item from a collection by ID

Inputs: collection (required), id (required), query, token, +1 more.

getItemsC

Get items from a collection in Directus

Inputs: collection (required), query, token, url.

getPermissionsC

Get permissions from Directus

Inputs: query, token, url.

getRelationsC

Get relations for a collection

Inputs: collection, token, url.

getRolesC

Get roles from Directus

Inputs: query, token, url.

getSystemInfoC

Get system information from Directus

Inputs: endpoint (required), token, url.

getUsersC

Get users from Directus

Inputs: query, token, url.

loginC

Login to Directus and get an access token

Inputs: email, password, url.

updateItemC

Update an existing item in a collection

Inputs: collection (required), data (required), id (required), token, +1 more.

uploadFileC

Upload a file to Directus

Inputs: fileName (required), fileData, fileUrl, mimeType, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 18 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose targeting specific resources and actions in the Directus ecosystem. There is no overlap between tools like getItem (single item retrieval), getItems (multiple items), and getCollections (schema information), making misselection unlikely.

    Naming Consistency5/5

    All tools follow a consistent verb_noun naming pattern (e.g., createItem, getItem, updateItem, deleteItem). The pattern is maintained across all 18 tools with no deviations in style or convention.

    Tool Count4/5

    With 18 tools, the count is slightly high but reasonable for a comprehensive CMS/backend server like Directus. It covers core operations without being overwhelming, though it borders on the upper limit of ideal scope.

    Completeness5/5

    The tool set provides complete CRUD coverage for items (create, get, update, delete), along with essential administrative functions (users, roles, permissions, files, activity, config). No obvious gaps exist for the Directus domain, enabling full agent workflows.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An extension that implements the Model Context Protocol for Directus, enabling AI tools and LLMs to interact with Directus content through natural language for content editing, data analysis, and asset management.
      5 npm
      8
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      The official Model Context Protocol server for Skema CMS, enabling AI clients to interact with and manage CMS data. It provides tools for reading, creating, updating, and searching collections and items through natural language.
      11
      9 npm
      MIT