The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Directus MCP Server listing page.
MCP server for Directus 12 — items, collections, files, flows, users, and schema tools. TypeScript, typed throughout.
| 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.
| Variable | Required | Description |
|---|---|---|
DIRECTUS_URL | Yes | Your Directus instance URL (e.g., http://localhost:8065) |
DIRECTUS_TOKEN | Yes | Static API token with appropriate permissions |
DIRECTUS_PROMPTS_COLLECTION_ENABLED | No | Enable AI prompts collection (true/false) |
DIRECTUS_PROMPTS_COLLECTION | No | Collection name for AI prompts (default: ai_prompts) |
DIRECTUS_RESOURCES_ENABLED | No | Enable resources feature (true/false) |
DIRECTUS_RESOURCES_EXCLUDE_SYSTEM | No | Exclude system collections from resources (true/false) |
NODE_ENV | No | Environment mode (development/production) |
DIRECTUS_TIMEOUT | No | Request timeout in ms (default: 30000) |
DIRECTUS_RETRIES | No | Retry attempts for network errors, 5xx and 429 (default: 3) |
DIRECTUS_RETRY_DELAY | No | Base backoff delay in ms (default: 1000) |
DIRECTUS_MAX_RETRY_DELAY | No | Backoff ceiling in ms (default: 10000) |
DIRECTUS_IMPORT_MAX_FILE_SIZE | No | Client-side import size ceiling in bytes, mirroring the Directus IMPORT_MAX_FILE_SIZE (default: 50 MB) |
LOG_LEVEL | No | DEBUG/INFO/WARN/ERROR (default: INFO). Logs go to stderr; stdout is reserved for MCP |
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 |
|---|---|
DIRECTUS_HTTPS_CA | Certificate authority |
DIRECTUS_HTTPS_CERT | Client certificate |
DIRECTUS_HTTPS_KEY | Client private key |
DIRECTUS_HTTPS_PFX | PKCS#12 bundle (alternative to cert/key) |
DIRECTUS_HTTPS_PASSPHRASE | Passphrase for the key or PFX |
DIRECTUS_HTTPS_REJECT_UNAUTHORIZED | false to accept self-signed certificates |
DIRECTUS_HTTPS_SERVERNAME | SNI server name override |
This server uses a static Directus access token (DIRECTUS_TOKEN) and runs over stdio transport. OAuth is not required, by design:
DIRECTUS_V12_BREAKING_CHANGES.md).Generate the token in Directus under User Settings → Token (use a dedicated user with least-privilege role for production).
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).
Cmd+, (macOS) or Ctrl+, (Windows/Linux)Or if installed locally:
Cmd+, (macOS) or Ctrl+, (Windows/Linux)Or if installed locally:
Cmd+Q or Ctrl+Q)Locate your Claude Desktop config file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonCreate or edit the config file:
Or if installed locally:
For Claude.ai web interface with MCP support:
Note: Claude.ai MCP support may require a Pro subscription and specific browser extensions.
| Tool | Description |
|---|---|
list_collections | List all collections in Directus |
get_collection_schema | Get schema for a specific collection |
get_collection_items | Get items from a collection with filtering |
create_collection | Create a new collection |
delete_collection | Delete a collection (requires confirm) |
create_item | Create a new item in a collection |
update_item | Update an existing item, optionally into a draft version |
delete_items | Delete items by ids or by query (see note below) |
bulk_operations | Execute bulk create, update, delete |
| Tool | Description |
|---|---|
create_field | Create a new field in a collection |
update_field | Update an existing field |
delete_field | Delete a field from a collection |
create_relationship | Create relationships (O2O, O2M, M2O, M2M, M2A) |
analyze_collection_schema | Analyze schema with relationship mapping |
validate_collection_schema | Validate schema and relationships |
analyze_relationships | Analyze relationships across collections |
get_schema_snapshot | Read a full or partial snapshot of the data model |
diff_schema | Compare a snapshot against the live schema (merge or mirror). Directus drops request bodies over ~96 KB, so pass a partial snapshot from get_schema_snapshot with include_collections on any sizeable data model — see DIRECTUS_V12_BREAKING_CHANGES.md |
apply_schema | Apply a diff (requires confirm) |
| Tool | Description |
|---|---|
get_flows | Get all flows with optional filtering |
get_flow | Get a specific flow by ID |
create_flow | Create a new automation flow |
update_flow | Update an existing flow |
delete_flow | Delete a flow |
trigger_flow | Manually trigger a flow |
get_operations | Get flow operations |
| Tool | Description |
|---|---|
get_users | Get all users with filtering |
get_user | Get a specific user by ID |
| Tool | Description |
|---|---|
get_files | Get files with filtering and pagination |
import_data | Import CSV/JSON into one collection, or several at once |
| Tool | Description |
|---|---|
diagnose_collection_access | Diagnose collection access issues |
refresh_collection_cache | Refresh collection cache |
validate_collection_creation | Validate newly created collections |
| Tool | Description |
|---|---|
search_tools | Find the tools matching a task description |
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.
Following Directus 12.3.0, delete_items never falls back to deleting
everything:
ids: [...] deletes those items.query: {...} deletes everything the query matches.To delete every item in a collection, ask for it explicitly:
Once configured, you can interact with Directus through your AI assistant:
Ensure your Directus token has the required permissions:
If using a remote Directus instance:
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.
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.
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)MIT © Jorge Domingues Nunes