Skip to main content
Glama

Directus MCP Server

by pixelsock

Directus MCP 服务器

一个为 Directus CMS 实现模型上下文协议 (MCP) 的 Node.js 服务器。允许 AI 客户端通过模型上下文协议 (MCP) 与Directus API进行交互。

ℹ 先决条件

▶️ 快速入门

  1. 获取您的 Directus API 凭证
    • 转到您的 Directus 实例
    • 创建静态访问令牌或获取您的电子邮件和密码
    • 确保这些凭证的安全
  2. 添加到您的 AI 编辑器
    { "mcpServers": { "directus": { "command": "npx", "args": ["-y", "@pixelsock/directus-mcp@latest"], "env": { "DIRECTUS_URL": "https://your-directus-instance.com", "DIRECTUS_ACCESS_TOKEN": "YOUR_ACCESS_TOKEN" } } } }
    或者,您可以使用电子邮件/密码验证:
    { "mcpServers": { "directus": { "command": "npx", "args": ["-y", "@pixelsock/directus-mcp@latest"], "env": { "DIRECTUS_URL": "https://your-directus-instance.com", "DIRECTUS_EMAIL": "your-email@example.com", "DIRECTUS_PASSWORD": "your-password" } } } }
    对于光标:
    1. 前往“设置”→“光标设置”→“MCP”
    2. 点击+ Add New Global MCP Server
    3. 粘贴配置
    4. 使用您的 Directus 凭证替换占位符值
    5. 保存并重新启动Cursor

    对于 Claude 桌面:

    1. 打开“设置”→“开发者”
    2. 单击Edit Config
    3. 在代码编辑器中打开claude_desktop_config.json并粘贴配置
    4. 使用您的 Directus 凭证替换占位符值
    5. 保存并重新启动Claude

❓ 故障排除

如果您在 MCP 客户端(例如 Cursor 或 Claude Desktop)中启动服务器时遇到问题,请尝试以下操作。

确保您拥有有效的 Directus 凭证

  1. 验证您的 Directus URL 是否正确且可访问
  2. 检查您的访问令牌或电子邮件/密码凭证是否有效
  3. 替换 MCP 客户端配置中的凭据
  4. 保存并重启MCP 客户端

确保已安装 Node 和 NPM

运行以下命令确认您已安装 Node 和 NPM:

node -v npm -v

清除 NPM 缓存

有时清除NPM 缓存可以解决npx的问题。

npm cache clean --force

🛠️ 可用工具

收藏品和物品

getItems // Get items from a collection getItem // Get a single item from a collection by ID createItem // Create a new item in a collection updateItem // Update an existing item in a collection deleteItem // Delete an item from a collection getCollections // Get all collection schemas getFields // Get fields for a collection getRelations // Get relations for a collection

文件

getFiles // Get files from Directus uploadFile // Upload a file to Directus

用户和权限

login // Login to Directus and get an access token getUsers // Get users from Directus getCurrentUser // Get the current user info getRoles // Get roles from Directus getPermissions // Get permissions from Directus

系统

getSystemInfo // Get system information from Directus getActivity // Get activity logs from Directus getConfig // Get current configuration information

🚧 开发模式

如果您想以开发模式运行服务器:

  1. 克隆并安装:
    git clone https://github.com/pixelsock/directus-mcp.git cd directus-mcp npm install
  2. 将您的凭证添加到.env
    # .env DIRECTUS_URL=https://your-directus-instance.com DIRECTUS_ACCESS_TOKEN=your_token_here # Or use email/password DIRECTUS_EMAIL=your-email@example.com DIRECTUS_PASSWORD=your-password
  3. 启动开发服务器:
    npm run dev

📄 Directus 开发者资源

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Node.js 服务器使 AI 客户端能够通过模型上下文协议与 Directus CMS API 交互,从而可以管理集合、项目、文件、用户和系统信息。

  1. ℹ 先决条件
    1. ▶️ 快速入门
      1. ❓ 故障排除
        1. 确保您拥有有效的 Directus 凭证
        2. 确保已安装 Node 和 NPM
        3. 清除 NPM 缓存
      2. 🛠️ 可用工具
        1. 收藏品和物品
        2. 文件
        3. 用户和权限
        4. 系统
      3. 🚧 开发模式
        1. 📄 Directus 开发者资源

          Related MCP Servers

          • A
            security
            F
            license
            A
            quality
            A Node.js server that provides advanced video and image processing capabilities through the Model Context Protocol, enabling operations like conversion, compression, editing, and effects application.
            Last updated -
            10
            13
            JavaScript
            • Apple
            • Linux
          • A
            security
            A
            license
            A
            quality
            A comprehensive Model Context Protocol server that provides advanced Node.js development tooling for automating project creation, component generation, package management, and documentation with AI-powered assistance.
            Last updated -
            7
            2
            JavaScript
            MIT License
          • A
            security
            A
            license
            A
            quality
            Node.js server implementing Model Context Protocol that enables interaction with TaskWarrior through natural language to view, filter, add, and complete tasks.
            Last updated -
            3
            13
            1
            JavaScript
            MIT License
          • A
            security
            A
            license
            A
            quality
            A Node.js implementation of the Model Context Protocol that provides secure shell command execution capabilities, allowing AI models like Claude to run shell commands in a controlled environment with built-in security measures.
            Last updated -
            1
            110
            25
            JavaScript
            MIT License
            • Apple

          View all related MCP servers

          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/pixelsock/directus-mcp'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server