powerautomate-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Joseph Ayala
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,228 @@
1
+ # Power Automate MCP Server
2
+
3
+ An MCP (Model Context Protocol) server that connects Claude to Microsoft Power Automate. Create, manage, and deploy Power Automate flows using natural language.
4
+
5
+ ## Features
6
+
7
+ - **Create Flows** - Build flows from natural language descriptions with guided wizard
8
+ - **Test & Debug** - Automatic testing with intelligent error diagnosis
9
+ - **Validate** - Pre-flight checks with best practices scoring (0-100)
10
+ - **Manage Flows** - List, update, clone, and delete flows
11
+ - **Expression Help** - Interactive Power Automate expression reference
12
+ - **Connector Intelligence** - Full knowledge of 400+ connectors and schemas
13
+ - **Cross-Platform** - Works on Windows, macOS, and Linux
14
+
15
+ ## Quick Start
16
+
17
+ ### Prerequisites
18
+
19
+ - Node.js 20+
20
+ - Microsoft 365 work account with Power Automate access
21
+ - **Linux only**: libsecret for secure token storage
22
+ ```bash
23
+ # Ubuntu/Debian
24
+ sudo apt-get install libsecret-1-dev gnome-keyring
25
+
26
+ # Fedora/RHEL
27
+ sudo dnf install libsecret-devel gnome-keyring
28
+ ```
29
+
30
+ ### Installation
31
+
32
+ ```bash
33
+ npm install -g powerautomate-mcp
34
+ ```
35
+
36
+ ### First-Time Setup
37
+
38
+ ```bash
39
+ powerautomate-mcp --setup
40
+ ```
41
+
42
+ This interactive wizard will:
43
+ 1. Sign you in via browser
44
+ 2. Discover your Power Automate environments
45
+ 3. Create the configuration file
46
+
47
+ ### Register with Claude
48
+
49
+ Add to your Claude configuration:
50
+
51
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
52
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
53
+ **Linux**: `~/.config/Claude/claude_desktop_config.json`
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "powerautomate": {
59
+ "command": "powerautomate-mcp"
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ Restart Claude. The Power Automate tools will appear automatically.
66
+
67
+ ## Usage Examples
68
+
69
+ ```
70
+ Create a flow that sends me an email every morning with the weather forecast
71
+ ```
72
+
73
+ ```
74
+ Test my "Daily Report" flow and tell me if there are any errors
75
+ ```
76
+
77
+ ```
78
+ What connectors are available for working with SharePoint?
79
+ ```
80
+
81
+ ```
82
+ Help me write an expression to format a date as "January 1, 2024"
83
+ ```
84
+
85
+ ## Available Tools
86
+
87
+ ### Core Flow Operations
88
+ | Tool | Description |
89
+ |------|-------------|
90
+ | `list_flows` | List flows in an environment |
91
+ | `get_flow` | Get full flow definition |
92
+ | `create_flow` | Create a new flow |
93
+ | `update_flow` | Modify an existing flow |
94
+ | `delete_flow` | Delete a flow |
95
+ | `toggle_flow` | Enable or disable a flow |
96
+ | `clone_flow` | Copy flow to another environment |
97
+
98
+ ### Testing & Debugging
99
+ | Tool | Description |
100
+ |------|-------------|
101
+ | `test_flow` | Run flow with automatic diagnosis |
102
+ | `run_flow` | Trigger a manual flow |
103
+ | `get_runs` | Get flow run history |
104
+ | `diagnose_flow` | Analyze failures with fix suggestions |
105
+ | `validate_flow` | Validate with best practices score |
106
+
107
+ ### Planning & Help
108
+ | Tool | Description |
109
+ |------|-------------|
110
+ | `plan_flow` | Interactive flow planning wizard |
111
+ | `build_flow` | Simple flow builder from description |
112
+ | `get_expression_help` | Expression syntax reference |
113
+ | `search_connectors` | Find connectors by name |
114
+ | `get_action_schema` | Get connector action parameters |
115
+
116
+ ## Azure AD App Registration (Required)
117
+
118
+ Before using this MCP server, an Azure AD app registration must be configured in your tenant. This requires **Global Administrator** or **Application Administrator** role.
119
+
120
+ ### Who Needs to Do This?
121
+
122
+ | Role | Action Required |
123
+ |------|-----------------|
124
+ | IT Admin / Global Admin | Create app registration, grant admin consent |
125
+ | End Users | Just run `powerautomate-mcp --setup` after admin completes setup |
126
+
127
+ ### Option 1: PowerShell Script (Recommended)
128
+
129
+ ```powershell
130
+ # Requires: Azure CLI (https://aka.ms/installazurecli)
131
+ # Requires: Global Admin or Application Administrator role
132
+
133
+ az login
134
+ ./scripts/Register-PublishedApp.ps1
135
+ ```
136
+
137
+ The script will:
138
+ 1. Create the app registration
139
+ 2. Configure required permissions
140
+ 3. Output the admin consent URL
141
+
142
+ ### Option 2: Manual Setup
143
+
144
+ 1. Go to [Azure Portal](https://portal.azure.com) > **Microsoft Entra ID** > **App registrations** > **New registration**
145
+
146
+ 2. Configure basic settings:
147
+ - **Name**: `Power Automate MCP`
148
+ - **Supported account types**: Accounts in any organizational directory (multi-tenant)
149
+ - **Redirect URI**: Select "Public client/native" and enter:
150
+ ```
151
+ https://login.microsoftonline.com/common/oauth2/nativeclient
152
+ ```
153
+
154
+ 3. After creation, go to **Authentication** and enable:
155
+ - **Allow public client flows**: Yes
156
+
157
+ 4. Go to **API permissions** > **Add a permission** and add:
158
+
159
+ | API | Permission | Type |
160
+ |-----|------------|------|
161
+ | Microsoft Graph | `User.Read` | Delegated |
162
+ | Power Automate (Flow Service) | `Flows.Read.All` | Delegated |
163
+ | Power Automate (Flow Service) | `Flows.Manage.All` | Delegated |
164
+
165
+ 5. Click **Grant admin consent for [Your Tenant]** (requires admin role)
166
+
167
+ ### Admin Consent
168
+
169
+ After creating the app, admin consent is required for users to authenticate:
170
+
171
+ ```
172
+ https://login.microsoftonline.com/common/adminconsent?client_id=YOUR_CLIENT_ID
173
+ ```
174
+
175
+ Replace `YOUR_CLIENT_ID` with the Application (client) ID from your app registration.
176
+
177
+ ### Update the MCP Server
178
+
179
+ After creating your app registration, update `src/setup/published-app.ts` with your client ID and rebuild:
180
+
181
+ ```bash
182
+ npm run build
183
+ ```
184
+
185
+ ## Security
186
+
187
+ This server implements security best practices:
188
+
189
+ - **Secure Token Storage**: DPAPI (Windows), Keychain (macOS), libsecret (Linux)
190
+ - **Input Validation**: OData injection protection, query sanitization
191
+ - **Error Sanitization**: PII redacted from logs and error messages
192
+ - **No Plaintext Secrets**: Tokens never stored in plaintext
193
+
194
+ ## Development
195
+
196
+ ```bash
197
+ # Clone and install
198
+ git clone https://github.com/rcb0727/powerautomate-mcp.git
199
+ cd powerautomate-mcp
200
+ npm install
201
+
202
+ # Build
203
+ npm run build
204
+
205
+ # Build in watch mode
206
+ npm run dev
207
+
208
+ # Test with MCP Inspector
209
+ npm run inspect
210
+ ```
211
+
212
+ ## Architecture
213
+
214
+ ```
215
+ Claude <--stdio--> powerautomate-mcp <--REST--> Power Automate APIs
216
+ |
217
+ ├── MSAL Auth (browser popup / device code)
218
+ ├── SQLite Schema Cache (400+ connectors)
219
+ └── Secure Token Storage (OS keychain)
220
+ ```
221
+
222
+ ## License
223
+
224
+ MIT
225
+
226
+ ## Contributing
227
+
228
+ PRs welcome! See [CLAUDE.md](./CLAUDE.md) for development workflow.
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node