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.
This MCP server requires NodeJS v22.12 or newer.
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>"
}
}
}
}
If you prefer a local installation:
pnpm install && pnpm build
{
"mcpServers": {
"directus": {
"command": "node",
"args": ["/path/to/directus-mcp-server/dist/index.js"]
}
}
}
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.
The Read Items tool allows you to fetch content from any Directus collection.
Parameters:
collection
: (required) The name of the collection to read fromfields
: (optional) Array of field names to returnsort
: (optional) Field to sort by (prefix with -
for descending order)limit
: (optional) Maximum number of items to returnExample 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.
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.
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.
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"
]
}
}
}
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.
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.