一个提供智能访问 PowerPlatform/Dataverse 实体和记录的模型上下文协议 (MCP) 服务器。此工具提供上下文感知的帮助、实体探索和元数据访问。
主要功能:
您可以通过两种方式安装并运行此工具:
npm install -g powerplatform-mcp
然后运行它:
powerplatform-mcp
无需安装即可运行:
npx powerplatform-mcp
在运行之前,请设置以下环境变量:
# 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 实体提示模板该服务器包括一个提示功能,提供关于 PowerPlatform 实体的格式化、上下文丰富的信息。
use-powerplatform-prompt
工具支持以下提示类型:
// 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 提示与助手交互的例子:
您可以使用自然语言询问助手关于实体的信息:
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
您可以请求帮助构建查询:
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
你可以自然地探索实体关系:
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
你可以询问特定的字段:
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
你可以获得数据建模决策的帮助:
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]
你可以获得故障排除的帮助:
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