content/guides/11.ai/2.mcp/7.local-mcp/0.index.md
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.
::callout{icon="material-symbols:info" color="warning"} Remote vs Local MCP: Directus v11.12+ now includes a built-in remote MCP server that's easier to set up and doesn't require Node.js. We highly recommend using the newer remote MCP server. The local MCP server remains available as an alternative for users who prefer a local setup or need specific Node.js-based functionality. ::
Consider using the local MCP server if you:
| 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.
::callout{icon="material-symbols:code" color="info" to="https://github.com/directus/mcp"} View the local Directus Content MCP Server repository on GitHub. ::
Before starting, ensure you have:
If you don't have an existing Directus project, you can:
npx directus-template-cli@latest initYou'll need either a static token or your email and password to connect to your Directus instance:
To get a static access token:
Choose your AI tool and follow the setup:
::accordion{type="single"}
:::accordion-item{label="Claude Desktop" icon="i-simple-icons-anthropic"}
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; border-radius: 12px; margin: 1rem 0;"> <iframe src="https://www.youtube.com/embed/mJiLiUGh9r8" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 12px;" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div>{
"mcpServers": {
"directus": {
"command": "npx",
"args": ["@directus/content-mcp@latest"],
"env": {
"DIRECTUS_URL": "https://your-directus-url.com",
"DIRECTUS_TOKEN": "your-directus-token"
}
}
}
}
your-directus-url.com with your Directus URLyour-directus-token with your user token:::
:::accordion-item{label="Cursor" icon="vscode-icons:file-type-cursorrules"}
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; border-radius: 12px; margin: 1rem 0;"> <iframe src="https://www.youtube.com/embed/KmO09zRphnc" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 12px;" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div>.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"
}
}
}
}
:::
:::accordion-item{label="Raycast" icon="i-simple-icons-raycast"}
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; border-radius: 12px; margin: 1rem 0;"> <iframe src="https://www.youtube.com/embed/zeg7AWddcQs" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 12px;" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div>{
"mcpServers": {
"directus": {
"command": "npx",
"args": ["@directus/content-mcp@latest"],
"env": {
"DIRECTUS_URL": "https://your-directus-url.com",
"DIRECTUS_TOKEN": "your-directus-token"
}
}
}
}
@directus to interact with your instanceTip: Add custom instruction: "Make sure you always call the system prompt tool first."
:::
::
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": "[email protected]",
"DIRECTUS_USER_PASSWORD": "your_password"
}
}
}
}
The MCP server includes a default system prompt that helps guide the LLM's behavior. You can:
MCP_SYSTEM_PROMPT variable.MCP_SYSTEM_PROMPT_ENABLED to false.{
"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"
}
}
}
}