
Power BI
STDIOPower BI data querying through natural language using MCP protocol
Power BI data querying through natural language using MCP protocol
Transform your Power BI experience - ask questions in natural language and get instant insights from your data.
A Model Context Protocol (MCP) server that enables AI assistants to interact with Power BI datasets through natural language. Query your data, generate DAX, and get insights without leaving your AI assistant.
Ask questions like "What are total sales by region?" and get instant insights from your Power BI data.
Clone the repository
git clone https://github.com/yourusername/powerbi-mcp-server.git cd powerbi-mcp-server
Install dependencies
pip install -r requirements.txt
Configure environment variables
cp .env.example .env # Edit .env with your credentials
Test the connection
python quickstart.py
Add to your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{ "mcpServers": { "powerbi": { "command": "python", "args": ["C:/path/to/powerbi-mcp-server/src/server.py"], "env": { "PYTHONPATH": "C:/path/to/powerbi-mcp-server", "OPENAI_API_KEY": "your-openai-api-key" } } } }
Once configured, you can interact with your Power BI data through Claude:
Connect to Power BI dataset at powerbi://api.powerbi.com/v1.0/myorg/YourWorkspace
What tables are available?
Show me the structure of the Sales table
What are the total sales by product category?
Show me the trend of revenue over the last 12 months
Which store has the highest gross margin?
Execute DAX: EVALUATE SUMMARIZE(Sales, Product[Category], "Total", SUM(Sales[Amount]))
Power BI XMLA Endpoint
powerbi://api.powerbi.com/v1.0/myorg/WorkspaceName
Azure AD Service Principal
OpenAI API Key
gpt-4o-mini
(200x cheaper than GPT-4)Create a .env
file:
# OpenAI Configuration OPENAI_API_KEY=your_openai_api_key_here OPENAI_MODEL=gpt-4o-mini # Optional: defaults to gpt-4o-mini # Optional: Default Power BI Credentials DEFAULT_TENANT_ID=your_tenant_id DEFAULT_CLIENT_ID=your_client_id DEFAULT_CLIENT_SECRET=your_client_secret # Logging LOG_LEVEL=INFO
powerbi-mcp-server/
├── src/
│ └── server.py # Main MCP server implementation
├── docs/ # Documentation
├── examples/ # Example queries and use cases
├── tests/ # Test suite
├── .env.example # Environment variables template
├── requirements.txt # Python dependencies
├── quickstart.py # Quick test script
└── README.md # This file
.env
files and keep them in .gitignore
Run the test suite:
python -m pytest tests/
Test specific functionality:
python tests/test_connection.py python tests/test_dax_generation.py
We welcome contributions! Please see CONTRIBUTING.md for details.
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)ADOMD.NET not found
Connection fails
Timeout errors
See TROUBLESHOOTING.md for detailed solutions.
This project is licensed under the MIT License - see the LICENSE file for details.