How I Built a Power Apps MCP Server That Deploys Custom Code Apps While I Drink Coffee



Power Platform × AI Automation

Stop Clicking, Start Shipping: The MCP Server That Lets Claude Build & Deploy Power Apps in 60 Seconds

How a custom MCP server gives Claude Desktop 16 tools to create Dataverse tables, scaffold React apps, write custom code, build, deploy, and manage solutions—without ever opening the maker portal.

16MCP Tools
0Portal Clicks
60sDeploy Time
14Source Files
Download MCP Server (.zip)

Everything you need — 16 source files, ready to build

The Problem: Manual Everything

Every enterprise Power Platform team knows the pain. You need a new app. You open the maker portal. You click through wizard after wizard. You manually configure Dataverse tables, painstakingly set up columns, enter sample data row by row, scaffold a code app, wrestle with TypeScript build errors, fix deployment issues, share with users, assign security roles.

A process that should take minutes takes hours.

And every time you need a change—a new column, an updated UI, a fresh deployment—you’re back in the portal clicking through the same workflows again.

What if you could just tell an AI what you want and have it build, deploy, and share the entire app automatically?

The Solution: An AI That Builds Power Apps

That’s exactly what this project does. The Power Apps MCP Server connects Claude Desktop directly to your Power Platform environment through Anthropic’s Model Context Protocol. It gives Claude 16 tools that automate the entire Code App lifecycle—from Dataverse table creation to production deployment—in a single conversation.

“Build me an Employee Onboarding portal with a sidebar, dashboard, new hire form, and checklist. Use corporate blue branding. Deploy to Power Platform.”

Claude takes that prompt and does everything: creates the Dataverse tables, writes custom React components, scaffolds the project, builds it, deploys it, and shares it with your team. You drink coffee.

All 16 Tools

CategoryToolDescription
Dataversecreate_dataverse_tableCreate table with typed columns
Dataverseinsert_sample_dataInsert rows with realistic data
Dataverselist_security_rolesList all environment roles
Dataverseassign_security_roleAssign role to user/group
Code Appwrite_fileNEWWrite ANY file to a project (the file bridge)
Code Apprun_commandNEWRun any shell command in project dir
Code Appscaffold_code_appCreate React+TS project (+customAppCode, +customFiles)
Code Appbuild_code_appCompile with Vite (+replaceFiles before build)
Code Appdeploy_code_appBuild + deploy (+replaceFiles before build)
Sharinglist_appsList all Power Apps in environment
Sharingshare_appShare app and assign security roles
Pipelinefull_pipelineEnd-to-end in one call
Solutioncreate_solutionNEWCreate solution container
Solutiondeploy_to_solutionNEWDeploy app into a specific solution
Solutionlist_solutionsNEWList all solutions
Solutionexport_solutionNEWExport as managed/unmanaged .zip

The Breakthrough: File Write Bridge

Previous versions had a critical limitation: Claude could scaffold projects with pre-built templates, but couldn’t write custom React code to the Windows filesystem. Every app looked the same.

Version 4 solves this with three new capabilities:

1. write_file — The File Bridge

Claude can now write any file to any path inside a Code App project. Custom components, styles, utilities, configuration—anything. This is the bridge between Claude’s intelligence and your Windows filesystem.

2. customAppCode + customFiles on Scaffold

When creating a new project, Claude injects a completely custom App.tsx and additional component files in a single operation.

3. replaceFiles on Build/Deploy

Even after scaffolding, Claude can replace any files right before building and deploying. Scaffold once, iterate forever.

7 Production Bugs We Crushed

Building this was not smooth. Here’s what broke and how we fixed it:

#BugSymptomFix
1ToolResult interface10 TypeScript errorsAdded [key: string]: unknown
2PowerProvider wrapperBlank page after deployRemoved entirely
3tsc -b in build scriptBuild always failsPatched to vite build only
4API version 2024-05-01Share app returns 400Updated to 2025-04-01
5Vite /assets/ subfolder404 on JS/CSSFlat output config
6App.tsx SVG importBuild error after cleanupWrites minimal App.tsx
7Generated services importCRUD imports missing filesUses fetch() directly

Complete Setup Guide

Follow these 4 phases to go from zero to deploying custom Power Apps in about 20 minutes.

🔧

Phase 1 — Prerequisites

Install required tools

1

Install Required Tools

node --version     # v20+
npm --version      # 10+
pac --version      # 1.49+
2

Connect PAC CLI

pac auth create --environment https://YOUR-ORG.crm.dynamics.com
pac auth list
pac org who
3

Azure AD App Registration

  1. Azure Portal → App registrations → New registration
  2. Name: PowerApps-MCP-Server
  3. Add API permissions: Dynamics CRM → user_impersonation and PowerApps Service → User
  4. Grant admin consent
  5. Create a client secret under Certificates & secrets
  6. Note your Tenant IDClient ID, and Client Secret
🔒

Security: Never share your client secret in plain text, commit it to version control, or include it in documentation. Store it securely and rotate it regularly.

📁

Phase 2 — Project Files

Extract zip or copy files from the Source Files section below

4

Create Project Folder

mkdir C:\Projects\powerapps-mcp-server
cd C:\Projects\powerapps-mcp-server
mkdir src\services src\schemas src\templates src\tools
💡

Have the zip? Extract to C:\Projects\ and skip straight to Phase 3. ⬇ Download it here

⚙️

Phase 3 — Build & Configure

Install, build, connect to Claude Desktop

5

Install & Build

cd C:\Projects\powerapps-mcp-server
npm install
npm run build          # Zero errors expected
node dist\index.js     # Should list 16 tools — Ctrl+C to stop
mkdir C:\Projects\PowerAppsCodeApps
6

Configure Claude Desktop

Open your config file:

OSPath
Windows%APPDATA%\Claude\claude_desktop_config.json
macOS~/Library/Application Support/Claude/claude_desktop_config.json

Paste this, replacing placeholders with your actual values:

{
  "mcpServers": {
    "powerapps": {
      "command": "node",
      "args": ["C:/Projects/powerapps-mcp-server/dist/index.js"],
      "env": {
        "AZURE_TENANT_ID": "<your-tenant-id>",
        "AZURE_CLIENT_ID": "<your-client-id>",
        "AZURE_CLIENT_SECRET": "<your-client-secret>",
        "DATAVERSE_ENVIRONMENT_URL": "https://YOUR-ORG.crm.dynamics.com",
        "POWERAPPS_ENVIRONMENT_ID": "<your-environment-id>",
        "POWERAPPS_WORKING_DIR": "C:/Projects/PowerAppsCodeApps"
      }
    }
  }
}
  1. Save the file
  2. Quit Claude Desktop completely (system tray → Quit)
  3. Reopen Claude Desktop
  4. Click 🔨 tools icon — should show 16 Power Apps tools
🎉

16 tools visible = fully connected and ready to deploy!

🚀

Phase 4 — Deploy

Clean up, test, ship it

7

Clean Up Old Apps

🚨

Delete all folders in C:\Projects\PowerAppsCodeApps\ — apps from previous versions have broken templates. v4 creates clean apps.

8

Test Authentication

Type in Claude Desktop:

List the security roles in my Dataverse environment

If you see roles listed, auth is working.

9

Deploy Your First App 🚀

Build me a Task Manager code app:
- Create cr_task table with title, description, status, priority, duedate
- Add 5 sample tasks
- Scaffold, build, and deploy to Power Platform

All Source Files

Every file needed to build the MCP server. Click any file to expand, then use Copy to grab the contents.


Usage Examples

Simple App

Build a Task Manager app with a cr_task table, add sample data, and deploy.

Custom Code (Game-Changer)

Build an Employee Onboarding portal with sidebar navigation, a dashboard with progress cards, a new hire form, and a checklist component. Use blue corporate branding. Deploy to Power Platform.

Claude writes custom React components using write_file and customAppCode, then builds and deploys.

Solution Deployment

Create a solution called PNCBankingApps with publisher prefix pnc. Build a task tracker and deploy it into that solution. Export as unmanaged zip.

Iterate on Existing App

Replace App.tsx in my task-manager project with a Kanban board interface, then rebuild and deploy.

Uses deploy_code_app with replaceFiles — one-step inject + deploy.

Install Extra Packages

Install lucide-react icons in my task-manager project, then rebuild.

Uses run_commandnpm install lucide-react.


Troubleshooting

ProblemFix
Blank page after deployv4 removed PowerProvider. Delete old apps, re-scaffold.
404 on JS/CSSv4 patches vite config automatically. Delete old apps, re-scaffold.
Share app returns 400API version updated to 2025-04-01.
10 TS build errorstypes.ts needs [key: string]: unknown
No tools in ClaudeValidate JSON config. Check path. Fully quit + reopen.
401 UnauthorizedCheck client secret value (not ID). Verify admin consent.
Can't write custom codeUse write_file, customAppCode, or replaceFiles.

Ready to Ship?

Download the MCP server, follow the guide above, and deploy your first Power App in under 20 minutes.

Download Power Apps MCP Server

v4 · 16 tools · 14 source files · Solution management included

Comments

Popular posts from this blog

Bridging the Impossible: Connecting Jira On-Prem to Power Automate & Copilot Studio — The Solution Nobody Built Until Now"

How I Automated My Entire SharePoint Tenant with 150 MCP Tools and Claude Desktop

Azure Management MCP Server