Official Directus MCP Server

Super excited to introduce the official Directus MCP server to our community.

Now you can easily interact with your Directus data inside your favorite AI tools like Claude Desktop, Cursor, or Raycast.

Some good use cases to get started with:

  • Automate page building and publishing content from Google Docs.
  • Leverage AI to analyze your data to generate insights and reports using natural language.
  • Automatic asset organization so no more folders full of image.png

Get Started :rocket:

To learn more and get started with the Directus Content MCP server,
→ Check out the Installation Guide

Claude Desktop Installation

Links :link:


Can’t wait to see what you all build with it. :sign_of_the_horns: Definitely share your workflows here.

If you have questions, comments, ideas and feedback, please feel free to reply right here.


Make sure you don’t miss our live demo and workshop this week.

4 Likes

I did everything in the video but the mcp server did not start in claude desktop?
Are there any extra instructions missing? Example, setting up the mcp repo provided on github locally, I’ve done my best to follow the instructions but still. I just want to be able to create new reusable blocks in directus and my svelte site, why is this so difficult to do.

Hi there :waving_hand: and welcome to the community!

Do you have node installed?
Have you double checked your configuration?

Can you provide the specific errors you received?

1 Like

Is it possible to create flow with it ?

No, not currently. We’re reviewing this and other “admin” oriented tools in a future release.

You can view the available tools here.

1 Like

This is super cool, but I’d love to use it with n8n. Is there any way to do that at this time? Wire up the Directus MCP Server to an n8n MCP Client?

I ported this to a Directus endpoint extension using HTTP Streaming to allow hosting the MCP server directly with your Directus instance and connect to it with a URL: GitHub - JoshTheDerf/directus-extension-mcp

@bryantgillespie At least since the last vs-code update i could convince copilot to pickup the MCP server as tool. You may want to add vs-code to the docs. It’s basically same as cursor anyways.

1 Like

Thanks for letting us know. We’ll add that to the docs.

1 Like

Hello,

I followed the steps and when I reopen the Claude I get this error.

'Error: spawn npx ENOENT

In case you stumble upon the authentication error “Could not attach to MCP server directus”, this is how i fixed it. I had to create a small sh wrapper file “directus-mcp-wrapper.sh” with the following content:

#!/bin/zsh
export PATH="/Users/your-user-name/.nvm/versions/node/v22.14.0/bin:$PATH"
export SHELL="/bin/zsh"
exec /Users/your-user-name/.nvm/versions/node/v22.14.0/bin/npx @directus/content-mcp@latest "$@"

and in the Claude Desktop config file i added this:

{
    "mcpServers": {
        "directus": {
            "command": "/Users/your-user-name/directus-mcp-wrapper.sh",
            "env": {
                "DIRECTUS_URL": "http://localhost:8055",
                "DIRECTUS_TOKEN": "YOUR_DIRECTUS_ADMIN_TOKEN"
            }
        }
    }
}

I’m on mac by the way.

2 Likes

The MCP server for Claude Desktop is fantastic considering it’s such an early version.

However, I don’t really understand the messages field in the ai_prompts. When I select a prompt, the system prompt is shown as a .txt attachment (which is fine).

But how is the messages field supposed to work. It’s explained in the help documents, but I can’t get anything from messages into the prompt field in Claude Desktop (and I also can’t see how it would even know about the dynamic values).

The messages functionality in the AI Prompts functionality is there to help you shape the results you want even further. For example, use the role function and provide examples of questions or tasks that you might give it. And then provide an example of a “good” response.

Here’s a silly example.

{
		"name": "dad-joke",
		"status": "draft",
		"description": "Get great dad jokes from LLMs.",
		"system_prompt": "You are a dad joke telling machine, but you don't tell just the average dad jokes. You tell the best dad jokes in a narrative format.",
		"messages": [
			{
				"role": "user",
				"text": "Tell me an amazing dad joke"
			},
			{
				"role": "assistant",
				"text": "My neighbor had a big plan to steal the **propane** tank for my grill, but it didn't work. I guess you could say it **blew up** in his face."
			}
		]
	}

Hi guys, I case anyone needs the config example to connect Directus MCP in PHPStorm/JetBrains Copilot extension mcps:

{
  "servers": {
    "directus": {
      "type": "http",
      "url": "https://your-domain.com/mcp",
      "requestInit": {
        "headers": {
          "Authorization": "Bearer YOUR_MCP_USER_TOKEN"
        }
      }
    }
  }
}

its was the requestInit part that killed my evening… hope it helps. @ core-team would be cool to add that to the public docs (when time allows :slight_smile: )

1 Like

Oof yeah that’s an odd one. Do you have the link to the appropriate spot in their documentation? We can certainly add it our docs for other JetBrains users.

Here is the “master”: Installing the GitHub Copilot extension in your environment - GitHub Docs

And inside JetBrains IDEs: File | Settings | Tools | GitHub Copilot | Model Context Protocol (MCP)

Then click Configure to open the IDE’s mcp.json and add the project config (below) to the servers object:

{
  "servers": {
    <---here--->
  }
}

So that your file looks like this (if you have only one server :slight_smile: )

{
  "servers": {
    "directus": {
      "type": "http",
      "url": "https://your-domain.com/mcp",
      "requestInit": {
        "headers": {
          "Authorization": "Bearer YOUR_MCP_USER_TOKEN"
        }
      }
    }
  }
}

Found a “good” one: Agent mode and MCP support for Copilot in JetBrains, Eclipse, and Xcode now in public preview - GitHub Changelog

Hey all. I’ve just enabled the MCP server in our directus instance and connected it to Claude desktop, and it’s kinda working but paaaaaiiinfully slow.

I haven’t even tried doing anything complicated yet, just asking it to read some basic things from various collections, and prompts are often hanging for several minutes at a time or failing with errors like “No result received from client-side tool execution.” or “Invalid payload. Validation error: Invalid input: expected array” or “Invalid payload. Cannot provide a core collection.”.

I’ve given claude’s directus user read-only access to all collections (including all system collections). Has anyone else managed to get it working a bit better?

I’m on Directus 11.12.0, self-hosted.

Hey there, thanks for writing in!

One thing I’ve noticed personally over the last 3-4 weeks is it seems like Anthropic’s Claude chat client - both Claude Desktop and Claude AI in the browser - seem a bit slower compared to what I was previously experiencing 2-3 months ago. I don’t have any benchmarks on this and it’s just my own observation. I’ve not really observed the speed issues when using Sonnet through other clients like Cursor.

It is important to note that the MCP server is a little context-heavy at the moment because of the way that we load all the tool descriptions on startup. There’s a lot of nuance that goes into properly creating collections, fields, relations and flows – and the LLM needs to know about that to work effectively.

But we’re working to make it a little friendlier on the context window in the future.

One thing I would encourage you to do is if you’re not using certain tools, just turn them off at the connector level so that you don’t have to load those into the context window every time you start a conversation.

If you have a lot of other services or (MCP servers) custom connecters active at the same time as well, that could also potentially cause performance issues.

And lastly, if you’re willing, I would love to see some of the specific errors. Please don’t share here publicly in the community, but if you’re able to share some of those conversations where the errors have occurred through the sharing mechanism within Claude, I would love to review those. You can send me a private DM here in the community or you can submit to marketing@directus.io.

The more data points or examples we have, the easier it becomes to try and solve any issues.