How I Built a Power Apps MCP Server That Deploys Custom Code Apps While I Drink Coffee
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.
Everything you need — 16 source files, ready to build
In This Post
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
| Category | Tool | Description |
|---|---|---|
| Dataverse | create_dataverse_table | Create table with typed columns |
| Dataverse | insert_sample_data | Insert rows with realistic data |
| Dataverse | list_security_roles | List all environment roles |
| Dataverse | assign_security_role | Assign role to user/group |
| Code App | write_fileNEW | Write ANY file to a project (the file bridge) |
| Code App | run_commandNEW | Run any shell command in project dir |
| Code App | scaffold_code_app | Create React+TS project (+customAppCode, +customFiles) |
| Code App | build_code_app | Compile with Vite (+replaceFiles before build) |
| Code App | deploy_code_app | Build + deploy (+replaceFiles before build) |
| Sharing | list_apps | List all Power Apps in environment |
| Sharing | share_app | Share app and assign security roles |
| Pipeline | full_pipeline | End-to-end in one call |
| Solution | create_solutionNEW | Create solution container |
| Solution | deploy_to_solutionNEW | Deploy app into a specific solution |
| Solution | list_solutionsNEW | List all solutions |
| Solution | export_solutionNEW | Export 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:
| # | Bug | Symptom | Fix |
|---|---|---|---|
| 1 | ToolResult interface | 10 TypeScript errors | Added [key: string]: unknown |
| 2 | PowerProvider wrapper | Blank page after deploy | Removed entirely |
| 3 | tsc -b in build script | Build always fails | Patched to vite build only |
| 4 | API version 2024-05-01 | Share app returns 400 | Updated to 2025-04-01 |
| 5 | Vite /assets/ subfolder | 404 on JS/CSS | Flat output config |
| 6 | App.tsx SVG import | Build error after cleanup | Writes minimal App.tsx |
| 7 | Generated services import | CRUD imports missing files | Uses 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
Install Required Tools
- Node.js v20+ — nodejs.org
- .NET SDK 8 — dotnet.microsoft.com
- PAC CLI —
dotnet tool install --global Microsoft.PowerApps.CLI.Tool - Git — git-scm.com
- Claude Desktop — claude.ai/download
node --version # v20+
npm --version # 10+
pac --version # 1.49+Connect PAC CLI
pac auth create --environment https://YOUR-ORG.crm.dynamics.com
pac auth list
pac org whoAzure AD App Registration
- Azure Portal → App registrations → New registration
- Name:
PowerApps-MCP-Server - Add API permissions:
Dynamics CRM → user_impersonationandPowerApps Service → User - Grant admin consent
- Create a client secret under Certificates & secrets
- Note your Tenant ID, Client 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
Create Project Folder
mkdir C:\Projects\powerapps-mcp-server
cd C:\Projects\powerapps-mcp-server
mkdir src\services src\schemas src\templates src\toolsHave 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
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 stopmkdir C:\Projects\PowerAppsCodeAppsConfigure Claude Desktop
Open your config file:
| OS | Path |
|---|---|
| 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"
}
}
}
}- Save the file
- Quit Claude Desktop completely (system tray → Quit)
- Reopen Claude Desktop
- 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
Clean Up Old Apps
Delete all folders in C:\Projects\PowerAppsCodeApps\ — apps from previous versions have broken templates. v4 creates clean apps.
Test Authentication
Type in Claude Desktop:
List the security roles in my Dataverse environmentIf you see roles listed, auth is working.
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 PlatformAll 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_command: npm install lucide-react.
Troubleshooting
| Problem | Fix |
|---|---|
| Blank page after deploy | v4 removed PowerProvider. Delete old apps, re-scaffold. |
| 404 on JS/CSS | v4 patches vite config automatically. Delete old apps, re-scaffold. |
| Share app returns 400 | API version updated to 2025-04-01. |
| 10 TS build errors | types.ts needs [key: string]: unknown |
| No tools in Claude | Validate JSON config. Check path. Fully quit + reopen. |
| 401 Unauthorized | Check client secret value (not ID). Verify admin consent. |
| Can't write custom code | Use 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 Serverv4 · 16 tools · 14 source files · Solution management included
Comments
Post a Comment