How to integrate Microsoft Power Bi MCP with Autogen

This guide walks you through connecting Microsoft Power Bi to AutoGen using the Composio tool router. By the end, you'll have a working Microsoft Power Bi agent that can list dashboards in your workspace, refresh the sales performance dataset, summarize quarterly revenue report insights through natural language commands. This guide will help you understand how to give your AutoGen agent real control over a Microsoft Power Bi account through Composio's Microsoft Power Bi MCP server. Before we dive in, let's take a quick look at the key ideas and tools involved.

Microsoft Power Bi logoMicrosoft Power Bi
Oauth2

Microsoft Power BI is Microsoft's business analytics service for dashboards, reports, datasets, and interactive data visualizations. Use it to turn business data into clear insights that teams can explore, share, and act on.

116 Tools

Introduction

This guide walks you through connecting Microsoft Power Bi to AutoGen using the Composio tool router. By the end, you'll have a working Microsoft Power Bi agent that can list dashboards in your workspace, refresh the sales performance dataset, summarize quarterly revenue report insights through natural language commands.

This guide will help you understand how to give your AutoGen agent real control over a Microsoft Power Bi account through Composio's Microsoft Power Bi MCP server.

Before we dive in, let's take a quick look at the key ideas and tools involved.

Also integrate Microsoft Power Bi with

TL;DR

Here's what you'll learn:
  • Get and set up your OpenAI and Composio API keys
  • Install the required dependencies for Autogen and Composio
  • Initialize Composio and create a Tool Router session for Microsoft Power Bi
  • Wire that MCP URL into Autogen using McpWorkbench and StreamableHttpServerParams
  • Configure an Autogen AssistantAgent that can call Microsoft Power Bi tools
  • Run a live chat loop where you ask the agent to perform Microsoft Power Bi operations

What is AutoGen?

Autogen is a framework for building multi-agent conversational AI systems from Microsoft. It enables you to create agents that can collaborate, use tools, and maintain complex workflows.

Key features include:

  • Multi-Agent Systems: Build collaborative agent workflows
  • MCP Workbench: Native support for Model Context Protocol tools
  • Streaming HTTP: Connect to external services through streamable HTTP
  • AssistantAgent: Pre-built agent class for tool-using assistants

What is the Microsoft Power Bi MCP server, and what's possible with it?

The Microsoft Power Bi MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Microsoft Power Bi account. It provides structured and secure access to your workspaces, dashboards, reports, datasets, dataflows, and scorecards, so your agent can create analytics resources, retrieve business insights, run DAX queries, manage reports, and prepare content for embedding on your behalf.

  • Workspace and dashboard management: Have your agent create or delete workspaces, add dashboards, and list the dashboards available in a workspace.
  • Report and dataset operations: Let the agent retrieve datasets, list reports from an app, clone reports, delete reports, and create push datasets.
  • Business data analysis: Direct your agent to run DAX queries against Power BI datasets and return the results for analysis or summaries.
  • Scorecard and goal tracking: Instruct your agent to create scorecards, record goal value check-ins, and remove goals, notes, or status rules when needed.
  • Embedded analytics access: Have your agent generate viewing or editing tokens for dashboards, reports, and datasets that you want to embed in an application.

What is the Composio tool router, and how does it fit here?

What is Composio SDK?

Composio's Composio SDK helps agents find the right tools for a task at runtime. You can plug in multiple toolkits (like Gmail, HubSpot, and GitHub), and the agent will identify the relevant app and action to complete multi-step workflows. This can reduce token usage and improve the reliability of tool calls. Read more here: Getting started with Composio SDK

The tool router generates a secure MCP URL that your agents can access to perform actions.

How the Composio SDK works

The Composio SDK follows a three-phase workflow:

  1. Discovery: Searches for tools matching your task and returns relevant toolkits with their details.
  2. Authentication: Checks for active connections. If missing, creates an auth config and returns a connection URL via Auth Link.
  3. Execution: Executes the action using the authenticated connection.

Step-by-step Guide

Step by step08 STEPS
1

Prerequisites

You will need:

  • A Composio API key
  • An OpenAI API key (used by Autogen's OpenAIChatCompletionClient)
  • A Microsoft Power Bi account you can connect to Composio
  • Some basic familiarity with Autogen and Python async
2

Getting API Keys for OpenAI and Composio

OpenAI API Key
  • Go to the OpenAI dashboard and create an API key. You'll need credits to use the models, or you can connect to another model provider.
  • Keep the API key safe.
Composio API Key
  • Log in to the Composio dashboard.
  • Navigate to your API settings and generate a new API key.
  • Store this key securely as you'll need it for authentication.
3

Install dependencies

bash
pip install composio python-dotenv
pip install autogen-agentchat autogen-ext-openai autogen-ext-tools

Install Composio, Autogen extensions, and dotenv.

What's happening:

  • composio connects your agent to Microsoft Power Bi via MCP
  • autogen-agentchat provides the AssistantAgent class
  • autogen-ext-openai provides the OpenAI model client
  • autogen-ext-tools provides MCP workbench support

4

Set up environment variables

bash
COMPOSIO_API_KEY=your-composio-api-key
OPENAI_API_KEY=your-openai-api-key
USER_ID=your-user-identifier@example.com

Create a .env file in your project folder.

What's happening:

  • COMPOSIO_API_KEY is required to talk to Composio
  • OPENAI_API_KEY is used by Autogen's OpenAI client
  • USER_ID is how Composio identifies which user's Microsoft Power Bi connections to use
5

Import dependencies and create Tool Router session

python
import asyncio
import os
from dotenv import load_dotenv
from composio import Composio

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.mcp import McpWorkbench, StreamableHttpServerParams

load_dotenv()

async def main():
    # Initialize Composio and create a Microsoft Power Bi session
    composio = Composio(api_key=os.getenv("COMPOSIO_API_KEY"))
    session = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["microsoft_power_bi"]
    )
    url = session.mcp.url
What's happening:
  • load_dotenv() reads your .env file
  • Composio(api_key=...) initializes the SDK
  • create(...) creates a Tool Router session that exposes Microsoft Power Bi tools
  • session.mcp.url is the MCP endpoint that Autogen will connect to
6

Configure MCP parameters for Autogen

python
# Configure MCP server parameters for Streamable HTTP
server_params = StreamableHttpServerParams(
    url=url,
    timeout=30.0,
    sse_read_timeout=300.0,
    terminate_on_close=True,
    headers={"x-api-key": os.getenv("COMPOSIO_API_KEY")}
)

Autogen expects parameters describing how to talk to the MCP server. That is what StreamableHttpServerParams is for.

What's happening:

  • url points to the Tool Router MCP endpoint from Composio
  • timeout is the HTTP timeout for requests
  • sse_read_timeout controls how long to wait when streaming responses
  • terminate_on_close=True cleans up the MCP server process when the workbench is closed
7

Create the model client and agent

python
# Create model client
model_client = OpenAIChatCompletionClient(
    model="gpt-5",
    api_key=os.getenv("OPENAI_API_KEY")
)

# Use McpWorkbench as context manager
async with McpWorkbench(server_params) as workbench:
    # Create Microsoft Power Bi assistant agent with MCP tools
    agent = AssistantAgent(
        name="microsoft_power_bi_assistant",
        description="An AI assistant that helps with Microsoft Power Bi operations.",
        model_client=model_client,
        workbench=workbench,
        model_client_stream=True,
        max_tool_iterations=10
    )

What's happening:

  • OpenAIChatCompletionClient wraps the OpenAI model for Autogen
  • McpWorkbench connects the agent to the MCP tools
  • AssistantAgent is configured with the Microsoft Power Bi tools from the workbench
8

Run the interactive chat loop

python
print("Chat started! Type 'exit' or 'quit' to end the conversation.\n")
print("Ask any Microsoft Power Bi related question or task to the agent.\n")

# Conversation loop
while True:
    user_input = input("You: ").strip()

    if user_input.lower() in ["exit", "quit", "bye"]:
        print("\nGoodbye!")
        break

    if not user_input:
        continue

    print("\nAgent is thinking...\n")

    # Run the agent with streaming
    try:
        response_text = ""
        async for message in agent.run_stream(task=user_input):
            if hasattr(message, "content") and message.content:
                response_text = message.content

        # Print the final response
        if response_text:
            print(f"Agent: {response_text}\n")
        else:
            print("Agent: I encountered an issue processing your request.\n")

    except Exception as e:
        print(f"Agent: Sorry, I encountered an error: {str(e)}\n")
What's happening:
  • The script prompts you in a loop with You:
  • Autogen passes your input to the model, which decides which Microsoft Power Bi tools to call via MCP
  • agent.run_stream(...) yields streaming messages as the agent thinks and calls tools
  • Typing exit, quit, or bye ends the loop

Complete Code

Here's the complete code to get you started with Microsoft Power Bi and AutoGen:

python
import asyncio
import os
from dotenv import load_dotenv
from composio import Composio

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.mcp import McpWorkbench, StreamableHttpServerParams

load_dotenv()

async def main():
    # Initialize Composio and create a Microsoft Power Bi session
    composio = Composio(api_key=os.getenv("COMPOSIO_API_KEY"))
    session = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["microsoft_power_bi"]
    )
    url = session.mcp.url

    # Configure MCP server parameters for Streamable HTTP
    server_params = StreamableHttpServerParams(
        url=url,
        timeout=30.0,
        sse_read_timeout=300.0,
        terminate_on_close=True,
        headers={"x-api-key": os.getenv("COMPOSIO_API_KEY")}
    )

    # Create model client
    model_client = OpenAIChatCompletionClient(
        model="gpt-5",
        api_key=os.getenv("OPENAI_API_KEY")
    )

    # Use McpWorkbench as context manager
    async with McpWorkbench(server_params) as workbench:
        # Create Microsoft Power Bi assistant agent with MCP tools
        agent = AssistantAgent(
            name="microsoft_power_bi_assistant",
            description="An AI assistant that helps with Microsoft Power Bi operations.",
            model_client=model_client,
            workbench=workbench,
            model_client_stream=True,
            max_tool_iterations=10
        )

        print("Chat started! Type 'exit' or 'quit' to end the conversation.\n")
        print("Ask any Microsoft Power Bi related question or task to the agent.\n")

        # Conversation loop
        while True:
            user_input = input("You: ").strip()

            if user_input.lower() in ['exit', 'quit', 'bye']:
                print("\nGoodbye!")
                break

            if not user_input:
                continue

            print("\nAgent is thinking...\n")

            # Run the agent with streaming
            try:
                response_text = ""
                async for message in agent.run_stream(task=user_input):
                    if hasattr(message, 'content') and message.content:
                        response_text = message.content

                # Print the final response
                if response_text:
                    print(f"Agent: {response_text}\n")
                else:
                    print("Agent: I encountered an issue processing your request.\n")

            except Exception as e:
                print(f"Agent: Sorry, I encountered an error: {str(e)}\n")

if __name__ == "__main__":
    asyncio.run(main())

Conclusion

You now have an Autogen assistant wired into Microsoft Power Bi through Composio's Tool Router and MCP. From here you can:
  • Add more toolkits to the toolkits list, for example notion or hubspot
  • Refine the agent description to point it at specific workflows
  • Wrap this script behind a UI, Slack bot, or internal tool
Once the pattern is clear for Microsoft Power Bi, you can reuse the same structure for other MCP-enabled apps with minimal code changes.
TOOLS

Supported Tools

Every Microsoft Power Bi action and event your agent gets out of the box.

Add Dashboard to Workspace

Creates a new empty dashboard in the specified workspace.

Get Reports From App

Returns a list of reports from the specified app.

Assign Workspace to Capacity

Assigns the specified workspace to the specified capacity.

Cancel Dataset Refresh in Workspace

Cancels the specified refresh operation for the specified dataset from the specified workspace.

Clone Report

Clones the specified report from My workspace.

Clone Report in Workspace

Clones the specified report from the specified workspace.

Create Goal Value Check-in

Creates a new goal value check-in for a Power BI scorecard goal.

Create Workspace

Creates a new workspace in Power BI.

Create Push Dataset

Creates a new dataset on My workspace in Power BI.

Create Scorecard

Creates a new scorecard in the specified Power BI workspace.

Create Temporary Upload Location

Creates a temporary blob storage upload location for importing large Power BI .

Create Temporary Upload Location

Creates a temporary blob storage upload location for importing large Power BI .

Delete Dashboard

Deletes the specified dashboard from My workspace.

Delete Dataflow

Deletes the specified dataflow from Power BI data prep storage, including its definition file and model.

Delete Dataset

Deletes the specified dataset from My workspace.

Delete Dataset from Workspace

Deletes the specified dataset from the specified workspace.

Delete Goal

Deletes a goal from a scorecard by goal ID.

Delete Goal Note by ID

Deletes a goal value check-in note by its unique identifier.

Delete Goal Status Rules

Removes status rule definitions from a goal.

Delete Pipeline User

Removes user permissions from the specified deployment pipeline.

Delete Report from Workspace

Deletes the specified report from the specified workspace.

Delete Rows from Dataset Table

Deletes all rows from the specified table within the specified dataset from My workspace.

Delete Rows from Dataset Table in Workspace

Deletes all rows from the specified table within the specified dataset from the specified workspace.

Delete Scorecard By ID

Deletes a scorecard by its ID from the specified workspace.

Delete Workspace

Deletes the specified workspace.

Discover Gateways for Dataset

Returns a list of gateways that the specified dataset from the specified workspace can be bound to.

Execute DAX Queries

Executes Data Analysis Expressions (DAX) queries against the provided dataset in My workspace.

Execute DAX Queries on Dataset

Executes Data Analysis Expressions (DAX) queries against the specified Power BI dataset.

Execute Subscription

Executes the Subscription specified by the Id.

Generate Dashboard Embed Token

Generates an embed token to view or edit the specified dashboard from the specified workspace.

Generate Embed Token for Power BI

Generates an embed token for multiple reports, datasets, and target workspaces.

Generate Report Embed Token in Group

Generates an embed token to view or edit the specified report from the specified workspace.

Generate Dataset Embed Token in Group

Generates an embed token based on the specified dataset from the specified workspace.

Get Available Feature By Name

Returns the specified available feature for the user by name.

Get Capacities

Returns a list of Power BI capacities that the authenticated user has access to.

Get Dashboard from My Workspace

Returns the specified dashboard from My workspace.

Get Dashboards

Returns a list of dashboards from the specified workspace.

Get Dataflows

Returns a list of all dataflows from the specified workspace.

Get Dataset

Returns the specified dataset from My workspace.

Get Dataset in Workspace

Returns the specified dataset from the specified workspace.

Get DataSet Data

Gets the query results for the specified DataSet.

Get Datasets from My Workspace

Returns a list of datasets from My workspace.

Get DataSets from Power BI

Gets an array of DataSet CatalogItems from Power BI.

Get Dataset to Dataflows Links

Returns a list of upstream dataflows for datasets from the specified workspace.

Get Dataset Users

Returns a list of principals that have access to the specified dataset.

Get Dataset Users In Group

Returns a list of principals that have access to the specified dataset within a workspace.

Get Datasources for Dataset

Returns a list of data sources for the specified dataset from My workspace.

Get Datasources for Dataset in Workspace

Returns a list of data sources for the specified dataset from the specified workspace.

Get Gateway

Returns the specified gateway.

Get Gateway Datasources in Group

Returns a list of gateway data sources for the specified dataset from the specified workspace.

Get Gateways

Returns a list of gateways for which the user is an admin.

Get Goals from Scorecard

Returns a list of goals from a scorecard.

Get Goals Refresh History

Reads refresh history of a connected goal.

Get Goals Status Rules

Returns status rules of a goal.

Get Goal Value By ID

Reads a goal value check-in by a UTC date timestamp.

Get Groups

Returns a list of workspaces the user has access to.

Get Groups Capacity Assignment Status

Gets the status of the assignment-to-capacity operation for the specified workspace.

Get Group Users

Returns a list of users that have access to the specified workspace.

Get Import

Returns the specified import from My workspace.

Get Imports from My Workspace

Returns a list of imports from My workspace.

Get Imports in Workspace

Returns a list of imports from the specified workspace.

Get Linked Report History Snapshot

Gets requested HistorySnapshot item specified by HistoryId of the LinkedReport specified by Id.

Get Report Page

Returns the specified page within the specified report from the specified workspace.

Get Pages from Report

Returns a list of pages within the specified report from the specified workspace.

Get Pages from Report in My Workspace

Returns a list of pages within the specified report from My workspace.

Get Dataset Parameters

Returns a list of parameters for the specified dataset from **My workspace**.

Get Dataset Parameters in Workspace

Returns a list of parameters for the specified dataset from the specified workspace.

Get Query Scale Out Sync Status

Returns the query scale-out sync status for the specified dataset from the specified workspace.

Get Refreshable For Capacity

Returns the specified refreshable for the specified capacity that the user has access to.

Get refreshables for all capacities

Returns a list of refreshables for all capacities that the user has access to.

Get Refresh Execution Details In Group

Returns execution details of a refresh operation for the specified dataset from the specified workspace.

Get Refresh History for Dataset

Returns the refresh history for the specified dataset from My workspace.

Get Dataset Refresh Schedule

Returns the refresh schedule for the specified dataset from My workspace.

Get Refresh Schedule In Group 2

Returns the refresh schedule for the specified dataset from the specified workspace.

Get Report from My Workspace

Returns the specified report from My workspace.

Get Report Page From My Workspace

Returns the specified page within the specified report from My workspace.

Get Reports

Gets an array of Report CatalogItems from Power BI.

Get Reports From My Workspace

Returns a list of reports from My workspace.

Get Resources

Gets an array of Resource catalog items.

Get Scorecard By ID

Returns a scorecard with the specified ID.

Get Scorecards

Returns a list of scorecards from a workspace.

Get Tables in Dataset

Returns a list of tables within the specified dataset from My workspace.

Get Tables in Dataset within Workspace

Returns a list of tables within the specified dataset from the specified workspace.

Get Tiles from My Workspace Dashboard

Returns a list of tiles within the specified dashboard from My workspace.

Get Tiles from Workspace Dashboard

Returns a list of tiles within the specified dashboard from the specified workspace.

Get Workspace

Returns a specified workspace (group).

Trigger Query Scale Out Sync in Workspace

Triggers a query scale-out sync of read-only replicas for the specified dataset from the specified workspace.

Move Power BI Scorecard Goals

Moves goals within the scorecard.

Patch Goal Note

Updates a goal value check-in note by ID.

Patch Goal Value By ID

Updates a goal value check-in by a UTC date timestamp.

Patch Scorecard By ID

Updates a scorecard by its ID.

Create Push Dataset in Workspace

Creates a new push dataset in the specified Power BI workspace.

Grant Dataset User Permissions

Grants the specified user's permissions to the specified dataset.

Grant Dataset User Permissions In Group

Grants the specified user's permissions to the specified dataset in a workspace.

Post Goal

Adds a new goal to a Power BI scorecard.

Post Goal Note

Adds a new note to a goal value check-in for a Power BI scorecard goal.

Add Rows to Dataset Table in Workspace

Adds new data rows to the specified table within the specified dataset from the specified workspace.

Post Goal Status Rules

Creates or updates status rules of a goal in Power BI.

Update Table Schema

Updates the metadata and schema for the specified table within the specified dataset from My workspace.

Update Table Schema in Workspace

Updates the metadata and schema for the specified table within the specified dataset from the specified workspace.

Rebind Report to Dataset

Rebinds the specified report from the specified workspace to the specified dataset.

Trigger Dataset Refresh in Workspace

Triggers a refresh for the specified dataset from the specified workspace.

Generate Report Embed Token for Create in Group

Generates an embed token to allow report creation in the specified workspace based on the specified dataset.

Set Linked Report Cache Options

Replaces the CacheOption's content for a given LinkedReport using the provided definition.

Take Over Dataset

Transfers ownership over the specified dataset to the current authorized user.

Take Over Paginated Report Ownership

Transfers ownership of the data sources for the specified paginated report (RDL) to the current authorized user.

Trigger Query Scale Out Sync

Triggers a query scale-out sync of read-only replicas for the specified dataset from My workspace.

Update Dataset

Updates the properties for the specified dataset from My workspace.

Update Dataset In Workspace

Updates the properties for the specified dataset from the specified workspace.

Update Paginated Report Data Sources

Updates the data sources of the specified paginated report (RDL) from the specified workspace.

Patch Goal By ID

Updates a goal by its ID within a Power BI scorecard.

Update Dataset Parameters in Workspace

Updates the parameters values for the specified dataset from the specified workspace.

Update Refresh Schedule

Updates the refresh schedule for the specified dataset from My workspace.

Update Refresh Schedule In Group

Updates the refresh schedule for the specified dataset from the specified workspace.

Update Report Content

Updates the content of the specified report from **My workspace** with the content of a specified source report.

Update Workspace

Updates the properties for the specified workspace.

FAQ

Frequently asked questions

With a standalone Microsoft Power Bi MCP server, the agents and LLMs can only access a fixed set of Microsoft Power Bi tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Microsoft Power Bi and many other apps based on the task at hand, all through a single MCP endpoint.

Yes, you can. Autogen fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Microsoft Power Bi tools.

Yes, absolutely. You can configure which Microsoft Power Bi scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Microsoft Power Bi data and credentials are handled as safely as possible.

Start with Microsoft Power Bi.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Microsoft Power Bi tool your agent needs.Free to start.

Start building