Azure存储MCP服务器

一个用于Blob存储、队列存储和表存储的只读Azure存储MCP(模型上下文协议)服务器,提供紧凑的JSON响应和LLM优化的功能。

  • by akrym1582
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 akrym1582/azstorage-mcp-server

使用说明

@akrym1582/az存储mcp服务器

用于Blob存储、队列存储和表存储的只读Azure存储MCP(模型上下文协议)服务器。

特性

  • 只读 --无写入、更新或删除操作
  • Blob存储 --列表容器、列表blob(平面和树)、读取文本内容、下载二进制内容
  • 队列存储 --列表队列、peek消息(可见性不变)
  • 表存储 --列出表,按键获取实体,使用OData过滤器进行查询
  • 基于光标的分页 --一致性 cursor / hasMore 所有列表操作的模式
  • LLM优化响应 --紧凑的JSON,截断的文本,没有不必要的字段
  • 连接字符串或托管身份 通过环境变量进行身份验证

安装

npm install -g @akrym1582/azstorage-mcp-server

或不通过安装使用 npx:

npx @akrym1582/azstorage-mcp-server

认证

集 一 在启动服务器之前,请检查以下环境变量:

变量 描述
AZURE_STORAGE_CONNECTION_STRING 完整连接字符串(优先)
AZURE_STORAGE_ACCOUNT_NAME 存储帐户名称;用途 DefaultAzureCredential (托管身份、Azure CLI等)

MCP客户端配置

克劳德桌面版

将以下内容添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "azstorage": {
      "command": "npx",
      "args": ["-y", "@akrym1582/azstorage-mcp-server"],
      "env": {
        "AZURE_STORAGE_CONNECTION_STRING": "<your-connection-string>"
      }
    }
  }
}

要改用托管身份,请替换 env 用以下方式阻止:

"env": {
  "AZURE_STORAGE_ACCOUNT_NAME": "<your-storage-account-name>"
}

其他MCP客户端(游标、VS代码等)

使用相同的模式 npx -y @akrym1582/azstorage-mcp-server 作为命令并提供身份验证环境变量之一。

MCP工具

Blob存储

工具 说明
storage.blobs.listContainers 列出容器。参数: prefix, pageSize, cursor
storage.blobs.listFlat 平面blob列表。参数: container*, prefix, pageSize, cursor
storage.blobs.listTree 分层blob列表。参数: container*, prefix, delimiter, pageSize, cursor
storage.blobs.read 读取blob元数据+内联文本(≤8KB)。参数: container, blob, maxBytes
storage.blobs.download 将blob块下载为base64格式。参数: container, blob, offset, length

队列存储

工具 说明
storage.queues.list 列出队列。参数: prefix, pageSize, cursor
storage.queues.peek 查看消息(只读,不更改可见性)。参数: queue*, maxMessages

表存储

工具 说明
storage.tables.list 列出表格。参数: pageSize, cursor
storage.tables.get 按键获取实体。参数: table, partitionKey, rowKey*, select
storage.tables.query 使用OData筛选器进行查询。参数: table*, filter, select, pageSize, cursor

* =必填

响应格式

所有列表操作都返回一个通用信封:

{
  "items": [...],
  "page": {
    "pageSize": 20,
    "cursor": "opaque-next-cursor-or-null",
    "hasMore": true,
    "totalCount": null,
    "totalPages": null,
    "countMode": "disabled"
  },
  "summary": { "returned": 20 }
}

使用 cursor 从之前的响应中提取下一页。

发展

git clone https://github.com/akrym1582/azstorage-mcp-server.git
cd azstorage-mcp-server
npm install
npm run build   # compile TypeScript → dist/
npm test        # run unit tests
npm run dev     # run with tsx (no compilation needed)

许可证

麻省理工学院