PowerBI MCP客户端工具

用于连接和管理PowerBI MCP服务器的客户端工具,支持异步交互和自定义工作流。

  • by Hatim-BE
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 Hatim-BE/MCP_Client--Power_BI_Modeling_MCP

使用说明

PowerBI MCP客户端


需求

  • Python 3.10+
  • Windows MCP服务器可执行文件(.exe)
  • uv 包管理器(或 pip 替代)
  • 依赖关系:

安装

  1. 克隆存储库:
git clone https://github.com/Hatim-BE/MCP_Client--Power_BI_Modeling_MCP.git
cd powerbi-mcp-client
  1. 安装依赖项 uv:
uv install mcp python-dotenv

3.创建一个 .env 项目根目录中的文件(可选):~~

env~~ ~~# Example .env~~ ~~API_KEY=your_api_key_here~~ ~~

  1. 确保您的MCP服务器可执行文件可访问:
PowerBI.MCP.Server.exe

用法

使用MCP服务器的路径运行客户端:

python client.py path/to/PowerBI.MCP.Server.exe

输出示例:

Connected to server with tools: ['Tool1', 'Tool2', 'Tool3']

项目结构

client.py          # Main MCP client script
README.md          # Project documentation
  • MCPClient 类:管理连接、初始化和清理
  • connect_to_server():连接并列出可用工具
  • cleanup():优雅地关闭连接
  • main():运行客户端的异步入口点

发展

  • 扩展 MCPClient 使用MCP工具实施自定义工作流
  • 使用 asyncio 用于异步交互
  • 仅限Windows .exe 现在支持服务器脚本!
  • 与Visual Studio代码兼容,用于开发和调试

参考文献