Skip to content
Back to search

mcp

The Directus Content MCP Server is an interface for Directus users to interact with their data in LLMs.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/directus--mcp/badge.svg)](/listings/directus--mcp)

HTML

<a href="/listings/directus--mcp"><img src="/api/listings/directus--mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Prerequisites

- An existing Directus project

If you don't have an existing Directus project, you can get started with a free trial on [Directus Cloud](https://directus.cloud/register) at https://directus.cloud/register

OR

You can spin up a sample Directus instance locally with the following terminal command.

npx directus-template-cli@latest init

Step 1. Get Directus Credentials

You can use email and password or generate a static token to connect the MCP to your Directus instance.

To get a static access token:

1. Login to your Directus instnace 2. Go to the User Directory and choose your own user profile 3. Scroll down to the Token field 4. Generate token and copy it 5. Save the user (do NOT forget to save because you’ll get an error that shows Invalid token!)

Step 2. Configure the MCP in your AI Tool

Claude Desktop

1. Open [Claude Desktop](https://claude.ai/download) and navigate to Settings.

2. Under the Developer tab, click Edit Config to open the configuration file.

3. Add the following configuration:

   {
   	"mcpServers": {
   		"directus": {
   			"command": "npx",
   			"args": ["@directus/content-mcp@latest"],
   			"env": {
   				"DIRECTUS_URL": "https://your-directus-url.com",
   				"DIRECTUS_TOKEN": "your-directus-token>"
   			}
   		}
   	}
   }

or if you're using email and password

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

Make sure you replace the placeholder values with your URL and credentials.

4. Save the configuration file and restart Claude desktop.

5. From the new chat screen, you should see an icon appear with the Directus MCP server.

Cursor

1. Open [Cursor](https://docs.cursor.com/context/model-context-protocol) and create a .cursor directory in your project root if it doesn't exist.

2. Create a `.cursor/mcp.json` file if it doesn't exist and open it.

3. Add the following configuration:

   {
   	"mcpServers": {
   		"directus": {
   			"command": "npx",
   			"args": ["@directus/content-mcp@latest"],
   			"env": {
   				"DIRECTUS_URL": "https://your-directus-url.com",
   				"DIRECTUS_TOKEN": "your-directus-token>"
   			}
   		}
   	}
   }

or if you're using email and password

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

Make sure you replace the placeholder values with your URL and credentials.

4. Save the configuration file.

5. Open Cursor and navigate to Settings/MCP. You should see a green active status after the server is successfully connected.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

readme.md · README · 320 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Directus Content MCP Server
  2. The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) is a standard for helping AI tools and
  3. LLMs talk to applications and services like Directus.
  4. The Directus Content MCP Server is an interface for Directus users to interact with their data in LLMs. Some good use
  5. cases are:
  6. - **Content Editors**: build custom pages, write blog posts, update content, organize assets and more inside your
  7. Directus project.
  8. - **Data Analysts**: query collections, generate reports, analyze trends, and extract insights from your Directus data
  9. using natural language.
  10. It intentionally limits destructive actions that would result in really bad outcomes like data loss from deleting fields
  11. or deleting collections.
  12. We plan to provide more tools for developers who are working with local / development Directus projects in future
  13. releases and potentially as a separate package to help further prevent data loss.
  14. ## Installation
  15. ### Prerequisites
  16. - An existing Directus project
  17. If you don't have an existing Directus project, you can get started with a free trial on
  18. [Directus Cloud](https://directus.cloud/register) at https://directus.cloud/register
  19. OR
  20. You can spin up a sample Directus instance locally with the following terminal command.
  21. ```
  22. npx directus-template-cli@latest init
  23. ```
  24. ### Step 1. Get Directus Credentials
  25. You can use email and password or generate a static token to connect the MCP to your Directus instance.
  26. To get a static access token:
  27. 1. Login to your Directus instnace
  28. 2. Go to the User Directory and choose your own user profile
  29. 3. Scroll down to the Token field
  30. 4. Generate token and copy it
  31. 5. Save the user (do NOT forget to save because you’ll get an error that shows Invalid token!)
  32. ### Step 2. Configure the MCP in your AI Tool
  33. #### Claude Desktop
  34. 1. Open [Claude Desktop](https://claude.ai/download) and navigate to Settings.
  35. 2. Under the Developer tab, click Edit Config to open the configuration file.
  36. 3. Add the following configuration:
  37. ```json
  38. {
  39. "mcpServers": {
  40. "directus": {
  41. "command": "npx",
  42. "args": ["@directus/content-mcp@latest"],
  43. "env": {
  44. "DIRECTUS_URL": "https://your-directus-url.com",
  45. "DIRECTUS_TOKEN": "your-directus-token>"
  46. }
  47. }
  48. }
  49. }
  50. ```
  51. or if you're using email and password
  52. ```json
  53. {
  54. "mcpServers": {
  55. "directus": {
  56. "command": "npx",
  57. "args": ["@directus/content-mcp@latest"],
  58. "env": {
  59. "DIRECTUS_URL": "https://your-directus-url.com",
  60. "DIRECTUS_USER_EMAIL": "john@example.com",
  61. "DIRECTUS_USER_PASSWORD": "your-password"
  62. }
  63. }
  64. }
  65. }
  66. ```
  67. Make sure you replace the placeholder values with your URL and credentials.
  68. 4. Save the configuration file and restart Claude desktop.
  69. 5. From the new chat screen, you should see an icon appear with the Directus MCP server.
  70. #### Cursor
  71. 1. Open [Cursor](https://docs.cursor.com/context/model-context-protocol) and create a .cursor directory in your project
  72. root if it doesn't exist.
  73. 2. Create a `.cursor/mcp.json` file if it doesn't exist and open it.
  74. 3. Add the following configuration:
  75. ```json
  76. {
  77. "mcpServers": {
  78. "directus": {
  79. "command": "npx",
  80. "args": ["@directus/content-mcp@latest"],
  81. "env": {
  82. "DIRECTUS_URL": "https://your-directus-url.com",
  83. "DIRECTUS_TOKEN": "your-directus-token>"
  84. }
  85. }
  86. }
  87. }
  88. ```
  89. or if you're using email and password
  90. ```json
  91. {
  92. "mcpServers": {
  93. "directus": {
  94. "command": "npx",
  95. "args": ["@directus/content-mcp@latest"],
  96. "env": {
  97. "DIRECTUS_URL": "https://your-directus-url.com",
  98. "DIRECTUS_USER_EMAIL": "john@example.com",
  99. "DIRECTUS_USER_PASSWORD": "your-password"
  100. }
  101. }
  102. }
  103. }
  104. ```
  105. Make sure you replace the placeholder values with your URL and credentials.
  106. 4. Save the configuration file.
  107. 5. Open Cursor and navigate to Settings/MCP. You should see a green active status after the server is successfully
  108. connected.
  109. ## Tools
  110. The MCP Server provides the following tools to interact with your Directus instance:
  111. | Tool | Description | Use Cases |
  112. | -------------------- | ---------------------------------------------------- | -------------------------------------------------------------- |
  113. | **system-prompt** | Provides context to the LLM assistant about its role | Start of a session to understand the system context |
  114. | **users-me** | Get current user information | Understanding permissions, personalizing responses |
  115. | **read-collections** | Retrieve the schema of all collections | Exploring database structure, understanding relationships |
  116. | **read-items** | Fetch items from any collection | Retrieving content, searching for data, displaying information |
  117. | **create-item** | Create new items in collections | Adding new content, records, or entries |
  118. | **update-item** | Modify existing items | Editing content, updating statuses, correcting information |
  119. | **delete-item** | Remove items from collections | Cleaning up outdated content |
  120. | **read-files** | Access file metadata or raw content | Finding images, documents, or media assets |
  121. | **import-file** | Import files from URLs | Adding external media to your Directus instance |
  122. | **update-files** | Update file metadata | Organizing media, adding descriptions, tagging |
  123. | **read-fields** | Get field definitions for collections | Understanding data structure, field types and validation |
  124. | **read-field** | Get specific field information | Detailed field configuration |
  125. | **create-field** | Add new fields to collections | Extending data models |
  126. | **update-field** | Modify existing fields | Changing field configuration, interface options |
  127. | **read-flows** | List available automation flows | Finding automation opportunities |
  128. | **trigger-flow** | Execute automation flows | Bulk operations, publishing, status changes |
  129. | **read-comments** | View comments on items | Retrieving feedback, viewing discussion threads |
  130. | **upsert-comment** | Add or update comments | Providing feedback, documenting decisions |
  131. | **markdown-tool** | Convert between markdown and HTML | Content formatting for WYSIWYG fields |
  132. | **get-prompts** | List available prompts | Discovering pre-configured prompt templates |
  133. | **get-prompt** | Execute a stored prompt | Using prompt templates for consistent AI interactions |
  134. ### System Prompt
  135. The MCP server comes with a system prompt that helps encourage the right tool use and provides guiderails for the LLM.
  136. You can overwrite the default system prompt in your env configuration by setting the `MCP_SYSTEM_PROMPT` variable.
  137. You can also disable the system prompt entirely if desired.
  138. Just set `MCP_SYSTEM_PROMPT_ENABLED` to `false`
  139. ### Prompt Configuration
  140. The MCP server supports dynamic prompts stored in a Directus collection. Prompts are not widely supported across MCP
  141. Clients, but Claude Desktop does have support for them.
  142. You can configure the following:
  143. - `DIRECTUS_PROMPTS_COLLECTION_ENABLED`: Set to "true" to enable prompt functionality
  144. - `DIRECTUS_PROMPTS_COLLECTION`: The name of the collection containing prompts
  145. - `DIRECTUS_PROMPTS_NAME_FIELD`: Field name for the prompt name (default: "name")
  146. - `DIRECTUS_PROMPTS_DESCRIPTION_FIELD`: Field name for the prompt description (default: "description")
  147. - `DIRECTUS_PROMPTS_SYSTEM_PROMPT_FIELD`: Field name for the system prompt text (default: "system_prompt")
  148. - `DIRECTUS_PROMPTS_MESSAGES_FIELD`: Field name for the messages array (default: "messages")
  149. ### Mustache Templating
  150. Both system prompts and message content support mustache templating using the `{{ variable_name }}` syntax:
  151. 1. Define variables in your prompts using double curly braces: `Hello, {{ name }}!`
  152. 2. When calling a prompt, provide values for the variables in the `arguments` parameter
  153. 3. The MCP server will automatically replace all variables with their provided values
  154. ## Local / Dev Installation
  155. 1. Clone the repo
  156. 2. `pnpm install && pnpm build` to build the server
  157. 3. Configure Claude Desktop or Cursor like above, but pointing it to the `dist` file instead:
  158. 4. Use `pnpm dev` to watch for changes and rebuild the server
  159. ```json
  160. {
  161. "mcpServers": {
  162. "directus": {
  163. "command": "node",
  164. "args": ["/path/to/directus-mcp-server/dist/index.js"]
  165. }
  166. }
  167. }
  168. ```
  169. Sample Claude Desktop Config for local dev with full settings
  170. ```json
  171. {
  172. "mcpServers": {
  173. "directus": {
  174. "command": "node",
  175. "args": [
  176. "/path/to/directus-mcp-server/dist/index.js"
  177. ],
  178. "env": {
  179. "DIRECTUS_URL": "DIRECTUS_URL",
  180. "DIRECTUS_TOKEN": "DIRECTUS_TOKEN",
  181. "MCP_SYSTEM_PROMPT_ENABLED": "true",
  182. "MCP_SYSTEM_PROMPT": "You're a content editor working at Directus.\nYou're a master at copywriting and creating messaging that resonates with technical audiences.\nYou'll be given details about a Directus instance and the schema within it. You'll be asked to update content and other helpful tasks. **Rules** \n - If you're updating HTML / WYSWIG fields inside the CMS - DO NOT ADD extra styling, classes, or markup outside the standard HTML elements. If you're not 95% sure what values should go into a certain field, stop and ask the user. Before deleting anything, confirm with the user and prompt them for an explicit DELETE confirmation via text.",
  183. "DIRECTUS_PROMPTS_COLLECTION_ENABLED": "true",
  184. "DIRECTUS_PROMPTS_COLLECTION": "ai_prompts"
  185. }
  186. }
  187. }
  188. }
  189. ```
  190. ### Example Configurations
  191. #### Basic Configuration with Token
  192. ```json
  193. {
  194. "mcpServers": {
  195. "directus": {
  196. "command": "npx",
  197. "args": ["@directus/content-mcp@latest"],
  198. "env": {
  199. "DIRECTUS_URL": "https://your-directus-instance.com",
  200. "DIRECTUS_TOKEN": "your_directus_token"
  201. }
  202. }
  203. }
  204. }
  205. ```
  206. #### Configuration with Email/Password Authentication
  207. ```json
  208. {
  209. "mcpServers": {
  210. "directus": {
  211. "command": "npx",
  212. "args": ["@directus/content-mcp@latest"],
  213. "env": {
  214. "DIRECTUS_URL": "https://your-directus-instance.com",
  215. "DIRECTUS_USER_EMAIL": "user@example.com",
  216. "DIRECTUS_USER_PASSWORD": "your_password"
  217. }
  218. }
  219. }
  220. }
  221. ```
  222. #### Advanced Configuration with Custom System Prompt and Tool Restrictions
  223. ```json
  224. {
  225. "mcpServers": {
  226. "directus": {
  227. "command": "npx",
  228. "args": ["@directus/content-mcp@latest"],
  229. "env": {
  230. "DIRECTUS_URL": "https://your-directus-instance.com",
  231. "DIRECTUS_TOKEN": "your_directus_token",
  232. "DISABLE_TOOLS": ["delete-item", "update-field"],
  233. "MCP_SYSTEM_PROMPT_ENABLED": "true",
  234. "MCP_SYSTEM_PROMPT": "You are an assistant specialized in managing content for our marketing website.",
  235. "DIRECTUS_PROMPTS_COLLECTION_ENABLED": "true",
  236. "DIRECTUS_PROMPTS_COLLECTION": "ai_prompts",
  237. "DIRECTUS_PROMPTS_NAME_FIELD": "name",
  238. "DIRECTUS_PROMPTS_DESCRIPTION_FIELD": "description",
  239. "DIRECTUS_PROMPTS_SYSTEM_PROMPT_FIELD": "system_prompt",
  240. "DIRECTUS_PROMPTS_MESSAGES_FIELD": "messages"
  241. }
  242. }
  243. }
  244. }
  245. ```
  246. # ❤️ Contributing
  247. We love to see community contributions, but please open an issue first to discuss proposed changes before submitting any
  248. PRs.
  249. ## 🙏 Thanks To
  250. This started as an experiment by the dude, the legend, the [@rijkvanzanten](https://github.com/rijkvanzanten) 🙌
  251. ## License
  252. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.