A

Azure-MCP 自然语言交互工具

@kalivaraprasad-gonapa/azure-mcp
0 Stars 371 次浏览 kalivaraprasad-gonapa 更新于 2026-08-23

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

MCP 服务配置

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

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

服务介绍

Azure MCP (Model Context Protocol) 用于 Claude 桌面版

smithery 徽章

这是一个 Model Context Protocol (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 服务