Installation
The local MCP server is a standalone Node.js application that provides an alternative way to connect AI tools to your Directus instance using the Model Context Protocol.
When to Use Local MCP
Consider using the local MCP server if you:
- Need to run MCP in local environments without internet access to your Directus instance
- Prefer Node.js-based tooling and local development workflows
- Want to customize or extend the MCP server functionality
- Are working with older Directus versions that don't support the remote MCP
- Need to run MCP operations through a proxy or custom network setup
Comparison with Remote MCP
Feature | Remote MCP | Local MCP |
---|---|---|
Setup Complexity | Simple (built into Directus) | Requires Node.js installation |
Node.js Requirement | None | Node.js v22.12+ |
Configuration | UI-based settings | Environment variables |
Updates | Automatic with Directus | Manual npm updates |
Customization | Limited to settings | Full source code access |
Network Requirements | Direct Directus access | Can work through proxies |
This guide will cover how to set up and use the local MCP server as an alternative to the built-in remote option.
Prerequisites
Before starting, ensure you have:
- Node.js v22.12 or newer installed on your computer
- An existing Directus project with access credentials
- One of the supported MCP clients: Claude Desktop, Cursor, or Raycast
If you don't have an existing Directus project, you can:
- Start a free trial on Directus Cloud
- Create a local instance with
npx directus-template-cli@latest init
Get Directus Credentials
You'll need either a static token or your email and password to connect to your Directus instance:
To get a static access token:
- Log in to your Directus instance.
- Navigate to the User Directory and select your user profile.
- Scroll down to the Token field.
- Generate a token and copy it.
- Save the user (do not forget this step).
Installation
Choose your AI tool and follow the setup:
- Download Claude Desktop
- Open Settings → Developer → Edit Config
- Add this configuration:
{
"mcpServers": {
"directus": {
"command": "npx",
"args": ["@directus/content-mcp@latest"],
"env": {
"DIRECTUS_URL": "https://your-directus-url.com",
"DIRECTUS_TOKEN": "your-directus-token"
}
}
}
}
- Replace
your-directus-url.com
with your Directus URL - Replace
your-directus-token
with your user token - Restart Claude Desktop
- Download Cursor
- Create
.cursor/mcp.json
in your project root:
{
"mcpServers": {
"directus": {
"command": "npx",
"args": ["@directus/content-mcp@latest"],
"env": {
"DIRECTUS_URL": "https://your-directus-url.com",
"DIRECTUS_TOKEN": "your-directus-token"
}
}
}
}
- Replace URLs and tokens
- Verify connection in Settings → MCP
- Download Raycast
- Search "MCP Servers" → "Install Server"
- Paste configuration:
{
"mcpServers": {
"directus": {
"command": "npx",
"args": ["@directus/content-mcp@latest"],
"env": {
"DIRECTUS_URL": "https://your-directus-url.com",
"DIRECTUS_TOKEN": "your-directus-token"
}
}
}
}
- Press ⌘ + Enter to install
- Use
@directus
to interact with your instance
Tip: Add custom instruction: "Make sure you always call the system prompt tool first."
Using Email/Password Authentication
If you prefer using email and password instead of a token, use this configuration format for any of the platforms:
{
"mcpServers": {
"directus": {
"command": "npx",
"args": ["@directus/content-mcp@latest"],
"env": {
"DIRECTUS_URL": "https://your-directus-url.com",
"DIRECTUS_USER_EMAIL": "user@example.com",
"DIRECTUS_USER_PASSWORD": "your_password"
}
}
}
}
Advanced Configuration
System Prompt
The MCP server includes a default system prompt that helps guide the LLM's behavior. You can:
- Override it by setting the
MCP_SYSTEM_PROMPT
variable. - Disable it by setting
MCP_SYSTEM_PROMPT_ENABLED
tofalse
.
Example: Advanced Configuration
{
"mcpServers": {
"directus": {
"command": "npx",
"args": ["@directus/content-mcp@latest"],
"env": {
"DIRECTUS_URL": "https://your-directus-instance.com",
"DIRECTUS_TOKEN": "your_directus_token",
"DISABLE_TOOLS": ["delete-item", "update-field"],
"MCP_SYSTEM_PROMPT_ENABLED": "true",
"MCP_SYSTEM_PROMPT": "You are an assistant specialized in managing content for our marketing website.",
"DIRECTUS_PROMPTS_COLLECTION_ENABLED": "true",
"DIRECTUS_PROMPTS_COLLECTION": "ai_prompts",
"DIRECTUS_PROMPTS_NAME_FIELD": "name",
"DIRECTUS_PROMPTS_DESCRIPTION_FIELD": "description",
"DIRECTUS_PROMPTS_SYSTEM_PROMPT_FIELD": "system_prompt",
"DIRECTUS_PROMPTS_MESSAGES_FIELD": "messages"
}
}
}
}
Get once-a-month release notes & real‑world code tips...no fluff. 🐰