Azure Table Storage MCP Server 使用说明

项目简介

Azure Table Storage MCP Server 是一个实现了 Model Context Protocol (MCP) 的服务器,它充当 LLM 客户端(如 Cline)和 Azure Table Storage 之间的桥梁。通过此服务器,LLM 可以安全、便捷地访问和操作存储在 Azure 表中的数据,从而扩展 LLM 的上下文信息处理能力和功能。

主要功能点

  • 查询 Azure 表存储数据: 支持使用 OData 过滤器进行复杂条件查询,获取指定表中的数据子集。为了保护 LLM 的上下文窗口,默认返回结果数量有限制。
  • 获取表结构 (Schema): 允许 LLM 获取 Azure 表的结构信息,包括属性名称和数据类型,帮助 LLM 理解数据内容。
  • 列出所有表: 提供列出 Azure 存储账户中所有表的功能,方便 LLM 了解可用的数据资源。
  • 安全访问控制: 通过 Azure Storage 连接字符串进行身份验证,确保数据访问的安全性。
  • 易于集成: 遵循 MCP 协议标准,可以方便地与任何支持 MCP 协议的 LLM 客户端集成。

安装步骤

本地开发环境安装

  1. 克隆仓库:

    git clone https://github.com/dkmaker/mcp-azure-tablestorage.git
    cd mcp-azure-tablestorage
  2. 安装依赖:

    npm install
  3. 构建服务器:

    npm run build

全局 NPM 安装 (推荐)

  1. 全局安装 npm 包:
    npm install -g dkmaker-mcp-server-tablestore
    或使用 'npx' 直接运行:
    npx dkmaker-mcp-server-tablestore
    注意: 使用 'npx' 或全局安装仍然需要配置 'AZURE_STORAGE_CONNECTION_STRING' 环境变量。

在 Cline 中安装

  1. 打开 Cline 配置文件: Cline 的 MCP 设置文件通常位于:

    • Windows: '%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json'
  2. 添加 MCP 服务器配置: 在 'cline_mcp_settings.json' 文件中的 'mcpServers' 字段下添加以下配置:

    {
      "mcpServers": {
        "tablestore": {
          "command": "node",
          "args": ["/path/to/mcp-azure-tablestorage/build/index.js"],
          "env": {
            "AZURE_STORAGE_CONNECTION_STRING": "your_connection_string_here"  // 替换为你的 Azure Storage 连接字符串
          }
        }
      }
    }
    • 将 '/path/to/mcp-azure-tablestorage' 替换为你克隆仓库的实际路径 (如果使用本地开发环境安装)。
    • 如果使用全局 NPM 安装,'args' 可以简化为 '[]','command' 为 'dmaker-mcp-server-tablestore' 或 'npx dkmaker-mcp-server-tablestore'。 示例配置如下:
    {
      "mcpServers": {
        "tablestore": {
          "command": "dmaker-mcp-server-tablestore",
          "args": [],
          "env": {
            "AZURE_STORAGE_CONNECTION_STRING": "your_connection_string_here"  // 替换为你的 Azure Storage 连接字符串
          }
        }
      }
    }

    {
      "mcpServers": {
        "tablestore": {
          "command": "npx",
          "args": ["dmaker-mcp-server-tablestore"],
          "env": {
            "AZURE_STORAGE_CONNECTION_STRING": "your_connection_string_here"  // 替换为你的 Azure Storage 连接字符串
          }
        }
      }
    }
    • 'AZURE_STORAGE_CONNECTION_STRING' 必须替换为你的 Azure Storage 账户连接字符串。 这是服务器连接 Azure Table Storage 的凭据,请务必正确配置。

服务器配置

Azure Table Storage MCP Server 依赖以下环境变量进行配置:

  • 'AZURE_STORAGE_CONNECTION_STRING': 你的 Azure Storage 账户连接字符串。请确保在运行服务器前设置此环境变量。

基本使用方法 (在 Cline 中)

配置完成后,在 Cline 中即可通过自然语言指令调用 Azure Table Storage MCP Server 的功能。

  1. 查询表数据:

    Query the Users table where PartitionKey is 'ACTIVE'

    Cline 会调用 'query_table' 工具,并传递表名和过滤器等参数。

  2. 获取表结构:

    Show me the schema for the Orders table

    Cline 会调用 'get_table_schema' 工具,获取 'Orders' 表的结构信息。

  3. 列出所有表:

    List all tables in the storage account

    Cline 会调用 'list_tables' 工具,列出存储账户中的所有表名。

重要安全提示: 'query_table' 工具默认返回有限数量的结果 (默认 5 条),以防止 LLM 上下文窗口被过载。请谨慎增加结果数量限制,务必在用户明确确认后进行,避免 LLM 处理过多的数据。

信息

分类

数据库与文件