How to integrate Microsoft Power Bi MCP with Claude Agent SDK

This guide walks you through connecting Microsoft Power Bi to the Claude Agent SDK 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 Claude Agent SDK 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 the Claude Agent SDK 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 Claude Agent SDK 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 Claude/Anthropic and Composio API keys
  • Install the necessary dependencies
  • Initialize Composio and create a Tool Router session for Microsoft Power Bi
  • Configure an AI agent that can use Microsoft Power Bi as a tool
  • Run a live chat session where you can ask the agent to perform Microsoft Power Bi operations

What is Claude Agent SDK?

The Claude Agent SDK is Anthropic's official framework for building AI agents powered by Claude. It provides a streamlined interface for creating agents with MCP tool support and conversation management.

Key features include:

  • Native MCP Support: Built-in support for Model Context Protocol servers
  • Permission Modes: Control tool execution permissions
  • Streaming Responses: Real-time response streaming for interactive applications
  • Context Manager: Clean async context management for sessions

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 step09 STEPS
1

Prerequisites

Before starting, make sure you have:
  • Composio API Key and Claude/Anthropic API Key
  • Primary know-how of Claude Agents SDK
  • A Microsoft Power Bi account
  • Some knowledge of Python
2

Getting API Keys for Claude/Anthropic and Composio

Claude/Anthropic API Key
  • Go to the Anthropic Console and create an API key. You'll need credits to use the models.
  • 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

npm install @anthropic-ai/claude-agent-sdk @composio/core dotenv

Install the Composio SDK and the Claude Agents SDK.

What's happening:

  • @composio/core provides Composio integration for Anthropic
  • @anthropic-ai/claude-agent-sdk is the core agent framework
  • dotenv/config loads environment variables
4

Set up environment variables

bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here

Create a .env file in your project root.

What's happening:

  • COMPOSIO_API_KEY authenticates with Composio
  • USER_ID identifies the user for session management
  • ANTHROPIC_API_KEY authenticates with Anthropic/Claude
5

Import dependencies

import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

dotenv.config();
What's happening:
  • We're importing all necessary libraries including the Claude Agent SDK and Composio
  • The dotenv.config() function loads environment variables from your .env file
  • This setup prepares the foundation for connecting Claude with Microsoft Power Bi functionality
6

Create a Composio instance and Tool Router session

async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });

  // Create Tool Router session for Microsoft Power Bi
  const session = await composio.create(USER_ID, {
    toolkits: ['microsoft_power_bi'],
  });
  const mcpUrl = session?.mcp.url;
What's happening:
  • The function checks for the required COMPOSIO_API_KEY environment variable
  • We're creating a Composio instance using our API key
  • The create method creates a Tool Router session for Microsoft Power Bi
  • The returned url is the MCP server URL that your agent will use
7

Configure Claude Agent with MCP

const options: Options = {
  permissionMode: 'bypassPermissions',
  mcpServers: {
    composio: {
      type: 'http',
      url: mcpUrl,
      headers: { 'x-api-key': COMPOSIO_API_KEY }
    }
  },
  systemPrompt: 'You are a helpful assistant with access to Microsoft Power Bi tools via Composio.',
  maxTurns: 10,
};
What's happening:
  • We're configuring the Claude Agent options with the MCP server URL
  • permissionMode: 'bypassPermissions' allows the agent to execute operations without asking for permission each time
  • The system prompt instructs the agent that it has access to Microsoft Power Bi
  • maxTurns: 10 limits the conversation length to prevent excessive API usage
8

Create client and start chat loop

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}
What's happening:
  • The readline interface is created to handle user input and output
  • The query function is used to send the user's input to the agent
  • The chat loop continues until the user types 'exit' or 'quit'
9

Run the application

try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}
What's happening:
  • The chat function is the entry point for the application
  • The try-catch block is used to handle any errors that occur

Complete Code

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

import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });
  const session = await composio.create(USER_ID, {
    toolkits: ['microsoft_power_bi']
  });
  const mcp_url = session?.mcp.url;

  const options: Options = {
    permissionMode: 'bypassPermissions',
    mcpServers: {
      composio: {
        type: 'http',
        url: mcp_url,
        headers: { 'x-api-key': COMPOSIO_API_KEY }
      }
    },
    systemPrompt: 'You are a helpful assistant with access to Microsoft Power Bi tools via Composio.',
    maxTurns: 10,
  };

  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}

try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}

Conclusion

You've successfully built a Claude Agent SDK agent that can interact with Microsoft Power Bi through Composio's Tool Router.

Key features:

  • Native MCP support through Claude's agent framework
  • Streaming responses for real-time interaction
  • Permission bypass for smooth automated workflows
You can extend this by adding more toolkits, implementing custom business logic, or building a web interface around the agent.
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. Claude Agent SDK 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