PowerBI MCP Server

PowerBI MCP Server

An MCP server for interacting with Microsoft PowerBI REST API, providing tools for data cleaning, transformation, analysis, and visualization within PowerBI.

Category
访问服务器

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

  1. PowerBI Service Account: You need access to PowerBI Pro or Premium
  2. Azure App Registration: Register an application in Azure AD with PowerBI API permissions
  3. 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

  1. Go to Azure Portal
  2. Navigate to "Azure Active Directory" > "App registrations"
  3. Click "New registration"
  4. Configure:
    • Name: PowerBI MCP Server
    • Supported account types: Accounts in this organizational directory only
    • Redirect URI: Not needed for this setup
  5. After creation, note down:
    • Application (client) ID
    • Directory (tenant) ID
  6. Go to "Certificates & secrets" and create a new client secret
  7. 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

  1. Use the get_workspaces tool to find your workspace ID
  2. Use get_datasets to find the dataset you want to analyze
  3. Use get_dataset to get detailed information about the specific dataset
  4. Use get_dataset_schema to understand available tables and columns
  5. Use analyze_data_quality to get insights about data completeness
  6. Use the "analyze_dataset_prompt" for comprehensive analysis guidance

Creating Visualizations

  1. Use generate_visualization_suggestions to get chart recommendations
  2. Use create_dax_for_visualization to generate optimized measures
  3. Use create_visualization_ready_data to format data for charts
  4. Use create_report to create PowerBI reports
  5. Export data for external visualization tools if needed
  6. Use visualization prompts for design guidance

Data Transformation

  1. Use export_data_to_csv to extract raw data
  2. Use create_calculated_column to add derived fields
  3. Use create_measure for aggregations
  4. 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

  1. Secrets Management: Never commit credentials to version control
  2. Least Privilege: Only grant necessary PowerBI permissions
  3. Token Security: Tokens are stored in memory and automatically refreshed
  4. Network Security: Use HTTPS in production deployments

Contributing

Contributions are welcome! Please ensure you:

  1. Follow the existing code style
  2. Add appropriate error handling
  3. Update documentation for new features
  4. Test thoroughly with different PowerBI configurations

License

MIT License - see LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选