PowerBI MCP Server
An MCP server for interacting with Microsoft PowerBI REST API, providing tools for data cleaning, transformation, analysis, and visualization within PowerBI.
README
PowerBI MCP Server
A Model Context Protocol (MCP) server for interacting with Microsoft PowerBI REST API. This server provides comprehensive tools for data cleaning, transformation, analysis, and visualization within PowerBI.
Features
Resources
- List PowerBI workspaces
- Browse datasets and reports in workspaces
- Access dataset schemas and metadata
Tools
-
Data Operations
- Get workspaces, datasets, reports
- Get detailed dataset information
- Query datasets with DAX
- Refresh datasets
- Analyze data quality
- Export data to CSV format
-
Visualization & Reporting
- Create and clone reports
- Get report pages and structure
- Generate visualization suggestions
- Create visualization-ready data
- Generate DAX measures for specific chart types
- Export chart data for external tools
-
Data Transformation
- Create calculated columns
- Create measures
- Execute custom DAX expressions
-
Report Management
- Create new reports
- List existing reports
- Get refresh history
-
Analysis
- Analyze data quality across tables
- Generate insights from datasets
- Performance optimization suggestions
Prompts
- Dataset analysis guidance
- Dashboard creation assistance
- Data cleaning workflows
- DAX optimization help
- Visualization design recommendations
- Dashboard layout guidance
- Chart-specific best practices
Prerequisites
- PowerBI Service Account: You need access to PowerBI Pro or Premium
- Azure App Registration: Register an application in Azure AD with PowerBI API permissions
- API Permissions: Grant the following permissions to your Azure app:
- Dataset.Read.All
- Dataset.ReadWrite.All
- Report.Read.All
- Report.ReadWrite.All
- Workspace.Read.All
Setup
1. Azure App Registration
- Go to Azure Portal
- Navigate to "Azure Active Directory" > "App registrations"
- Click "New registration"
- Configure:
- Name: PowerBI MCP Server
- Supported account types: Accounts in this organizational directory only
- Redirect URI: Not needed for this setup
- After creation, note down:
- Application (client) ID
- Directory (tenant) ID
- Go to "Certificates & secrets" and create a new client secret
- Go to "API permissions" and add PowerBI Service permissions
2. Environment Variables
Create a .env file or set these environment variables:
POWERBI_TENANT_ID=your-tenant-id
POWERBI_CLIENT_ID=your-client-id
POWERBI_CLIENT_SECRET=your-client-secret
3. Installation
# Clone the repository
git clone <repository-url>
cd powerbi-mcp-server
# Install dependencies
pip install mcp[cli] httpx pandas openpyxl
# Or using uv
uv add "mcp[cli]" httpx pandas openpyxl
4. Running the Server
Development Mode
mcp dev powerbi_server.py
Claude Desktop Integration
mcp install powerbi_server.py --name "PowerBI Server"
Direct Execution
python powerbi_server.py
Usage Examples
Analyzing a Dataset
- Use the
get_workspacestool to find your workspace ID - Use
get_datasetsto find the dataset you want to analyze - Use
get_datasetto get detailed information about the specific dataset - Use
get_dataset_schemato understand available tables and columns - Use
analyze_data_qualityto get insights about data completeness - Use the "analyze_dataset_prompt" for comprehensive analysis guidance
Creating Visualizations
- Use
generate_visualization_suggestionsto get chart recommendations - Use
create_dax_for_visualizationto generate optimized measures - Use
create_visualization_ready_datato format data for charts - Use
create_reportto create PowerBI reports - Export data for external visualization tools if needed
- Use visualization prompts for design guidance
Data Transformation
- Use
export_data_to_csvto extract raw data - Use
create_calculated_columnto add derived fields - Use
create_measurefor aggregations - Use the "data_cleaning_prompt" for transformation guidance
API Reference
Authentication
The server uses OAuth 2.0 client credentials flow for authentication. Tokens are automatically refreshed as needed.
Error Handling
All tools return a standardized response format:
{
"success": boolean,
"data": object, // Present on success
"error": string // Present on failure
}
Rate Limiting
The PowerBI API has rate limits. The server handles basic retry logic, but you may need to implement additional throttling for high-volume operations.
Troubleshooting
Authentication Issues
- Verify your Azure app registration has the correct permissions
- Ensure the client secret hasn't expired
- Check that the tenant ID is correct
API Permissions
- Make sure your app has admin consent for PowerBI API permissions
- Verify the service principal has access to the required workspaces
Data Access
- Ensure your Azure app has been granted access to PowerBI workspaces
- Check if datasets require specific permissions for programmatic access
Security Considerations
- Secrets Management: Never commit credentials to version control
- Least Privilege: Only grant necessary PowerBI permissions
- Token Security: Tokens are stored in memory and automatically refreshed
- Network Security: Use HTTPS in production deployments
Contributing
Contributions are welcome! Please ensure you:
- Follow the existing code style
- Add appropriate error handling
- Update documentation for new features
- Test thoroughly with different PowerBI configurations
License
MIT License - see LICENSE file for details.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.