Directus MCP server

Bridges AI tools with Directus headless CMS, enabling content operations through automatically generated tools based on your instance's schema
Back to servers
Provider
Rijk van Zanten
Release date
Apr 01, 2025
Language
TypeScript
Package
Stats
481 downloads
26 stars

This MCP server for Directus allows your AI tools to connect to and utilize your Directus API on your behalf, creating a bridge between AI capabilities and your Directus-managed content.

Installation

This MCP server requires NodeJS v22.12 or newer.

Global Installation (Recommended)

Install the package globally using npm:

npm install -g @rijk/directus-mcp-server

Then configure Claude AI to use the npm package as a remote server by adding the following to your configuration:

{
  "mcpServers": {
    "directus": {
      "command": "directus-mcp-server",
      "env": {
        "DIRECTUS_URL": "<your Directus instance URL>",
        "DIRECTUS_TOKEN": "<your Directus user token>"
      }
    }
  }
}

Local Installation

If you prefer a local installation:

  1. Clone the repository
  2. Install dependencies and build the server:
pnpm install && pnpm build
  1. Configure Claude AI to use the local build:
{
  "mcpServers": {
    "directus": {
      "command": "node",
      "args": ["/path/to/directus-mcp-server/dist/index.js"]
    }
  }
}

Available Tools

Reading Collections

Before working with content, you'll want to discover what collections are available in your Directus instance. Use the Read Collections tool to return information about available collections and fields.

This tool takes no parameters and will return the structure of your Directus schema.

Reading Items

The Read Items tool allows you to fetch content from any Directus collection.

Parameters:

  • collection: (required) The name of the collection to read from
  • fields: (optional) Array of field names to return
  • sort: (optional) Field to sort by (prefix with - for descending order)
  • limit: (optional) Maximum number of items to return

Example usage:

{
  "collection": "articles",
  "fields": ["id", "title", "date_published"],
  "sort": "-date_published",
  "limit": 10
}

This would retrieve the 10 most recently published articles, returning only their ID, title, and publication date.

Reading Current User

The Read Current User tool provides information about the authenticated user account. This is equivalent to calling the /users/me endpoint in the Directus API.

This tool takes no parameters and will return details about the user associated with the provided token.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later