Power BI MCP Server enables AI assistants to interact with Power BI datasets through natural language. This server lets you query your data, generate DAX, and get insights directly within your AI assistant, transforming how you extract information from Power BI.
Platform | Python | .NET Runtime | ADOMD.NET | Status |
---|---|---|---|---|
Windows | 3.10+ | Built-in | Available | Full Support |
Linux | 3.10+ | Available | Docker only | Docker Support |
macOS | 3.10+ | Available | Not available | Not supported |
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
Build the container image:
docker build -t powerbi-mcp .
Run the server:
docker run -it --rm -e OPENAI_API_KEY=<key> powerbi-mcp
To use a custom port:
docker run -it --rm -e OPENAI_API_KEY=<key> -p 7000:7000 powerbi-mcp \
python src/server.py --host 0.0.0.0 --port 7000
Important: Docker containers don't use .env
files. Provide environment variables using docker run -e
, Docker Compose, or your cloud platform.
Power BI XMLA Endpoint
powerbi://api.powerbi.com/v1.0/myorg/WorkspaceName
Azure AD Service Principal
OpenAI API Key (optional)
gpt-4o-mini
Create a .env
file (OpenAI settings are optional):
# OpenAI Configuration (optional)
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-4o-mini # 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
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]))
ADOMD.NET not found
Connection fails
Timeout errors
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "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"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"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"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"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"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect