Token导航 LogoToken导航TokenDH.com
MCP KQL Server logo
数据服务stdio官方级别未说明来源级核验

MCP KQL Server

MCP Server

一个将自然语言转换为KQL查询并执行的工具,支持智能模式发现、AI缓存和无缝Azure Data Explorer集成。

工具数

2

提示词数

0

GitHub Stars

23

资源数

0
数据分析PythonClaude自然语言处理Claude DesktopClaudeCline

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

4R9UN

提供方

4R9UN

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install mcp-kql-server

详细介绍

MCP KQL服务器

mcp名称:io.github.4R9UN/mcp-kql-服务器

](https://mseep.ai/app/4r9un-mcp-kql-server)

基于人工智能的KQL查询执行与自然语言到KQL(NL2KQL)的转换和执行

模型上下文协议(MCP)服务器,通过智能模式发现、AI驱动的缓存和无缝的Azure Data Explorer集成,将自然语言问题转换为优化的KQL查询。只需用简单的英语提问,即可获得即时、准确的KQL查询,并获得上下文感知的结果。

最新版本:v2.1.2 -硬编码10分钟Kusto servertimeout,用于生成查询的ADX端模拟运行验证,模式漂移恢复循环,以及没有硬编码表名或列名的完全模式驱动的NL2KQL。

![Verified on MseeP](https://mseep.ai/app/18772353-3d90-4b12-a253-cf752efaadd2) ![MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.4R9UN/mcp-kql-server) ](https://pypi.org/project/mcp-kql-server/) ![Python](https://pypi.org/project/mcp-kql-server/)

![CI/CD Pipeline](https://github.com/4R9UN/mcp-kql-server/actions) ![codecov](https://codecov.io/gh/4R9UN/mcp-kql-server) ![Security Rating](https://github.com/4R9UN/mcp-kql-server/security) ![Code Quality](https://github.com/4R9UN/mcp-kql-server)

![FastMCP](https://github.com/jlowin/fastmcp) ![Azure Data Explorer](https://azure.microsoft.com/en-us/services/data-explorer/) ![MCP Protocol](https://github.com/anthropics/mcp) ![Maintenance](https://github.com/4R9UN/mcp-kql-server/graphs/commit-activity) ](https://lobehub.com/mcp/4r9un-mcp-kql-server)

🎬 演示

观看MCP KQL服务器的快速演示:

![MCP KQL Server Demo](https://www.youtube.com/watch?v=Ca-yuThJ3Vc)

🚀 特性

  • execute_kql_query:

- KQL的自然语言:从自然语言描述生成KQL查询。 - 直接KQL执行:执行原始KQL查询。 - 多种输出格式:支持JSON、CSV和表格格式。 - 严格模式验证:在执行之前使用发现的架构内存和验证。 - 架构接地修复:仅当有效的表架构可以证明替换时,才修复无效列。

  • schema_memory:

- 架构发现:发现并缓存表的模式。 - 数据库探索:列出数据库中的所有表。 - AI背景:获取表的排名CAG上下文,具有可选的表范围严格模式输出。 - 分析报告:生成可视化报告。 - 缓存管理:清除或刷新架构缓存。 - 内存统计:获取有关内存使用情况的统计信息。

📊 MCP工具执行流程

graph TD
    A[👤 User Submits KQL Query] --> B{🔍 Query Validation}
    B -->|❌ Invalid| C[📝 Syntax Error Response]
    B -->|✅ Valid| D[🧠 Load Schema Context]
    
    D --> E{💾 Schema Cache Available?}
    E -->|✅ Yes| F[⚡ Load from Memory]
    E -->|❌ No| G[🔍 Discover Schema]
    
    F --> H[🎯 Execute Query]
    G --> I[💾 Cache Schema + AI Context]
    I --> H
    
    H --> J{🎯 Query Success?}
    J -->|❌ Error| K[🚨 Enhanced Error Message]
    J -->|✅ Success| L[📊 Process Results]
    
    L --> M[🎨 Generate Visualization]
    M --> N[📤 Return Results + Context]
    
    K --> O[💡 AI Suggestions]
    O --> N
    
    style A fill:#4a90e2,stroke:#2c5282,stroke-width:2px,color:#ffffff
    style B fill:#7c7c7c,stroke:#4a4a4a,stroke-width:2px,color:#ffffff
    style C fill:#e74c3c,stroke:#c0392b,stroke-width:2px,color:#ffffff
    style D fill:#8e44ad,stroke:#6a1b99,stroke-width:2px,color:#ffffff
    style E fill:#7c7c7c,stroke:#4a4a4a,stroke-width:2px,color:#ffffff
    style F fill:#27ae60,stroke:#1e8449,stroke-width:2px,color:#ffffff
    style G fill:#f39c12,stroke:#d68910,stroke-width:2px,color:#ffffff
    style H fill:#2980b9,stroke:#1f618d,stroke-width:2px,color:#ffffff
    style I fill:#f39c12,stroke:#d68910,stroke-width:2px,color:#ffffff
    style J fill:#7c7c7c,stroke:#4a4a4a,stroke-width:2px,color:#ffffff
    style K fill:#e74c3c,stroke:#c0392b,stroke-width:2px,color:#ffffff
    style L fill:#27ae60,stroke:#1e8449,stroke-width:2px,color:#ffffff
    style M fill:#8e44ad,stroke:#6a1b99,stroke-width:2px,color:#ffffff
    style N fill:#27ae60,stroke:#1e8449,stroke-width:2px,color:#ffffff
    style O fill:#f39c12,stroke:#d68910,stroke-width:2px,color:#ffffff

架构内存发现流

模式内存流被集成到查询执行中,但现在它在尝试实时发现之前重用了现有的缓存模式。如果CAG/模式内存中已经有一个表模式可用,服务器将使用该缓存的模式,而不是重新索引它。

graph TD
    A[👤 User Requests Schema Discovery] --> B[🔗 Connect to Cluster]
    B --> C[📂 Enumerate Databases]
    C --> D[📋 Discover Tables]
    
    D --> E[🔍 Get Table Schemas]
    E --> F[🤖 AI Analysis]
    F --> G[📝 Generate Descriptions]
    
    G --> H[💾 Store in Memory]
    H --> I[📊 Update Statistics]
    I --> J[✅ Return Summary]
    
    style A fill:#4a90e2,stroke:#2c5282,stroke-width:2px,color:#ffffff
    style B fill:#8e44ad,stroke:#6a1b99,stroke-width:2px,color:#ffffff
    style C fill:#f39c12,stroke:#d68910,stroke-width:2px,color:#ffffff
    style D fill:#2980b9,stroke:#1f618d,stroke-width:2px,color:#ffffff
    style E fill:#7c7c7c,stroke:#4a4a4a,stroke-width:2px,color:#ffffff
    style F fill:#e67e22,stroke:#bf6516,stroke-width:2px,color:#ffffff
    style G fill:#8e44ad,stroke:#6a1b99,stroke-width:2px,color:#ffffff
    style H fill:#f39c12,stroke:#d68910,stroke-width:2px,color:#ffffff
    style I fill:#2980b9,stroke:#1f618d,stroke-width:2px,color:#ffffff
    style J fill:#27ae60,stroke:#1e8449,stroke-width:2px,color:#ffffff

📋 先决条件

  • Python 3.10或更高版本
  • Azure命令行界面 已安装并验证(az login)
  • 访问Azure数据资源管理器群集

🚀 一个命令安装

快速安装(推荐)

源自

git clone https://github.com/4R9UN/mcp-kql-server.git && cd mcp-kql-server && pip install -e .

替代安装方法

pip install mcp-kql-server

就是这样! 服务器自动执行以下操作:

  • ✅ 在中设置内存目录 %APPDATA%\KQL_MCP (Windows)或 ~/.local/share/KQL_MCP (Linux/Mac)
  • ✅ 配置生产使用的最佳默认值
  • ✅ 抑制详细的Azure SDK日志
  • ✅ 不需要环境变量

📱 MCP客户端配置

一次性安装(任何平台): ``bash pip install --upgrade mcp-kql-server ` 安装后,配置MCP客户端以通过Python模块入口点启动服务器: python -m mcp_kql_server。这适用于所有使用Python的平台 PATH 并且不取决于 mcp-kql-server 控制台脚本。(控制台脚本仍由安装 pip` 并且仍然支持向后兼容性——请参阅下面的替代代码段。)

克劳德桌面版

添加到您的Claude Desktop MCP设置文件(mcp_settings.json):

地点:

  • 视窗: %APPDATA%\Claude\mcp_settings.json
  • macOS: ~/Library/Application Support/Claude/mcp_settings.json
  • Linux: ~/.config/Claude/mcp_settings.json
{
  "mcpServers": {
    "mcp-kql-server": {
      "type": "stdio",
      "command": "python",
      "args": ["-m", "mcp_kql_server"]
    }
  }
}

Alternatives: platform-stable launchers or the installed console script

窗户( py 发射器始终位于 C:\Windows\py.exe):

{
  "mcpServers": {
    "mcp-kql-server": {
      "type": "stdio",
      "command": "py",
      "args": ["-3", "-m", "mcp_kql_server"]
    }
  }
}

在macOS/Linux上替换 "py" 随着 "python3" 并放下 "-3" arg。

或者使用控制台脚本 pip install 滴在 PATH:

{
  "mcpServers": {
    "mcp-kql-server": {
      "type": "stdio",
      "command": "mcp-kql-server",
      "args": []
    }
  }
}

VSCode(带MCP扩展)

添加到VSCode MCP配置中:

Settings.json位置:

  • 视窗: %APPDATA%\Code\User\mcp.json
  • macOS: ~/Library/Application Support/Code/User/mcp.json
  • Linux: ~/.config/Code/User/mcp.json
{
  "servers": {
    "mcp-kql-server": {
      "type": "stdio",
      "command": "python",
      "args": ["-m", "mcp_kql_server"]
    }
  }
}
如果VS代码记录 spawn ...PythonNNN/python.exe ENOENT,Python扩展正在用缓存的解释器路径替换 "python".切换到 "py" (Windows)/ "python3" (macOS/Linux),或 "mcp-kql-server" 控制台脚本 pip install 滴在 PATH。参见 docs/故障排除.md 了解全部细节。

Roo代码或Cline(VS代码扩展)

询问或添加到您的Roo代码或临床MCP设置:

MCP设置位置:

  • 所有平台:通过Roo代码扩展设置或 mcp_settings.json
{
  "mcp-kql-server": {
    "type": "stdio",
    "command": "python",
    "args": ["-m", "mcp_kql_server"],
    "alwaysAllow": []
  }
}

通用MCP客户端

对于任何与MCP兼容的应用程序:

# Preferred: invoke as a Python module (cross-platform)
python -m mcp_kql_server

# Platform-stable launchers (recommended if `python` is ambiguous on PATH)
py -3 -m mcp_kql_server     # Windows
python3 -m mcp_kql_server   # macOS / Linux

# Equivalent console script installed by pip
mcp-kql-server

# Server provides these tools:
# - execute_kql_query: Execute KQL or generate KQL from natural language
# - schema_memory: Discover, cache, and inspect cluster schemas

🔧 快速开始

1.使用Azure进行身份验证(一次性设置)

az login

2.启动MCP服务器(零配置)

python -m mcp_kql_server

服务器立即启动:

  • 📁 自动创建内存路径: %APPDATA%\KQL_MCP\cluster_memory
  • 🔧 优化默认值:不需要配置文件
  • 🔐 安全设置:使用现有的Azure CLI凭据

3.通过MCP客户端使用

服务器提供两个主要工具:

#### execute_kql_query -执行KQL查询或从自然语言生成KQL #### schema_memory -发现、刷新和检查缓存的集群模式

💡 使用示例

基本查询执行

问问你的MCP客户(比如克劳德):

“对帮助集群执行此KQL查询: cluster('help.kusto.windows.net').database('Samples').StormEvents | take 10 并总结结果,给我高层次的见解”

复杂分析查询

询问您的MCP客户:

“查询帮助集群中的示例数据库,按风暴事件计数向我显示前10个州,包括可视化”

架构发现

询问您的MCP客户:

“发现并缓存help.kusto.indows.net集群的架构,然后告诉我哪些数据库和表可用”

基于上下文的数据探索

询问您的MCP客户:

“使用帮助集群上示例数据库中的StormEvents表,向我显示2007年以来所有损失估计超过100万美元的龙卷风事件”

基于时间的分析

询问您的MCP客户:

“在StormEvents表中按月分析2007年的风暴事件,按事件类型分组并以可视化方式显示”

🎯 主要优势

面向数据分析师

  • ⚡ 更快的查询开发:AI驱动的自动补全和建议
  • 🎨 丰富的可视化:用于数据探索的即时降价表
  • 🧠 情境感知:无需文档即可了解您的数据结构

DevOps团队

  • 🔄 自动模式发现:保持架构信息最新
  • 💾 智能缓存:减少API调用并提高性能
  • 🔐 安全认证:利用现有的Azure CLI凭据

适用于人工智能应用

  • 🤖 智能查询辅助:AI生成的表格描述和建议
  • 📊 结构化数据访问:用于下游处理的干净、键入的响应
  • 🎯 上下文感知响应:丰富的元数据有助于更好的人工智能决策

🏗️ 建筑

%%{init: {'theme':'dark', 'themeVariables': {
  'primaryColor':'#1a1a2e',
  'primaryTextColor':'#00d9ff',
  'primaryBorderColor':'#00d9ff',
  'secondaryColor':'#16213e',
  'secondaryTextColor':'#c77dff',
  'secondaryBorderColor':'#c77dff',
  'tertiaryColor':'#0f3460',
  'tertiaryTextColor':'#ffaa00',
  'tertiaryBorderColor':'#ffaa00',
  'lineColor':'#00d9ff',
  'textColor':'#ffffff',
  'mainBkg':'#0a0e27',
  'nodeBorder':'#00d9ff',
  'clusterBkg':'#16213e',
  'clusterBorder':'#9d4edd',
  'titleColor':'#00ffff',
  'edgeLabelBackground':'#1a1a2e',
  'fontFamily':'Inter, Segoe UI, sans-serif',
  'fontSize':'16px',
  'flowchart':{'nodeSpacing':60, 'rankSpacing':80, 'curve':'basis', 'padding':20}
}}}%%
graph LR
    Client["🖥️ MCP Client
Claude / AI / Custom
─────────
Natural Language
Interface"]
    
    subgraph Server["🚀 MCP KQL Server"]
        direction TB
        FastMCP["⚡ FastMCP
Framework
─────────
MCP Protocol
Handler"]
        NL2KQL["🧠 NL2KQL
Engine
─────────
AI Query
Generation"]
        Executor["⚙️ Query
Executor
─────────
Validation &
Execution"]
        Memory["💾 Schema
Memory
─────────
AI Cache"]
        
        FastMCP --> NL2KQL
        NL2KQL --> Executor
        Executor --> Memory
        Memory --> Executor
    end
    
    subgraph Azure["☁️ Azure Services"]
        direction TB
        ADX["📊 Azure Data
Explorer
─────────
Kusto Cluster
KQL Engine"]
        Auth["🔐 Azure
Identity
─────────
Device Code
CLI Auth"]
    end
    
    %% Client to Server
    Client ==>|"📡 MCP Protocol
STDIO/SSE"| FastMCP
    
    %% Server to Azure
    Executor ==>|"🔍 Execute KQL
Query & Analyze"| ADX
    Executor -->|"🔐 Authenticate"| Auth
    Memory -.->|"📥 Fetch Schema
On Demand"| ADX
    
    %% Styling - Using cyberpunk palette
    style Client fill:#1a1a2e,stroke:#00d9ff,stroke-width:4px,color:#00ffff
    style FastMCP fill:#16213e,stroke:#c77dff,stroke-width:3px,color:#c77dff
    style NL2KQL fill:#1a1a40,stroke:#ffaa00,stroke-width:3px,color:#ffaa00
    style Executor fill:#16213e,stroke:#9d4edd,stroke-width:3px,color:#9d4edd
    style Memory fill:#0f3460,stroke:#00d9ff,stroke-width:3px,color:#00d9ff
    style ADX fill:#1a1a2e,stroke:#ff6600,stroke-width:4px,color:#ff6600
    style Auth fill:#16213e,stroke:#00ffff,stroke-width:2px,color:#00ffff
    
    style Server fill:#0a0e27,stroke:#9d4edd,stroke-width:3px,stroke-dasharray: 5 5
    style Azure fill:#0a0e27,stroke:#ff6600,stroke-width:3px,stroke-dasharray: 5 5

MCP KQL服务器生成的报告 |

🚀 生产部署

准备好将MCP KQL Server部署到Azure以供生产使用了吗?我们提供全面的部署自动化 Azure容器应用 具有企业级安全性和可扩展性。

🌟 特性

  • 无服务器计算:具有自动扩展功能的Azure容器应用程序
  • 管理身份:使用Azure AD进行无密码身份验证
  • 基础设施即代码:用于可重复部署的二头肌模板
  • 监控:集成日志分析和应用程序洞察
  • 缺省巩固安全:网络隔离、RBAC和最低权限访问
  • 一个命令部署:自动PowerShell和Bash脚本

📖 部署指导

有关完整的部署说明、体系结构详细信息和故障排除:

👉 查看生产部署指南

该指南包括:

  • 🏗️ 详细的架构图
  • ⚙️ 逐步部署说明(PowerShell和Bash)
  • 🔒 安全配置最佳实践
  • 🐛 常见问题排查
  • 📦 Docker容器化详细信息

快速部署

# PowerShell (Windows)
cd deployment
.\deploy.ps1 -SubscriptionId "YOUR_SUB_ID" -ResourceGroupName "mcp-kql-prod-rg" -ClusterUrl "https://yourcluster.region.kusto.windows.net"

# Bash (Linux/Mac/WSL)
cd deployment
./deploy.sh --subscription "YOUR_SUB_ID" --resource-group "mcp-kql-prod-rg" --cluster-url "https://yourcluster.region.kusto.windows.net"

📁 项目结构

mcp-kql-server/
├── mcp_kql_server/
│   ├── __init__.py          # Package initialization
│   ├── mcp_server.py        # Main MCP server implementation
│   ├── execute_kql.py       # KQL query execution logic
│   ├── memory.py            # Advanced memory management
│   ├── kql_auth.py          # Azure authentication
│   ├── utils.py             # Utility functions
│   └── constants.py         # Configuration constants
├── docs/                    # Documentation
├── Example/                 # Usage examples
├── pyproject.toml          # Project configuration
└── README.md               # This file

🔒 安全

  • Azure CLI身份验证:利用您现有的Azure设备登录
  • 无凭据存储:服务器不存储身份验证令牌
  • 本地内存:架构缓存存储在本地,不传输

🐛 故障排除

常见问题

  1. 身份验证错误
   # Re-authenticate with Azure CLI
   az login --tenant your-tenant-id
  1. 内存问题
   # The memory cache is now managed automatically. If you suspect issues,
   # you can clear the cache directory, and it will be rebuilt on the next query.
   # Windows:
   rmdir /s /q "%APPDATA%\KQL_MCP\unified_memory.json"

   # macOS/Linux:
   rm -rf ~/.local/share/KQL_MCP/cluster_memory
  1. 连接超时

- 检查群集URI格式 - 验证网络连接 - 确认Azure权限

🤝 贡献

我们欢迎捐款!请做。

📞 支持

🌟 明星历史

![Star History Chart](https://star-history.com/#4R9UN/mcp-kql-server&Date)

______________________________________________________________________

mcp名称:io.github.4R9UN/mcp-kql-服务器

快乐查询! 🎉

目录标签

目录标签

数据分析PythonClaude自然语言处理KQL转换本地部署数据库查询Azure集成AI辅助

支持客户端

Claude DesktopClaudeCline

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

session

工具数量(toolCount,工具数)

2

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiosession部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP