PowerPlatform MCP Server について
PowerPlatformとDataverseのエンティティやレコードにアクセスするMCPサーバーです。開発者向けにメタデータや関係の確認、ODataクエリ、コンテキストに応じたプロンプトを提供します。
主な機能
- 01エンティティメタデータと属性の取得
- 02フィルター付きODataレコード検索
- 03エンティティ関係のマッピング
- 04グローバルオプションセットの取得
- 05デバイスコードによる対話型認証
活用シーン
- 01エンティティのフィールドとメタデータの確認
- 02Dataverseレコードの条件付き検索
- 03エンティティ間の関係把握
- 04ODataクエリテンプレートの作成
MCP 対応
エンティティのメタデータ、属性、関係、オプションセット、レコードを取得するツールをMCPクライアントに公開し、ODataフィルター付き検索にも対応します。エンティティ概要、属性詳細、クエリテンプレート、関係マップのプロンプトも提供します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
title: "README" tags: ["automation", "azure", "cloud", "documentation", "indexing", "markdown", "mcp", "search", "tabular-model", "tom"] project: "General" phase: "Template" updated: "2025-05-29"
title: "PowerPlatform MCP Server" tags: ["automation", "azure", "cloud", "indexing", "markdown", "script", "search"] project: "General" phase: "Execution" updated: "2025-05-29"
PowerPlatform MCP サーバー
PowerPlatform/Dataverse のエンティティとレコードにインテリジェントにアクセスできる、Model Context Protocol(MCP)サーバーです。このツールは、コンテキストを考慮した支援、エンティティの探索、メタデータへのアクセスを提供します。
主な機能:
- 書式化されたコンテキスト対応プロンプトによる、豊富なエンティティメタデータの探索
- インテリジェントなフィルタリングを備えた高度な OData クエリのサポート
- 包括的なリレーションシップのマッピングと可視化
- AI エージェントを通じた、AI 支援によるクエリの構築とデータモデリング
- エンティティの属性、リレーションシップ、グローバルオプションセットへの完全なアクセス
- クライアントシークレットを利用できないシナリオ向けの対話型認証フロー
インストール
このツールは、次の2つの方法でインストールして実行できます。
オプション1:グローバルにインストール
npm install -g powerplatform-mcp
次に、実行します。
powerplatform-mcp
オプション2:npx で直接実行
インストールせずに実行します。
npx powerplatform-mcp
設定
実行する前に、次の環境変数を設定します。
# PowerPlatform/Dataverse connection details - Interactive Authentication (Recommended)
POWERPLATFORM_URL=https://yourenvironment.crm.dynamics.com
POWERPLATFORM_CLIENT_ID=your-azure-app-client-id
POWERPLATFORM_TENANT_ID=your-azure-tenant-id
POWERPLATFORM_TOKEN_CACHE_PATH=/path/to/token_cache.json # Optional: defaults to ~/.powerplatform-mcp/token_cache.json
認証オプション
この MCP サーバーは現在、主にデバイスコードフローによる対話型認証を使用します。これは特に、次のような場合に便利です。
- クライアントシークレットを作成する権限がない場合
- 個人の環境で作業している場合
- MFA を使用して個人の資格情報で認証する必要がある場合
サーバーを初めて実行すると、認証用のデバイスコードと URL が表示されます。ブラウザーで URL を開き、Power Platform の資格情報でサインインして、コードを入力してください。サーバーは認証トークンをトークンキャッシュファイルに安全に保存し、次回以降の実行で使用します。
認証が必要な場合の出力例:
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code ABC123DEF to authenticate.
注: クライアントシークレットを使用する以前のクライアント資格情報認証方式は、より安全で柔軟なこの対話型認証方式を優先するため、非推奨になりました。
使用方法
これは、Cursor、Claude App、GitHub Copilot などの MCP 互換クライアントで動作するよう設計された MCP サーバーです。起動すると、PowerPlatform のエンティティメタデータやレコードを取得するためのツールを公開します。
利用可能なツール
get-entity-metadata:PowerPlatform エンティティのメタデータを取得しますget-entity-attributes:PowerPlatform エンティティの属性/フィールドを取得しますget-entity-attribute:PowerPlatform エンティティの特定の属性/フィールドを取得しますget-entity-relationships:PowerPlatform エンティティのリレーションシップを取得しますget-global-option-set:グローバルオプションセットの定義を取得しますget-record:エンティティ名と ID を指定して特定のレコードを取得しますquery-records:OData のフィルター式を使用してレコードをクエリしますuse-powerplatform-prompt:PowerPlatform エンティティ向けの定義済みプロンプトテンプレートを使用します
MCP プロンプト
このサーバーには、PowerPlatform エンティティに関する書式化されたコンテキスト豊富な情報を提供する、プロンプト機能が含まれています。
利用可能なプロンプトの種類
use-powerplatform-prompt ツールは、次のプロンプトの種類に対応しています。
- ENTITY_OVERVIEW:エンティティの包括的な概要
- ATTRIBUTE_DETAILS:特定のエンティティ属性に関する詳細情報
- QUERY_TEMPLATE:エンティティ向けの OData クエリテンプレートとフィルター例
- RELATIONSHIP_MAP:エンティティのリレーションシップを示すマップ
例
エンティティ概要プロンプト
// Example client code
await mcpClient.invoke("use-powerplatform-prompt", {
promptType: "ENTITY_OVERVIEW",
entityName: "account"
});
出力:
## Power Platform Entity: account
This is an overview of the 'account' entity in Microsoft Power Platform/Dataverse:
### Entity Details
- Display Name: Account
- Schema Name: Account
- Description: Business that represents a customer or potential customer
- Primary Key: accountid
- Primary Name: name
### Key Attributes
- name: String (Account Name)
- emailaddress1: String (Email)
- telephone1: String (Main Phone)
- address1_city: String (City)
- statecode: Status (Status)
- accountnumber: String (Account Number)
- industrycode: OptionSetValue (Industry)
- revenue: Money (Annual Revenue)
- ownerid: Owner (Owner)
- createdon: DateTime (Created On)
### Relationships
- One-to-Many Relationships: 42
- Many-to-Many Relationships: 8
You can query this entity using OData filters against the plural name.
属性詳細プロンプト
await mcpClient.invoke("use-powerplatform-prompt", {
promptType: "ATTRIBUTE_DETAILS",
entityName: "account",
attributeName: "revenue"
});
出力:
## Attribute: revenue
Details for the 'revenue' attribute of the 'account' entity:
- Display Name: Annual Revenue
- Description: Annual revenue for the account
- Type: Money
- Format: Currency
- Is Required: No
- Is Searchable: true
### Usage Notes
- Data Type: Money
- Required: No
- Max Length: N/A
クエリテンプレートプロンプト
await mcpClient.invoke("use-powerplatform-prompt", {
promptType: "QUERY_TEMPLATE",
entityName: "account"
});
出力:
## OData Query Template for accounts
Use this template to build queries against the accounts entity:
accounts?$select=name,emailaddress1,telephone1, address1_city,statecode&$filter=name eq 'Example'&$orderby=name asc&$top=50
一般的なフィルターの例
- 等しい:
name eq 'Contoso' - 含む:
contains(name, 'Contoso') - 日付より後:
createdon gt 2023-01-01T00:00:00Z - 複数の条件:
name eq 'Contoso' and statecode eq 0
#### Relationship Map Prompt
```javascript
await mcpClient.invoke("use-powerplatform-prompt", {
promptType: "RELATIONSHIP_MAP",
entityName: "contact"
});
出力:
## Relationship Map for contact
This shows all relationships for the 'contact' entity:
### One-to-Many Relationships (contact as Primary)
- contact_activity_parties: contact (1) → activityparty (N)
- contact_connections1: contact (1) → connection (N)
- contact_connections2: contact (1) → connection (N)
- contact_customer_contacts: contact (1) → contact (N)
- contact_master_contact: contact (1) → contact (N)
### One-to-Many Relationships (contact as Related)
- account_primary_contact: account (1) → contact (N)
- customer_contacts: customer (1) → contact (N)
- system_user_contacts: systemuser (1) → contact (N)
### Many-to-Many Relationships
- contactleads_association: contact (N) ↔ lead (N)
- contactopportunities_association: contact (N) ↔ opportunity (N)
- contactquotes_association: contact (N) ↔ quote (N)
プロンプトの例
PowerPlatform MCP のプロンプトを使ってアシスタントとやり取りする方法の例を紹介します。
1. エンティティの理解
エンティティについて、自然な言葉でアシスタントに質問できます。
User: "Tell me about the Account entity in our PowerPlatform environment"
Response:
[uses ENTITY_OVERVIEW prompt internally]
Here's what I found about the Account entity:
- It's a core business entity representing customers and potential customers
- The primary identifier is 'accountid' and the primary name field is 'name'
- Key fields include:
* name (Account Name)
* emailaddress1 (Email)
* telephone1 (Main Phone)
* revenue (Annual Revenue)
- It has 42 one-to-many relationships and 8 many-to-many relationships
2. クエリの作成
クエリの作成方法についてサポートを求めることができます。
User: "Help me write a query to find active accounts with revenue over $1M in California"
Response:
[uses QUERY_TEMPLATE prompt internally]
Here's the OData query you need:
accounts?$select=name,revenue,statecode,address1_stateorprovince
&$filter=statecode eq 0
and revenue gt 1000000
and address1_stateorprovince eq 'California'
&$orderby=revenue desc
This query:
1. Selects relevant fields
2. Filters for active accounts (statecode eq 0)
3. Checks revenue > $1M
4. Filters for California location
5. Orders by revenue highest to lowest
3. リレーションシップの理解
エンティティ間のリレーションシップを自然な形で調べることができます。
User: "How are Accounts and Contacts related in our system?"
Response:
[uses RELATIONSHIP_MAP prompt for both entities internally]
Here are the key relationships between Accounts and Contacts:
1. Primary Contact (One-to-Many):
- account_primary_contact: Account (1) → Contact (N)
- An account can have many contacts, but one designated as primary
2. Customer Relationship:
- contact_customer_accounts: Contact (N) ← Account (1)
- Contacts can be associated with customer accounts
3. Additional Relationships:
- accountleads_association: For lead tracking
- account_connections: For relationship management
4. フィールド/属性の調査
特定のフィールドについて質問できます。
User: "What kind of field is the revenue field on Account?"
Response:
[uses ATTRIBUTE_DETAILS prompt internally]
The revenue field on Account is:
- Data Type: Money
- Format: Currency
- Not required
- Searchable: Yes
- Used for: Tracking annual revenue for the account
- Can be used in advanced find and filtered views
5. 複雑なデータモデリング
データモデリングに関する判断についてサポートを受けることができます。
User: "I need to design a solution for tracking product reviews. Which entities should I relate to?"
Response:
[uses multiple ENTITY_OVERVIEW and RELATIONSHIP_MAP prompts internally]
Based on the existing data model, here's a suggested approach:
1. Product (existing entity):
- Already has relationships with:
* Price lists
* Product categories
* Inventory units
2. New Review entity should relate to:
- Product (N:1) - Each review is for one product
- Contact (N:1) - Reviews are written by contacts
- Account (N:1) - Optional link to company if B2B review
Here's a sample lookup field structure...
[continues with detailed implementation guidance]
6. デバッグのサポート
トラブルシューティングのサポートを受けることができます。
User: "Why am I getting 'invalid property' when querying account.customertypecode?"
Response:
[uses ATTRIBUTE_DETAILS prompt internally]
I see the issue. The field 'customertypecode' is actually named 'customertype' in your environment. Here's the correct field information:
- Logical Name: customertype
- Type: OptionSetValue
- Valid Values:
* 1 = Competitor
* 2 = Consultant
* 3 = Customer
* 4 = Investor
* 5 = Partner
* 6 = Influencer
Try updating your query to use 'customertype' instead of 'customertypecode'.
これらの例は、AI アシスタントが MCP プロンプトを活用して、PowerPlatform の開発タスクに対し、コンテキストを踏まえた正確なサポートを提供する方法を示しています。AI はお使いの環境固有の構成を理解し、簡単なクエリから複雑なアーキテクチャ上の判断まで支援できます。
ライセンス
MIT
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。