A

Azure 自然语言管理工具

@Streen9/azure-mcp
0 Stars 366 次浏览 Streen9 更新于 2026-08-23

通过 Claude Desktop 启用与 Azure 服务的自然语言交互,支持资源管理、订阅处理和租户选择,并具有安全的身份验证功能。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "sequential-thinking": {
      "args": [
        "-y",
        "@modelcontextprotocol/server-sequential-thinking"
      ],
      "command": "npx"
    }
  }
}

可用工具 (3 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

run-azure-code 4 个参数 需填 2 项

Run Azure code

必填参数:reasoning、code

list-tenants

List all available Azure tenants

该工具无需必填参数,直接调用即可

select-tenant 2 个参数 需填 2 项

Select Azure tenant and subscription

必填参数:tenantId、subscriptionId

服务介绍

Azure MCP (模型上下文协议) 用于 Claude 桌面版

smithery 徽章

这是一个模型上下文协议 (MCP) 的实现,它使 Claude 桌面版能够与 Azure 服务进行交互。此集成允许 Claude 通过自然语言对话直接查询和管理 Azure 资源。

功能

  • Azure 资源管理:与 Azure 资源管理客户端接口
  • 订阅管理:列出并管理 Azure 订阅
  • 租户管理:列出并选择 Azure 租户
  • 自动身份验证:使用 DefaultAzureCredential 进行灵活的身份验证方法
  • 错误处理:对暂时性故障进行重试的健壮错误处理
  • 干净的响应格式:与 Claude 桌面版兼容的良好格式化响应

前提条件

  • Node.js (v18 或更高版本)
  • Claude 桌面应用程序
  • 具有适当权限的 Azure 帐户
  • Azure CLI(可选,用于基于 CLI 的身份验证)

安装

手动安装

  1. 克隆仓库:
git clone https://github.com/Streen9/azure-mcp.git
cd azure-mcp
  1. 安装依赖项:
npm install
  1. 配置 Claude 桌面版:
    • 打开 claude_desktop_config.json
    • 添加以下 MCP 配置:
{
  "mcpServers": {
    "sequential-thinking": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sequential-thinking"
      ]
    },
    "azure": {
      "command": "tsx",
      "args": [
        "C:/Users/[YourUsername]/path/to/azure-mcp/src/launcher.ts"
      ]
    }
  }
}

身份验证

服务器通过 DefaultAzureCredential 支持多种身份验证方法:

  • 环境变量
  • 托管身份
  • Azure CLI
  • Visual Studio Code
  • 交互式浏览器

服务器将按顺序自动尝试这些方法,直到成功为止。

使用

  1. 如果 Claude 桌面版正在运行,请关闭它(检查任务管理器)
  2. 启动 Claude 桌面版
  3. 在聊天中,你现在可以询问与 Azure 相关的问题,例如:
    • "你能获取所有可用的 Azure 帐户和订阅吗?"
    • "列出我的订阅中的所有资源组"
    • "显示特定资源组中的所有虚拟机"

示例对话

You: Can you get all the available Azure accounts and subscriptions?
Claude: I'll help you list all available Azure tenants and subscriptions.
[Claude will then use the Azure MCP to fetch and display the information]

开发

项目结构

azure-mcp/
├── src/
│   ├── launcher.ts       # Server entry point
│   ├── AzureServer.ts    # Main MCP server implementation
│   └── LoggerService.ts  # Logging utility
├── package.json
└── README.md

关键组件

  • AzureMCPServer:实现 MCP 协议的主要服务器类
  • HandleCallTool:处理传入的工具请求
  • ExecuteWithRetry:为弹性操作实现重试逻辑

故障排除

  1. 身份验证问题

    • 确保你已通过 Azure CLI (az login) 登录
    • 如果使用服务主体,请检查环境变量
    • 确认你的 Azure 帐户具有必要的权限
  2. 连接问题

    • 验证 Claude 桌面配置
    • 检查配置文件中的路径是否与你的安装匹配
    • 确保没有其他实例在运行
  3. 常见错误

    • NO_TENANT:使用 'select-tenant' 工具选择一个租户
    • NO_CLIENTS:确保正确的初始化和身份验证
    • CODE_EXECUTION_FAILED:检查 Azure 权限和连接

贡献

欢迎贡献!请随时提交 Pull Request。

贡献者

致谢

  • Claude Desktop 团队提供的 MCP 实现
  • Azure SDK 团队提供的全面 SDK
  • Model Context Protocol 支持 AI 服务集成

安全说明

此实现遵循 Azure 安全最佳实践:

  • 无硬编码凭证
  • 安全的凭证链实现
  • 正确的错误处理和清理

对于安全问题或漏洞,请创建一个 issue。

相关 MCP 服务