Directus MCP Server
An MCP server for managing a Directus 12 instance through natural language and direct tool calls — covering items, collections, schema, files, flows, and users.
Collections & items: list/get/create/delete collections; read/create/update/delete items with filters, sorting, pagination, content versions, and bulk operations.
Schema & fields: create/update/delete fields, create relationships (O2O/O2M/M2O/M2M/M2A), analyze/validate schemas, and snapshot/diff/apply schema changes.
Flows: list/read/create/update/delete flows, trigger flows manually, and inspect flow operations.
Users & files: list and read users, and list files.
Import: import CSV/JSON into one collection or multiple related collections, with dry-run and merge/add modes.
Diagnostics & discovery: diagnose collection access/permissions, refresh caches, validate collection creation, and search available tools by task description.
Safety: tools are annotated read-only or destructive, and destructive actions require confirmation (delete collection/items, apply schema, imports, etc.).
Provides comprehensive tools for interacting with Directus instances, including collection and item CRUD operations, schema management, relationship creation, flow automation, user management, file operations, and diagnostics capabilities.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Directus MCP Servershow me the latest 5 blog posts from the articles collection"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@staminna/directus-mcp-server
MCP server for Directus 12 — items, collections, files, flows, users, and schema tools. TypeScript, typed throughout.
Test Coverage
Statements | Branches | Functions | Lines |
Coverage badges are generated from coverage/coverage-summary.json by npm run badges (no external service required). Run npm run test:coverage first.
Features
🔐 Full Authentication - Token-based authentication with Directus
📦 Collection Management - CRUD operations for collections and items
📁 File Operations - Upload, download, and manage files
🔄 Flow Management - Create, update, trigger, and manage Directus Flows
👥 User Management - User CRUD and role management
🔍 Schema Tools - Analyze and validate collection schemas
🩺 Diagnostics - Collection access diagnostics and troubleshooting
Related MCP server: Storyblok MCP Server
Installation
Via npm (Recommended)
npm install -g @staminna/directus-mcp-serverFrom Source
git clone https://github.com/staminna/mcp-server-claude.git
cd mcp-server-claude
npm install
npm run buildEnvironment Variables
Variable | Required | Description |
| Yes | Your Directus instance URL (e.g., |
| Yes | Static API token with appropriate permissions |
| No | Enable AI prompts collection ( |
| No | Collection name for AI prompts (default: |
| No | Enable resources feature ( |
| No | Exclude system collections from resources ( |
| No | Environment mode ( |
| No | Request timeout in ms (default: |
| No | Retry attempts for network errors, 5xx and 429 (default: |
| No | Base backoff delay in ms (default: |
| No | Backoff ceiling in ms (default: |
| No | Client-side import size ceiling in bytes, mirroring the Directus |
| No |
|
TLS / client certificates
Set these when the Directus instance uses a private CA or requires a client
certificate. Each of CA/CERT/KEY/PFX accepts either a file path or the
PEM/DER content itself.
Variable | Description |
| Certificate authority |
| Client certificate |
| Client private key |
| PKCS#12 bundle (alternative to cert/key) |
| Passphrase for the key or PFX |
|
|
| SNI server name override |
Authentication — no OAuth required
This server uses a static Directus access token (DIRECTUS_TOKEN) and runs over stdio transport. OAuth is not required, by design:
The MCP specification only defines OAuth 2.1 authorization for HTTP-based transports. For stdio servers the spec says implementations "SHOULD NOT" use it and should instead retrieve credentials from the environment — exactly what this server does.
Directus 12 fully supports static access tokens. The OAuth 2.1 support Directus added (mid-2026) applies to its own built-in remote MCP endpoint and is optional; there are no breaking changes to token authentication in Directus 12 (see
DIRECTUS_V12_BREAKING_CHANGES.md).OAuth only becomes relevant if you expose an MCP server remotely over HTTP (Streamable HTTP/SSE). As a local stdio subprocess of Claude Desktop, Claude Code, Cursor, etc., this server needs only the env token.
Generate the token in Directus under User Settings → Token (use a dedicated user with least-privilege role for production).
Using with a Claude subscription (Max/Pro) — no API key needed
MCP servers do not consume Anthropic API tokens themselves; only the AI client's model calls do. If you use this server inside Claude Code or Claude Desktop with a Claude Max (or Pro) subscription, the model usage is covered by the subscription — you do not need an Anthropic API key. An API key is only required when driving Claude programmatically via the Claude API (e.g. the remote MCP connector).
IDE Configuration
🟣 Cursor
Open Cursor Settings:
Cmd+,(macOS) orCtrl+,(Windows/Linux)Search for "MCP" or navigate to Features → MCP Servers
Click "Edit in settings.json"
Add the following configuration:
{
"mcpServers": {
"directus": {
"command": "npx",
"args": [
"-y",
"@staminna/directus-mcp-server"
],
"env": {
"DIRECTUS_URL": "http://localhost:8065",
"DIRECTUS_TOKEN": "your-directus-token-here"
}
}
}
}Or if installed locally:
{
"mcpServers": {
"directus": {
"command": "node",
"args": [
"/path/to/mcp-server-claude/dist/index.js"
],
"env": {
"DIRECTUS_URL": "http://localhost:8065",
"DIRECTUS_TOKEN": "your-directus-token-here"
}
}
}
}Save the file and restart Cursor
🌊 Windsurf
Open Windsurf Settings:
Cmd+,(macOS) orCtrl+,(Windows/Linux)Search for "MCP Servers"
Click "Edit in settings.json"
Add the following configuration:
{
"mcpServers": {
"directus": {
"command": "npx",
"args": [
"-y",
"@staminna/directus-mcp-server"
],
"env": {
"DIRECTUS_URL": "http://localhost:8065",
"DIRECTUS_TOKEN": "your-directus-token-here",
"DIRECTUS_PROMPTS_COLLECTION_ENABLED": "true",
"DIRECTUS_PROMPTS_COLLECTION": "ai_prompts",
"DIRECTUS_RESOURCES_ENABLED": "true",
"DIRECTUS_RESOURCES_EXCLUDE_SYSTEM": "true",
"NODE_ENV": "production"
}
}
}
}Or if installed locally:
{
"mcpServers": {
"directus": {
"command": "node",
"args": [
"/path/to/mcp-server-claude/dist/index.js"
],
"env": {
"DIRECTUS_URL": "http://localhost:8065",
"DIRECTUS_TOKEN": "your-directus-token-here"
}
}
}
}Save the file
Quit Windsurf completely (
Cmd+QorCtrl+Q)Reopen Windsurf and wait ~10 seconds for MCP to initialize
🤖 Claude Desktop
Locate your Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Create or edit the config file:
{
"mcpServers": {
"directus": {
"command": "npx",
"args": [
"-y",
"@staminna/directus-mcp-server"
],
"env": {
"DIRECTUS_URL": "http://localhost:8065",
"DIRECTUS_TOKEN": "your-directus-token-here"
}
}
}
}Or if installed locally:
{
"mcpServers": {
"directus": {
"command": "node",
"args": [
"/path/to/mcp-server-claude/dist/index.js"
],
"env": {
"DIRECTUS_URL": "http://localhost:8065",
"DIRECTUS_TOKEN": "your-directus-token-here"
}
}
}
}Save the file and restart Claude Desktop
🔮 Claude.ai (Web with MCP)
For Claude.ai web interface with MCP support:
Navigate to Claude.ai settings
Find the MCP configuration section
Add a new MCP server with:
{
"name": "directus",
"command": "npx",
"args": ["-y", "@staminna/directus-mcp-server"],
"env": {
"DIRECTUS_URL": "http://localhost:8065",
"DIRECTUS_TOKEN": "your-directus-token-here"
}
}Note: Claude.ai MCP support may require a Pro subscription and specific browser extensions.
Available Tools
Collection Management
Tool | Description |
| List all collections in Directus |
| Get schema for a specific collection |
| Get items from a collection with filtering |
| Create a new collection |
| Delete a collection (requires |
| Create a new item in a collection |
| Update an existing item, optionally into a draft |
| Delete items by |
| Execute bulk create, update, delete |
Schema & Fields
Tool | Description |
| Create a new field in a collection |
| Update an existing field |
| Delete a field from a collection |
| Create relationships (O2O, O2M, M2O, M2M, M2A) |
| Analyze schema with relationship mapping |
| Validate schema and relationships |
| Analyze relationships across collections |
| Read a full or partial snapshot of the data model |
| Compare a snapshot against the live schema ( |
| Apply a diff (requires |
Flow Management
Tool | Description |
| Get all flows with optional filtering |
| Get a specific flow by ID |
| Create a new automation flow |
| Update an existing flow |
| Delete a flow |
| Manually trigger a flow |
| Get flow operations |
User Management
Tool | Description |
| Get all users with filtering |
| Get a specific user by ID |
File Management
Tool | Description |
| Get files with filtering and pagination |
| Import CSV/JSON into one collection, or several at once |
Diagnostics
Tool | Description |
| Diagnose collection access issues |
| Refresh collection cache |
| Validate newly created collections |
Discovery
Tool | Description |
| Find the tools matching a task description |
Tool safety annotations
Every tool carries MCP annotations so a client can tell reads from writes before
calling: 17 are readOnlyHint: true, 6 are explicitly destructiveHint: false
(additive — creates), and 11 are destructiveHint: true (deletes, overwriting
updates, apply_schema, import_data, trigger_flow).
Note that destructiveHint defaults to true in the MCP spec, which is why
the additive tools set it to false rather than omitting it.
Deleting items safely
Following Directus 12.3.0, delete_items never falls back to deleting
everything:
ids: [...]deletes those items.query: {...}deletes everything the query matches.Passing both is rejected.
Passing neither deletes nothing and issues no request.
To delete every item in a collection, ask for it explicitly:
{ "collection": "articles", "query": { "limit": -1 }, "confirm": true }Usage Examples
Once configured, you can interact with Directus through your AI assistant:
"List all collections in my Directus instance"
"Create a new collection called 'blog_posts' with title, content, and published fields"
"Get all items from the 'products' collection where status is 'published'"
"Create a new flow that triggers on item creation in the 'orders' collection"
"Analyze the schema of the 'users' collection including relationships"Troubleshooting
MCP Server Not Connecting
Verify Directus is running: Ensure your Directus instance is accessible at the configured URL
Check token permissions: The API token needs appropriate permissions for the operations you want to perform
Restart IDE: After changing MCP configuration, fully restart your IDE
Check logs: Look for MCP-related errors in your IDE's developer console
Permission Errors
Ensure your Directus token has the required permissions:
Admin token for full access
Or configure specific role permissions for collections you need to access
Connection Timeout
If using a remote Directus instance:
Verify the URL is correct and accessible
Check firewall/network settings
Ensure CORS is properly configured on Directus
Development
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run dev
# Run server
npm start
# Type check
npm run typecheck
# Lint
npm run lintTesting
The project ships unit, integration and end-to-end suites (vitest). Coverage thresholds (95% statements/lines/functions/branches) are enforced — the test run fails below them.
# Unit + integration tests
npm test
# With coverage report (coverage/ — text, html, lcov, json-summary)
npm run test:coverage
# End-to-end: builds, then spawns the real server over stdio against a mock Directus
npm run test:e2e
# Everything
npm run test:all
# Refresh the README coverage badges from the last coverage run
npm run badgesLive verification against a real Directus
tests/live/demo.mjs drives all 34 tools against a real instance over stdio. It is
deliberately outside npm test — it needs a credential and a reachable server, so it
is a manual gate rather than a CI one.
# Read-only + guard phases (touches nothing)
ENV_FILE=.env.mdbaudio npm run test:live
# Also create, mutate and drop a scratch mcp_demo_<stamp> collection
ENV_FILE=.env.mdbaudio npm run test:live -- --write
# Additionally exercise apply_schema, confined to that scratch collection
ENV_FILE=.env.mdbaudio npm run test:live -- --write --apply-schemaCredentials are read from ENV_FILE (default .env.mdbaudio) so they never pass through
shell history. Results are reported per tool as pass / refused-by-instance / fail, keeping
"this server is broken" separate from "this instance declined". --apply-schema diffs in
merge mode, which yields a strictly additive diff, so it can only re-create the scratch
collection — it cannot drop anything that already existed. Cleanup runs even when an
earlier phase fails.
The e2e suite uses the official MCP SDK client (StdioClientTransport) to spawn dist/index.js as a subprocess, talking to an in-process mock Directus on an ephemeral port — no real Directus instance or network access needed.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
License
MIT © Jorge Domingues Nunes
Links
Maintenance
Related MCP Servers
- FlicenseBqualityFmaintenanceA Node.js server that enables AI Clients to interact with the Directus CMS API through the Model Context Protocol, allowing for management of collections, items, files, users, and system information.1824
- FlicenseNot gradedqualityNot gradedmaintenanceEnables comprehensive management of Storyblok CMS through natural language interactions. Supports story creation and publishing, asset management, component schema updates, release workflows, and content discovery across all major Storyblok APIs.10
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact directly with Strapi v5 CMS content through full CRUD operations, media uploads, and content type exploration using Strapi's Document Service API.2011MIT
- AlicenseAqualityCmaintenanceEnables comprehensive management of Directus instances through tools for schema manipulation, content CRUD operations, and dashboard management. It allows AI assistants to programmatically interact with collections, fields, relations, and workflow automation using the official Directus SDK.2040MIT
Related MCP Connectors
Manage Appwrite projects, databases, auth, storage, functions, and messaging; search Appwrite docs
AI-powered design and management for Webflow Sites
Manage SRG+ hubs, channels, content, assets, users, and workspaces from any MCP-aware AI agent.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/staminna/mcp-server-claude'
If you have feedback or need assistance with the MCP directory API, please join our Discord server