PowerPlatform/Dataverseのエンティティとレコードへのインテリジェントなアクセスを提供するモデルコンテキストプロトコル(MCP)サーバー。このツールは、コンテキストアウェアな支援、エンティティ探索、メタデータアクセスを提供します。
主な機能:
- フォーマットされたコンテキスト認識プロンプトによる豊富なエンティティ メタデータ探索
- インテリジェントなフィルタリングによる高度な OData クエリのサポート
- 包括的な関係マッピングと視覚化
- AIエージェントによるAI支援クエリ構築とデータモデリング
- エンティティ属性、リレーションシップ、グローバル オプション セットへのフル アクセス
インストール
このツールは、次の 2 つの方法でインストールして実行できます。
オプション1: グローバルにインストールする
npm install -g powerplatform-mcp
次にそれを実行します:
オプション2: npxで直接実行する
インストールせずに実行:
構成
実行する前に、次の環境変数を設定します。
# PowerPlatform/Dataverse connection details
POWERPLATFORM_URL=https://yourenvironment.crm.dynamics.com
POWERPLATFORM_CLIENT_ID=your-azure-app-client-id
POWERPLATFORM_CLIENT_SECRET=your-azure-app-client-secret
POWERPLATFORM_TENANT_ID=your-azure-tenant-id
使用法
これは、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は環境固有の構成を理解し、単純なクエリから複雑なアーキテクチャ上の決定まで、あらゆる場面で役立ちます。
ライセンス
マサチューセッツ工科大学