# PBIX to MCP Converter
Convert Power BI (.pbix) files into Model Context Protocol (MCP) servers using Google's genai-toolbox.
## Background
The pain point of any SQL generation solutions based on text2sql, either they are agentic or RAG, remain the same: they are depends on LLM which is non-deterministic! While they create greate applications, it raise the question whether the dynamically generated queries (effectively code) are acurate therefore the results from these query can be trusted or not.
Having been working on data domain for ages, my idea is to make best use of existing powerbi reports (tested code!) rather than dynamic generate query (image using a system with code generated on the fly!).
This tool do three things:
- Extract necessary information from powerbi reports (Thanks to `pbixray`)
- Convert to a yaml file according to Google's `genai-toolbox`
- Run `genai-toolbox` to get a MCP server, which you can connect to with any MCP-supported assistant client
`genai-toolbox` allows you to pregenerated sql queries and expose them as MCP tool. So instead have LLM do everything: generate correct query, correct parameter, it now only need to make sure call the right tool, whose result can be easily spotted and evaluated.
## Features
- **Complete Data Extraction**: Extract data models, tables, relationships, and schema information
- **DAX Analysis**: Parse DAX measures, calculated columns, and calculated tables with complexity analysis
- **UI Structure**: Extract report pages, visualizations, bookmarks, and layout information
- **SQLite Database**: Generate SQLite databases from embedded Power BI data
- **MCP Configuration**: Create genai-toolbox compatible YAML configurations
- **Modular Architecture**: Clean, extensible codebase for custom integrations
## Quick Start
Here's an example of what this tool can extract from a Power BI report:

*Original Power BI dashboard with complex visualizations and data relationships*
The tool converts this into a comprehensive MCP server with dozens of specialized tools:

*Generated MCP tools that provide programmatic access to all Power BI data and analytics*
Once configured, you can interact with your Power BI data through natural language in any MCP-compatible chat interface:

*Example of using the MCP tools in a chat interface to query Power BI data naturally*
### Installation
```bash
pip install pbix-to-mcp
```
### Basic Usage
```bash
# Convert a Power BI file to MCP server
pbix-to-mcp report.pbix
# Generate complete package
pbix-to-mcp report.pbix --complete-package
# Custom output directory and configuration
pbix-to-mcp report.pbix -o my_output --config-name my_mcp.yaml
```
### Using the MCP Server
1. **Install Google's genai-toolbox**:
```bash
# Download from releases page
export VERSION=0.12.0
curl -O https://storage.googleapis.com/genai-toolbox/v$VERSION/linux/amd64/toolbox
chmod +x toolbox
```
2. **Start the MCP server**:
```bash
./toolbox --tools-file supply_chain_mcp.yaml
```
> **Important**: Ensure the database path in the YAML config is correct for your environment. If running from a different directory, you may need to update the database path to be absolute or correctly relative.
3. **Connect from your MCP client**:
```json
{
"servers": {
"powerbi-mcp": {
"url": "http://localhost:5000/mcp",
"headers": {}
}
}
}
```
## Library Usage
```python
from pbix_to_mcp import PBIXConverter
# Initialize converter
converter = PBIXConverter("report.pbix")
# Extract all components
results = converter.extract_all()
# Generate MCP configuration
config_path = converter.generate_mcp_config("my_config.yaml")
# Generate complete package
package_files = converter.generate_complete_package()
```
## Generated Tools
The converter creates comprehensive tool sets for interacting with your Power BI data:
### Core Database Tools
- `execute_sql`: Execute arbitrary SQL queries
- `list_powerbi_tables`: List all available tables
- `describe_powerbi_table`: Get table schema information
- `count_table_records`: Count records in any table
- `get_table_sample`: Get sample data from tables
### DAX Analysis Tools
- `get_dax_measures`: Access DAX measure definitions
- `search_dax_expressions`: Search through DAX code
- `get_dax_complexity_analysis`: Analyze DAX complexity metrics
### UI Structure Tools
- `get_report_pages`: Access report page information
- `get_visualizations_by_type`: Query visualization metadata
- `get_page_visual_layout`: Get detailed visual layouts
### Data-Specific Tools
- Table-specific analysis tools based on your data
- Aggregation queries for key metrics
- Relationship navigation helpers
## Command Line Options
```bash
pbix-to-mcp report.pbix [options]
Options:
-o, --output-dir DIR Output directory
--config-name NAME MCP config file name
--skip-data Skip data model extraction
--skip-ui Skip UI structure extraction
--skip-dax Skip DAX expressions extraction
--data-limit N Maximum rows per table (default: 10000)
--complete-package Generate complete deployment package
--package-name NAME Package directory name
-v, --verbose Enable verbose logging
-q, --quiet Suppress console output
--log-file FILE Save logs to file
```
## Output Structure
```
report_mcp/
├── data/
│ └── powerbi_data.db # SQLite database with all data
├── report_mcp_config.yaml # MCP server configuration
├── extraction_results.json # Complete extraction metadata
├── conversion.log # Detailed processing log
└── README.md # Generated documentation
```
## Advanced Usage
### Custom Extraction
```python
from pbix_to_mcp.extractors import DataExtractor, UIExtractor, DAXExtractor
# Extract specific components
data_extractor = DataExtractor("report.pbix")
data_model = data_extractor.extract_data_model(data_limit=5000)
ui_extractor = UIExtractor("report.pbix")
ui_structure = ui_extractor.extract_ui_structure()
dax_extractor = DAXExtractor("report.pbix")
dax_expressions = dax_extractor.extract_all_dax()
```
### Custom MCP Configuration
```python
from pbix_to_mcp.generators import MCPConfigGenerator
generator = MCPConfigGenerator(output_dir)
config_path = generator.generate_config(
extraction_results,
config_name="custom_config.yaml",
toolsets=["basic-analysis", "dax-analysis"]
)
```
## Requirements
- Python 3.10+
- pbixray>=0.3.3
- pandas>=1.5.0
- pyyaml>=6.0
- Google's genai-toolbox (for running MCP server)
## Development
```bash
# Clone repository
git clone https://github.com/gavinHuang/pbix-to-mcp.git
cd pbix-to-mcp
# Install in development mode
pip install -e .[dev]
# Run tests
pytest
# Format code
black pbix_to_mcp/
isort pbix_to_mcp/
```
## Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if needed
5. Submit a pull request
## License
MIT License - see [LICENSE](LICENSE) file for details.
## Support
- 📖 [Documentation](https://github.com/gavinHuang/pbix-to-mcp/wiki)
- 🐛 [Issue Tracker](https://github.com/gavinHuang/pbix-to-mcp/issues)
- 💬 [Discussions](https://github.com/gavinHuang/pbix-to-mcp/discussions)
## Acknowledgments
- Built on [pbixray](https://github.com/pbixray/pbixray) for Power BI file parsing
- Integrates with [Google's genai-toolbox](https://github.com/google/genai-toolbox) for MCP servers
- Inspired by the Model Context Protocol specification
Raw data
{
"_id": null,
"home_page": null,
"name": "pbix-to-mcp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "powerbi, mcp, genai-toolbox, business-intelligence, data-analysis",
"author": "Generated by GenAI Toolbox",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/f4/73/5973d698f469207ad58471a1835aee066282b6378201f431144116e5fe95/pbix_to_mcp-0.1.0.tar.gz",
"platform": null,
"description": "# PBIX to MCP Converter\n\nConvert Power BI (.pbix) files into Model Context Protocol (MCP) servers using Google's genai-toolbox.\n\n## Background\n\nThe pain point of any SQL generation solutions based on text2sql, either they are agentic or RAG, remain the same: they are depends on LLM which is non-deterministic! While they create greate applications, it raise the question whether the dynamically generated queries (effectively code) are acurate therefore the results from these query can be trusted or not.\n\nHaving been working on data domain for ages, my idea is to make best use of existing powerbi reports (tested code!) rather than dynamic generate query (image using a system with code generated on the fly!).\n\nThis tool do three things:\n\n- Extract necessary information from powerbi reports (Thanks to `pbixray`)\n- Convert to a yaml file according to Google's `genai-toolbox`\n- Run `genai-toolbox` to get a MCP server, which you can connect to with any MCP-supported assistant client \n\n`genai-toolbox` allows you to pregenerated sql queries and expose them as MCP tool. So instead have LLM do everything: generate correct query, correct parameter, it now only need to make sure call the right tool, whose result can be easily spotted and evaluated. \n\n## Features\n\n- **Complete Data Extraction**: Extract data models, tables, relationships, and schema information\n- **DAX Analysis**: Parse DAX measures, calculated columns, and calculated tables with complexity analysis\n- **UI Structure**: Extract report pages, visualizations, bookmarks, and layout information\n- **SQLite Database**: Generate SQLite databases from embedded Power BI data\n- **MCP Configuration**: Create genai-toolbox compatible YAML configurations\n- **Modular Architecture**: Clean, extensible codebase for custom integrations\n\n## Quick Start\n\nHere's an example of what this tool can extract from a Power BI report:\n\n\n\n*Original Power BI dashboard with complex visualizations and data relationships*\n\nThe tool converts this into a comprehensive MCP server with dozens of specialized tools:\n\n\n\n*Generated MCP tools that provide programmatic access to all Power BI data and analytics*\n\nOnce configured, you can interact with your Power BI data through natural language in any MCP-compatible chat interface:\n\n\n\n*Example of using the MCP tools in a chat interface to query Power BI data naturally*\n\n### Installation\n\n```bash\npip install pbix-to-mcp\n```\n\n### Basic Usage\n\n```bash\n# Convert a Power BI file to MCP server\npbix-to-mcp report.pbix\n\n# Generate complete package\npbix-to-mcp report.pbix --complete-package\n\n# Custom output directory and configuration\npbix-to-mcp report.pbix -o my_output --config-name my_mcp.yaml\n```\n\n### Using the MCP Server\n\n1. **Install Google's genai-toolbox**:\n ```bash\n # Download from releases page\n export VERSION=0.12.0\n curl -O https://storage.googleapis.com/genai-toolbox/v$VERSION/linux/amd64/toolbox\n chmod +x toolbox\n ```\n\n2. **Start the MCP server**:\n ```bash\n ./toolbox --tools-file supply_chain_mcp.yaml\n ```\n \n > **Important**: Ensure the database path in the YAML config is correct for your environment. If running from a different directory, you may need to update the database path to be absolute or correctly relative.\n\n3. **Connect from your MCP client**:\n ```json\n {\n \"servers\": {\n \"powerbi-mcp\": {\n \"url\": \"http://localhost:5000/mcp\",\n \"headers\": {}\n }\n }\n }\n ```\n\n## Library Usage\n\n```python\nfrom pbix_to_mcp import PBIXConverter\n\n# Initialize converter\nconverter = PBIXConverter(\"report.pbix\")\n\n# Extract all components\nresults = converter.extract_all()\n\n# Generate MCP configuration\nconfig_path = converter.generate_mcp_config(\"my_config.yaml\")\n\n# Generate complete package\npackage_files = converter.generate_complete_package()\n```\n\n## Generated Tools\n\nThe converter creates comprehensive tool sets for interacting with your Power BI data:\n\n### Core Database Tools\n- `execute_sql`: Execute arbitrary SQL queries\n- `list_powerbi_tables`: List all available tables\n- `describe_powerbi_table`: Get table schema information\n- `count_table_records`: Count records in any table\n- `get_table_sample`: Get sample data from tables\n\n### DAX Analysis Tools\n- `get_dax_measures`: Access DAX measure definitions\n- `search_dax_expressions`: Search through DAX code\n- `get_dax_complexity_analysis`: Analyze DAX complexity metrics\n\n### UI Structure Tools\n- `get_report_pages`: Access report page information\n- `get_visualizations_by_type`: Query visualization metadata\n- `get_page_visual_layout`: Get detailed visual layouts\n\n### Data-Specific Tools\n- Table-specific analysis tools based on your data\n- Aggregation queries for key metrics\n- Relationship navigation helpers\n\n## Command Line Options\n\n```bash\npbix-to-mcp report.pbix [options]\n\nOptions:\n -o, --output-dir DIR Output directory\n --config-name NAME MCP config file name\n --skip-data Skip data model extraction\n --skip-ui Skip UI structure extraction\n --skip-dax Skip DAX expressions extraction\n --data-limit N Maximum rows per table (default: 10000)\n --complete-package Generate complete deployment package\n --package-name NAME Package directory name\n -v, --verbose Enable verbose logging\n -q, --quiet Suppress console output\n --log-file FILE Save logs to file\n```\n\n## Output Structure\n\n```\nreport_mcp/\n\u251c\u2500\u2500 data/\n\u2502 \u2514\u2500\u2500 powerbi_data.db # SQLite database with all data\n\u251c\u2500\u2500 report_mcp_config.yaml # MCP server configuration\n\u251c\u2500\u2500 extraction_results.json # Complete extraction metadata\n\u251c\u2500\u2500 conversion.log # Detailed processing log\n\u2514\u2500\u2500 README.md # Generated documentation\n```\n\n## Advanced Usage\n\n### Custom Extraction\n\n```python\nfrom pbix_to_mcp.extractors import DataExtractor, UIExtractor, DAXExtractor\n\n# Extract specific components\ndata_extractor = DataExtractor(\"report.pbix\")\ndata_model = data_extractor.extract_data_model(data_limit=5000)\n\nui_extractor = UIExtractor(\"report.pbix\")\nui_structure = ui_extractor.extract_ui_structure()\n\ndax_extractor = DAXExtractor(\"report.pbix\")\ndax_expressions = dax_extractor.extract_all_dax()\n```\n\n### Custom MCP Configuration\n\n```python\nfrom pbix_to_mcp.generators import MCPConfigGenerator\n\ngenerator = MCPConfigGenerator(output_dir)\nconfig_path = generator.generate_config(\n extraction_results,\n config_name=\"custom_config.yaml\",\n toolsets=[\"basic-analysis\", \"dax-analysis\"]\n)\n```\n\n## Requirements\n\n- Python 3.10+\n- pbixray>=0.3.3\n- pandas>=1.5.0\n- pyyaml>=6.0\n- Google's genai-toolbox (for running MCP server)\n\n## Development\n\n```bash\n# Clone repository\ngit clone https://github.com/gavinHuang/pbix-to-mcp.git\ncd pbix-to-mcp\n\n# Install in development mode\npip install -e .[dev]\n\n# Run tests\npytest\n\n# Format code\nblack pbix_to_mcp/\nisort pbix_to_mcp/\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if needed\n5. Submit a pull request\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Support\n\n- \ud83d\udcd6 [Documentation](https://github.com/gavinHuang/pbix-to-mcp/wiki)\n- \ud83d\udc1b [Issue Tracker](https://github.com/gavinHuang/pbix-to-mcp/issues)\n- \ud83d\udcac [Discussions](https://github.com/gavinHuang/pbix-to-mcp/discussions)\n\n## Acknowledgments\n\n- Built on [pbixray](https://github.com/pbixray/pbixray) for Power BI file parsing\n- Integrates with [Google's genai-toolbox](https://github.com/google/genai-toolbox) for MCP servers\n- Inspired by the Model Context Protocol specification\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Convert Power BI (.pbix) files to Model Context Protocol (MCP) servers using Google's genai-toolbox",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/gavinHuang/pbix-to-mcp",
"Issues": "https://github.com/gavinHuang/pbix-to-mcp/issues",
"Repository": "https://github.com/gavinHuang/pbix-to-mcp"
},
"split_keywords": [
"powerbi",
" mcp",
" genai-toolbox",
" business-intelligence",
" data-analysis"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "086c55b4dd8a12f387b0088debe565b5548b49d19314c90f657f2f1e704518c9",
"md5": "195eb1c6aaa01721bcbbac76d5c04638",
"sha256": "51dc380c4d77187c4e4e3a720359da6e84e95e5d4e4d5630201d1a2c5d075ec1"
},
"downloads": -1,
"filename": "pbix_to_mcp-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "195eb1c6aaa01721bcbbac76d5c04638",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 40953,
"upload_time": "2025-08-24T01:46:06",
"upload_time_iso_8601": "2025-08-24T01:46:06.959771Z",
"url": "https://files.pythonhosted.org/packages/08/6c/55b4dd8a12f387b0088debe565b5548b49d19314c90f657f2f1e704518c9/pbix_to_mcp-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f4735973d698f469207ad58471a1835aee066282b6378201f431144116e5fe95",
"md5": "3aa4bf7da107829f125865bcc3a4f9be",
"sha256": "2740de9023df2ccc5089c8e5a6928c63723a6d1ee0028b207ac73798dccf63f9"
},
"downloads": -1,
"filename": "pbix_to_mcp-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "3aa4bf7da107829f125865bcc3a4f9be",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 39877,
"upload_time": "2025-08-24T01:46:08",
"upload_time_iso_8601": "2025-08-24T01:46:08.317531Z",
"url": "https://files.pythonhosted.org/packages/f4/73/5973d698f469207ad58471a1835aee066282b6378201f431144116e5fe95/pbix_to_mcp-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-24 01:46:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gavinHuang",
"github_project": "pbix-to-mcp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pbix-to-mcp"
}