
Directus Mcp Server
io.github.staminnaPublished by GitHub account staminnav12.4.0Updated Nov 4, 2026
MCP server for Directus 12 — items, collections, files, flows, users, and schema tools
Overview
MCP server for Directus 12 that lets an assistant manage collections, items, schema, flows, files and users in a Directus instance.
- What you can do
- List, inspect, create and delete collections, and read, create, update, delete or bulk-edit items
- Create, update and delete fields and relationships, analyze and validate schemas, snapshot, diff and apply schema changes
- List, create, update, delete and manually trigger automation flows and inspect their operations
- List users and files, and import CSV or JSON data into one or more collections
- Run diagnostics on collection access and cache, and search the available tools by task description
- When to use it
- Useful when you work with a Directus 12 backend and want an assistant to explore its data model, edit content, adjust schema or manage flows without leaving the chat client. Best for developers or content teams already running Directus who can issue a scoped token.
- Requirements
- Runs locally over stdio, typically via npx or a built Node.js install. Requires DIRECTUS_URL for the instance and a static Directus access token in DIRECTUS_TOKEN, generated under User Settings in Directus. Optional variables cover prompts/resources features, timeouts, retries, logging and TLS client certificates. Network access to the Directus instance is needed.
Installation
In SourceWeft
- Open Directus Mcp Server in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
@staminna/directus-mcp-server
MCP server for Directus 12 — items, collections, files, flows, users, and schema tools. TypeScript, typed throughout.
[npm version] [License: MIT] [CI] [mcp-server-claude MCP server]
[mcp-server-claude MCP server]
Test Coverage
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
Installation
Via npm (Recommended)
From Source
Environment Variables
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.
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:
Or if installed locally:
- 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:
Or if installed locally:
- 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.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
-
Create or edit the config file:
Or if installed locally:
- 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:
Note: Claude.ai MCP support may require a Pro subscription and specific browser extensions.
Available Tools
Collection Management
Schema & Fields
Flow Management
User Management
File Management
Diagnostics
Discovery
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:
Since Directus 12.4.0 a query resolves its targets under the token's read
permissions: read access to the primary key is required, and only items the
token can read are deleted. A token that can delete but not read deletes
nothing.
Usage Examples
Once configured, you can interact with Directus through your AI assistant:
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
Testing
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.
Live 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.
Credentials 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
Source: README.md at commit db58dcd
Tools
0Version history
2- v12.4.0LatestSep 30, 2026
- v12.3.2Sep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts