MCP Server for ArangoDB

MCP Server for ArangoDB

这是一个基于TypeScript的MCP服务器,通过ArangoDB提供数据库交互能力。它实现了核心数据库操作,并允许通过MCP工具与ArangoDB无缝集成。您可以使用它与Claude应用程序以及VSCode中与mcp类似的Cline扩展一起工作!

概述

MCP Server for ArangoDB 是一个基于 TypeScript 的服务器,允许您通过 Model Context Protocol (MCP) 与 ArangoDB 数据库交互。可与 Claude 应用程序或支持 MCP 的 VSCode 扩展(如 Cline)一起使用。

安装

通过 Smithery 安装(推荐):

npx -y @smithery/cli install @ravenwits/mcp-server-arangodb --client claude

配置

环境变量设置

服务器需要以下环境变量:

  • ARANGO_URL - ArangoDB 服务器 URL
  • ARANGO_DATABASE - 数据库名称
  • ARANGO_USERNAME - 数据库用户名
  • ARANGO_PASSWORD - 数据库密码

客户端配置

对于 Claude Desktop,修改配置文件:

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json

对于 Cline VSCode 扩展,修改配置文件:

  • MacOS: ~/Library/Application Support/Code/User/globalStorage/cline.cline/config.json
  • Windows: %APPDATA%/Code/User/globalStorage/cline.cline/config.json

添加以下配置:

{
  "mcpServers": {
    "arango": {
      "command": "node",
      "args": ["/path/to/arango-server/build/index.js"],
      "env": {
        "ARANGO_URL": "your_database_url",
        "ARANGO_DATABASE": "your_database_name",
        "ARANGO_USERNAME": "your_username",
        "ARANGO_PASSWORD": "your_password"
      }
    }
  }
}

主要功能

MCP Server 提供以下工具:

  • arango_query - 执行 AQL 查询
  • arango_insert - 向集合中插入文档
  • arango_update - 更新现有文档
  • arango_remove - 移除文档
  • arango_backup - 将集合备份为 JSON 文件
  • arango_list_collections - 列出所有集合
  • arango_create_collection - 创建新集合

使用示例

向 Claude 提供自然语言提示:

  • "列出数据库中的所有集合"
  • "查询所有用户"
  • "向'users'集合中插入姓名为'John Doe'的新文档"

代码示例:

  1. 查询:
{
  "query": "FOR user IN users RETURN user"
}
  1. 插入:
{
  "collection": "users",
  "document": {
    "name": "John Doe",
    "email": "john@example.com"
  }
}
  1. 更新:
{
  "collection": "users",
  "key": "123456",
  "update": {
    "name": "Jane Doe"
  }
}

开发与调试

安装依赖:

npm run build

使用自动重建进行开发:

npm run watch

使用 MCP Inspector 进行调试:

npm run inspector

详细文档请访问 Smithery