powerplatform mcp/cli について
PowerPlatform MCP / CLI は、PowerPlatform と Dataverse 環境を照会・設定するための MCP サーバー兼スタンドアロンのコマンドラインツールです。複数環境に対応しています。Power Platform の環境探索や設定の自動化を行う開発者や管理者向けです。
主な機能
- 01複数環境の設定と切り替え
- 02エンティティ、レコード、プラグイン、フロー、ソリューションの照会
- 03環境設定を自動化する書き込み操作
- 04CLI による結果のファイルシステムへのキャッシュ
活用シーン
- 01AI クライアントでの Dataverse エンティティとプラグインステップの探索
- 02大量の照会結果をディスクに出力して後続分析
- 03カスタム API、環境変数、セキュリティロールの作成自動化
MCP 対応
MCP サーバーとして、エンティティ、レコード、プラグイン、Power Automate フロー、ソリューション、セキュリティロールなどに関する約 67 のツールを AI クライアントに提供します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
npx -y powerplatform-mcpPOWERPLATFORM_ENVIRONMENTSPOWERPLATFORM_DEV_URLPOWERPLATFORM_DEV_CLIENT_IDPOWERPLATFORM_DEV_CLIENT_SECRETシークレットPOWERPLATFORM_DEV_TENANT_IDPOWERPLATFORM_UAT_URLPOWERPLATFORM_UAT_CLIENT_IDPOWERPLATFORM_UAT_CLIENT_SECRETシークレットPOWERPLATFORM_UAT_TENANT_IDローカルサーバーにはマシン上の実行環境(Node.js 18 以上など)が必要です。設定ファイルの場所はクライアントごとに異なります。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
PowerPlatform MCP / CLI
PowerPlatform / Dataverse 環境を照会および構成するための Model Context Protocol(MCP)サーバーとスタンドアロン CLI です。複数の環境、エンティティのメタデータ、レコード、プラグイン、フロー、ソリューション、ワークフロー、ビジネスルール、セキュリティロール、カスタム API、Web リソースなどに対応し、自動化された環境セットアップのための書き込み操作も含まれます。
MCP + CLI を選ぶ理由
MCP は AI クライアント(Claude、Cursor、GitHub Copilot)と直接連携し、環境を対話形式で探索できます。
CLI は、結果をインラインで返す代わりにファイルシステムキャッシュに書き込みます。MCP ツールの応答は AI クライアントのコンテキストウィンドウによる制約を受けるため、数百ものエンティティ、フロー、プラグインステップを含む環境を照会する際に、結果が切り捨てられたり、品質が低下したりすることがあります。CLI は結果全体をディスクに保存することでこの制限を回避し、コンテキストへの負荷をかけずに、その後の分析で利用できるようにします。どちらのインターフェースも、同じツールと機能を共有しています。
インストール
Node.js 22+(25 未満)が必要です。
MCP サーバー
npm install -g powerplatform-mcp
# or
npx powerplatform-mcp
CLI
npm install -g powerplatform-cli
# or
npx powerplatform-cli
Docker
# MCP Server
docker pull ghcr.io/michsob/powerplatform-mcp
docker run --env-file .env ghcr.io/michsob/powerplatform-mcp
# CLI
docker pull ghcr.io/michsob/powerplatform-cli
docker run --env-file .env ghcr.io/michsob/powerplatform-cli entity-attributes account
構成
このツールは複数の環境に対応しています。環境変数を使って定義します。
POWERPLATFORM_ENVIRONMENTS=DEV,UAT,PROD
# For each environment, set:
POWERPLATFORM_DEV_URL=https://dev-org.crm.dynamics.com
POWERPLATFORM_DEV_CLIENT_ID=your-client-id
POWERPLATFORM_DEV_CLIENT_SECRET=your-client-secret
POWERPLATFORM_DEV_TENANT_ID=your-tenant-id
POWERPLATFORM_UAT_URL=https://uat-org.crm.dynamics.com
POWERPLATFORM_UAT_CLIENT_ID=...
POWERPLATFORM_UAT_CLIENT_SECRET=...
POWERPLATFORM_UAT_TENANT_ID=...
ローカルで開発する場合は、.env.example を .env にコピーし、認証情報を入力してください。
MCP サーバー
MCP サーバーは、AI を活用したクライアント(Claude、Cursor、GitHub Copilot)向けに設計されています。
利用可能な MCP ツール(67)
すべてのツールで、特定の環境を対象にするための environment パラメーターを任意で指定できます(既定では、最初に構成された環境が対象になります)。
エンティティ
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-entity-metadata | エンティティのメタデータを取得 | entityName | |
get-entity-attributes | すべての属性/フィールドを一覧表示 | entityName | |
get-entity-attribute | 特定の属性を取得 | entityName、attributeName | |
get-entity-relationships | 1:N および N:N のリレーションシップを取得 | entityName | |
create-entity-string-attribute | 単一行テキスト列を作成 | entityName、schemaName、displayName | maxLength、requiredLevel、description、solutionName |
get-entity-keys | エンティティの代替キーを一覧表示 | entityName | |
create-entity-alternate-key | 代替キーを作成 | entityName、schemaName、displayName、keyAttributes | solutionName |
レコード
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-record | ID でレコードを取得 | entityNamePlural、recordId | |
query-records | OData クエリ | entityNamePlural、filter | maxRecords(既定値 50) |
プラグイン
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-plugin-assemblies | プラグインアセンブリを一覧表示 | includeManaged、maxRecords | |
get-plugin-assembly-complete | 型、ステップ、イメージを含むアセンブリ | assemblyName | includeDisabled |
get-entity-plugin-pipeline | エンティティで実行されるプラグイン | entityName | messageFilter、includeDisabled |
get-plugin-trace-logs | プラグイントレースログ | entityName、messageName、correlationId、pluginStepId、exceptionOnly、hoursBack、maxRecords | |
get-all-plugin-steps | すべての SDK メッセージ処理ステップ | includeDisabled、maxRecords | |
get-plugin-type | クラス名でプラグインの型を検索 | typeName | |
get-sdk-message | 名前で SDK メッセージを検索 | messageName | |
create-plugin-step | プラグインステップを登録 | name、pluginTypeId、sdkMessageId、stage、mode | rank、supportedDeployment、description、configuration、sdkMessageFilterId、solutionName |
フロー(Power Automate)
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-flows | クラウドフローを一覧表示します(スマートフィルタリング) | activeOnly、maxRecords、nameContains、excludeSystem、excludeCustomerInsights、excludeCopilotSales | |
search-workflows | ワークフローとフローを検索します | name、primaryEntity、description、category、statecode、includeDescription、maxResults | |
get-flow-definition | 完全な定義または解析済みの概要を取得します | flowId | summary |
get-flow-runs | フローの実行履歴を取得します | flowId | status、startedAfter、startedBefore、maxRecords |
get-flow-run-details | アクションレベルのエラーを含む実行の詳細を取得します | flowId、runId | |
cancel-flow-run | 実行中または待機中の実行をキャンセルします | flowId、runId | |
resubmit-flow-run | 失敗した実行を再試行します | flowId、runId | |
scan-flow-health | 一括ヘルススキャンを実行します(成功率) | daysBack、maxRunsPerFlow、maxFlows、activeOnly | |
get-flow-inventory | 軽量なフローインベントリを取得します | maxRecords |
ソリューション
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-publishers | 読み取り専用ではない発行元を一覧表示します | ||
get-solutions | 表示可能なソリューションを一覧表示します | ||
get-solution | 一意の名前でソリューションを取得します | uniqueName | |
get-solution-components | ソリューション内のコンポーネントを一覧表示します | solutionUniqueName | |
export-solution | ソリューションをエクスポートします(base64) | solutionName | managed |
add-solution-component | ソリューションにコンポーネントを追加します | solutionUniqueName、componentId、componentType | addRequiredComponents |
publish-customizations | エンティティまたはすべてのカスタマイズを公開します | entityLogicalName |
ワークフロー(クラシック)
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-workflows | クラシックワークフローを一覧表示します | activeOnly、maxRecords | |
get-workflow-definition | XAML 定義または概要を取得します | workflowId | summary |
get-ootb-workflows | バックグラウンド、BPF、アクション、オンデマンドを取得します | maxRecords、categories |
ビジネスルール
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-business-rules | ビジネスルールを一覧表示します | activeOnly、maxRecords | |
get-business-rule | XAML を含むビジネスルールを取得します | workflowId |
オプションセット
| ツール | 説明 | 必須パラメーター |
|---|---|---|
get-global-option-set | グローバルオプションセットの定義を取得します | optionSetName |
構成
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-connection-references | 接続参照を取得します | maxRecords、managedOnly、hasConnection、inactive | |
get-environment-variables | 環境変数の定義と値を取得します | maxRecords、managedOnly | |
create-environment-variable | 環境変数の定義を作成します | schemaName、displayName、type | defaultValue、description、solutionName |
set-environment-variable-value | 環境変数の値を設定または更新します | definitionId、value | existingValueId |
カスタム API
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-custom-apis | カスタム API 定義の一覧を取得 | maxRecords, includeManaged | |
get-custom-api | 一意の名前でカスタム API を取得 | uniqueName | |
create-custom-api | カスタム API 定義を作成 | uniqueName, name, displayName, bindingType, isFunction, isPrivate, allowedCustomProcessingStepType | description, pluginTypeId, pluginTypeName, boundEntityLogicalName, solutionName |
get-custom-api-response-properties | レスポンスプロパティの一覧を取得 | customApiId | |
create-custom-api-response-property | レスポンスプロパティを作成 | customApiId, uniqueName, name, displayName, type | description, logicalEntityName, isOptional, solutionName |
get-custom-api-request-parameters | リクエストパラメーターの一覧を取得 | customApiId | |
create-custom-api-request-parameter | リクエストパラメーターを作成 | customApiId, uniqueName, name, displayName, type | description, logicalEntityName, isOptional, solutionName |
Web リソース
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-web-resources | Web リソースの一覧を取得 | maxRecords, webResourceType, nameFilter | |
get-web-resource | 名前で Web リソースを取得 | name | |
create-web-resource | 新しい Web リソースをアップロード | name, displayName, webResourceType, content | description, solutionName |
セキュリティロール
| ツール | 説明 | 必須パラメーター | 任意 |
|---|---|---|---|
get-security-roles | カスタマイズ可能なセキュリティロールの一覧を取得 | solutionUniqueName, excludeSystemRoles, includePrivileges, maxRecords | |
get-security-role-privileges | ロールの特権(名前、accessright、深度マスク) | roleId | entityFilter, accessRightFilter |
list-privileges | システム特権カタログを参照し、privilegeId GUID とサポートされている深度を確認 | entityFilter, accessRightFilter, maxRecords | |
create-security-role | 新しいロールを作成(既定ではルート BU)。solutionUniqueName を指定すると、1 回の操作でソリューションに追加 | name | businessUnitId, description, solutionUniqueName |
clone-security-role | 特権を含めてロールを複製。CloneAsRole を使用し、アクションが利用できない場合は作成後にコピーする方式にフォールバック | sourceRoleId | newName, targetBusinessUnitId, solutionUniqueName |
update-security-role | ロールの名前、説明、またはビジネスユニットを更新 | roleId | name, description, businessUnitId, solutionUniqueName |
delete-security-role | ロールを削除(破壊的操作 — confirm: true が必要) | roleId, confirm | |
add-security-role-privileges | ロールに特権を追加(AddPrivilegesRole — 既存の特権はそのまま保持) | roleId, privileges[] | |
remove-security-role-privileges | ロールから特権を削除(RemovePrivilegeRole を繰り返し実行) | roleId, privilegeIds[] | |
replace-security-role-privileges | 特権一式を消去して置き換え(ReplacePrivilegesRole — 破壊的操作、confirm: true が必要) | roleId, privileges[], confirm |
privileges[] の各項目は { privilegeId, depth, businessUnitId? } です。深度は Basic(ユーザー)、Local(BU)、Deep(BU と子 BU)、Global(組織)のいずれかです。
依存関係
| ツール | 説明 | 必須パラメーター |
|---|---|---|
check-component-dependencies | 削除を妨げる依存関係を確認 | componentId, componentType |
check-delete-eligibility | コンポーネントを削除できるか確認 | componentId, componentType |
サービスエンドポイント
| ツール | 説明 | 任意 |
|---|---|---|
get-service-endpoints | Service Bus、webhook、Event Hub、Event Grid | maxRecords |
MCP プロンプト
| プロンプト | 説明 | 必須引数 |
|---|---|---|
entity-overview | 主要な属性とリレーションを含むエンティティの概要 | entityName |
attribute-details | 属性の詳細情報(型、形式、要件) | entityName、attributeName |
query-template | フィルターの例を含む OData クエリテンプレート | entityName |
relationship-map | 1:N および N:N リレーションの完全なマップ | entityName |
CLI
MCP サーバーと同じツールを使用しますが、大規模なデータセットでも完全な出力を得られるよう、結果はファイルシステムにキャッシュされます。
グローバルオプション
--env <name> — 対象の環境(設定済みの最初の環境がデフォルトです)。
コマンド
エンティティ
entity-metadata <entityName>
entity-attributes <entityName>
entity-attribute <entityName> <attributeName>
entity-relationships <entityName>
entity-keys <entityName>
create-entity <schemaName> <displayName> <displayCollectionName> [--primary-name-schema <name>] [--primary-name-display <name>] [--description <desc>] [--ownership <UserOwned|OrganizationOwned>] [--has-activities] [--has-notes] [--solution <name>]
create-entity-string-attribute <entityName> <schemaName> <displayName> [--max-length <n>] [--required-level <level>] [--description <desc>] [--solution <name>]
create-entity-memo-attribute <entityName> <schemaName> <displayName> [--max-length <n>] [--required-level <level>] [--description <desc>] [--solution <name>]
create-entity-file-attribute <entityName> <schemaName> <displayName> [--max-size-kb <n>] [--required-level <level>] [--description <desc>] [--solution <name>]
create-entity-integer-attribute <entityName> <schemaName> <displayName> [--min <n>] [--max <n>] [--required-level <level>] [--description <desc>] [--solution <name>]
create-entity-decimal-attribute <entityName> <schemaName> <displayName> [--precision <n>] [--min <n>] [--max <n>] [--required-level <level>] [--description <desc>] [--solution <name>]
create-entity-money-attribute <entityName> <schemaName> <displayName> [--precision-source <0|1|2>] [--precision <n>] [--min <n>] [--max <n>] [--required-level <level>] [--description <desc>] [--solution <name>]
create-entity-boolean-attribute <entityName> <schemaName> <displayName> [--true-label <label>] [--false-label <label>] [--default-value <true|false>] [--required-level <level>] [--description <desc>] [--solution <name>]
create-entity-datetime-attribute <entityName> <schemaName> <displayName> [--format <DateOnly|DateAndTime>] [--behavior <UserLocal|DateOnly|TimeZoneIndependent>] [--required-level <level>] [--description <desc>] [--solution <name>]
create-entity-picklist-attribute <entityName> <schemaName> <displayName> [-o <value:label>]... [--required-level <level>] [--description <desc>] [--solution <name>]
create-entity-lookup <referencingEntity> <referencedEntity> <relationshipSchemaName> <lookupSchemaName> <displayName> [--required-level <level>] [--description <desc>] [--cascade-delete <NoCascade|RemoveLink|Restrict|Cascade>] [--solution <name>]
create-entity-alternate-key <entityName> <schemaName> <displayName> <keyAttributes...> [--solution <name>]
delete-entity-attribute <entityName> <attributeName>
レコード
record <entityNamePlural> <recordId>
query-records <entityNamePlural> <filter> [--max <n>]
create-record <entityNamePlural> <jsonBody>
update-record <entityNamePlural> <recordId> <jsonBody>
delete-record <entityNamePlural> <recordId>
associate-records <entityNamePlural> <recordId> <navigationProperty> <relatedEntityNamePlural> <relatedRecordId>
disassociate-records <entityNamePlural> <recordId> <navigationProperty> [relatedRecordId]
プラグイン
plugin-assemblies [--include-managed] [--max <n>]
plugin-assembly <assemblyName> [--include-disabled]
plugin-packages [--include-managed] [--max <n>]
plugin-type <typeName>
entity-pipeline <entityName> [--message <msg>] [--include-disabled]
plugin-trace-logs [--entity <name>] [--message <msg>] [--correlation-id <id>] [--step-id <id>] [--hours <n>] [--max <n>] [--exceptions-only]
all-plugin-steps [--include-disabled] [--max <n>]
sdk-message <messageName>
register-plugin-package <filePath> [--pkg-version <version>] [--solution <name>]
update-plugin-package <filePath> --plugin-package-id <id> [--pkg-version <version>]
create-plugin-step <name> <pluginTypeId> <sdkMessageId> [--stage <n>] [--mode <n>] [--rank <n>] [--supported-deployment <n>] [--description <desc>] [--configuration <cfg>] [--message-filter-id <id>] [--solution <name>]
create-plugin-step-image <stepId> [--name <name>] [--entity-alias <alias>] [--image-type <0|1|2>] [--message-property-name <name>] [--attributes <csv>]
フロー
flows [--active] [--name <contains>] [--include-managed] [--max <n>]
flow-definition <flowId> [--summary]
flow-inventory [--max <n>]
flow-runs <flowId> [--status <s>] [--after <iso>] [--before <iso>] [--max <n>]
flow-run-details <flowId> <runId>
flow-health [--days <n>] [--max-runs <n>] [--max-flows <n>] [--active]
search-workflows [--name <name>] [--entity <entity>] [--category <n>] [--active] [--max <n>]
create-cloud-flow <clientDataFile> [--primary-entity <entity>] [--solution <name>]
activate-flow <flowId>
deactivate-flow <flowId>
ソリューション
solutions
solution <uniqueName>
solution-components <uniqueName>
publishers
add-solution-component <solutionUniqueName> <componentId> <componentType> [--add-required]
publish-customizations [--entity <logicalName>]
ワークフロー
workflows [--active] [--max <n>]
workflow-definition <workflowId> [--summary]
ootb-workflows [--categories <0,1,2,3,4>]
ビジネスルール
business-rules [--active] [--max <n>]
business-rule <workflowId>
オプションセット
optionset <optionSetName>
依存関係
check-dependencies <componentId> <componentType>
構成
connection-references [--managed-only] [--has-connection] [--no-connection] [--inactive] [--max-records <n>]
create-connection-reference <logicalName> <displayName> <connectorId> [--description <desc>] [--solution <name>]
environment-variables [--managed-only] [--max-records <n>]
create-environment-variable <schemaName> <displayName> [--type <type>] [--default-value <val>] [--description <desc>] [--solution <name>]
set-environment-variable-value <definitionId> <value> [--existing-value-id <id>]
カスタム API
custom-apis [--include-managed] [--max <n>]
custom-api <uniqueName>
create-custom-api <uniqueName> <displayName> [--binding-type <n>] [--bound-entity <name>] [--is-function] [--is-private] [--processing-type <n>] [--plugin-type-id <id>] [--plugin-type-name <name>] [--description <desc>] [--solution <name>]
custom-api-response-properties <customApiId>
create-custom-api-response-property <customApiId> <uniqueName> <displayName> [--type <n>] [--description <desc>] [--solution <name>]
custom-api-request-parameters <customApiId>
create-custom-api-request-parameter <customApiId> <uniqueName> <displayName> [--type <n>] [--description <desc>] [--optional] [--solution <name>]
Web リソース
web-resources [--type <n>] [--name <contains>] [--max <n>]
web-resource <name>
create-web-resource <name> <displayName> <filePath> [--type <n>] [--description <desc>] [--solution <name>]
set-entity-icon <entityName> <svgFilePath> [--solution <name>] [--web-resource-name <name>] [--display-name <name>] [--no-publish]
フォームとビュー
entity-forms <entityName> [--type <n>]
entity-form-fields <formId>
add-form-field <entityName> <formId> <attributeName>
remove-form-field <entityName> <formId> <attributeName>
entity-views <entityName>
add-view-column <entityName> <viewId> <attributeName> [--width <n>]
set-view-columns <entityName> <viewId> <columns...> [--order-by <attr>] [--desc]
remove-view-column <entityName> <viewId> <attributeName>
PAC 統合
pac-auth Authenticate pac CLI using environment credentials
generate-models <outdirectory> [--settings <path>] [--entities <filter>] [--namespace <ns>]
deploy-plugin <pluginFile> --plugin-id <id> [--type <Nuget|Assembly>] [--configuration <config>]
セキュリティロール
security-roles [--solution <name>] [--include-system] [--include-privileges] [--max-records <n>]
security-role-privileges <roleId> [--entity <name>] [--access-right <type>]
privileges [--entity <name>] [--access-right <type>] [--max-records <n>]
create-security-role --name <name> [--bu <id>] [--description <desc>] [--solution <name>]
clone-security-role <sourceRoleId> [--name <name>] [--target-bu <id>] [--solution <name>]
update-security-role <roleId> [--name <name>] [--description <desc>] [--bu <id>] [--solution <name>]
delete-security-role <roleId> --yes
add-role-privileges <roleId> --privileges <spec> # JSON array or shorthand <guid>:<Basic|Local|Deep|Global>,...
remove-role-privileges <roleId> --privileges <id,id,id>
replace-role-privileges <roleId> --privileges <spec> --yes
サービスエンドポイント
service-endpoints [--max <n>]
開発
git clone https://github.com/michsob/powerplatform-mcp.git
cd powerplatform-mcp
npm install
cp .env.example .env # fill in credentials
npm run build
npm run inspector # test with MCP Inspector
リリース
新しいバージョンを公開するには:
package.jsonのversionを更新します- 変更を
mainにコミットします - バージョンタグを作成してプッシュします:
git tag v1.0.2 git push origin v1.0.2
GitHub Actions により、次のパッケージが自動的に公開されます:
| パッケージ | npm | GitHub Packages | Docker(GHCR) |
|---|---|---|---|
| MCP サーバー | npm i powerplatform-mcp | npm i @michsob/powerplatform-mcp | ghcr.io/michsob/powerplatform-mcp |
| CLI | npm i powerplatform-cli | npm i @michsob/powerplatform-cli | ghcr.io/michsob/powerplatform-cli |
npm での公開には Trusted Publishing (OIDC) を使用するため、トークンやシークレットは不要です。GitHub Packages と GHCR では、組み込みの GITHUB_TOKEN が自動的に使用されます。
ライセンス
MIT
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。
