PowerBI MCP客户端
______________________________________________________________________
需求
- Python 3.10+
- Windows MCP服务器可执行文件(
.exe) uv包管理器(或pip替代)- 依赖关系:
- mcp - python-dotenv
______________________________________________________________________
安装
- 克隆存储库:
git clone https://github.com/Hatim-BE/MCP_Client--Power_BI_Modeling_MCP.git
cd powerbi-mcp-client- 安装依赖项
uv:
uv install mcp python-dotenv3.创建一个 .env 项目根目录中的文件(可选):~~
~~env~~ ~~# Example .env~~ ~~API_KEY=your_api_key_here~~ ~~~~
- 确保您的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 documentationMCPClient类:管理连接、初始化和清理connect_to_server():连接并列出可用工具cleanup():优雅地关闭连接main():运行客户端的异步入口点
______________________________________________________________________
发展
- 扩展
MCPClient使用MCP工具实施自定义工作流 - 使用
asyncio用于异步交互 - 仅限Windows
.exe现在支持服务器脚本! - 与Visual Studio代码兼容,用于开发和调试
______________________________________________________________________
