mcp-configure
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseConfigure Dataverse MCP for GitHub Copilot
为GitHub Copilot配置Dataverse MCP
This skill configures the Dataverse MCP server for GitHub Copilot with your organization's environment URL. Each organization is registered with a unique server name based on the org identifier (e.g., ). If the user provided a URL it is: $ARGUMENTS.
DataverseMcporgbc9a965c本Skill用于为GitHub Copilot配置与你的组织环境URL关联的Dataverse MCP服务器。每个组织都会基于组织标识符注册一个唯一的服务器名称(例如:)。如果用户提供了URL,该URL为:$ARGUMENTS。
DataverseMcporgbc9a965cInstructions
操作步骤
0. Ask for MCP scope
0. 询问MCP作用范围
Ask the user whether they want to configure the MCP server globally or for this project only:
Would you like to configure the Dataverse MCP server:
- Globally (available in all projects)
- Project-only (available only in this project)
Based on their choice, set the variable:
CONFIG_PATH- Global: (use the user's home directory)
~/.copilot/mcp-config.json - Project: (relative to the current working directory)
.mcp/copilot/mcp.json
Store this path for use in steps 1 and 6.
请问你希望将MCP服务器配置为全局可用还是仅当前项目可用:
请问你希望配置Dataverse MCP服务器的范围:
- 全局(所有项目中可用)
- 仅项目(仅当前项目中可用)
根据用户的选择设置变量:
CONFIG_PATH- 全局:(使用用户的主目录)
~/.copilot/mcp-config.json - 项目:(相对于当前工作目录)
.mcp/copilot/mcp.json
保存此路径,以便在步骤1和步骤6中使用。
1. Check already-configured MCP servers
1. 检查已配置的MCP服务器
Read the MCP configuration file at (determined in step 0) to check for already-configured servers.
CONFIG_PATHThe configuration file is a JSON file with the following structure:
json
{
"mcpServers": {
"ServerName1": {
"type": "http",
"url": "https://example.com/api/mcp"
}
}
}Or it may use instead of as the top-level key.
"servers""mcpServers"Extract all values from the configured servers and store them as . For example:
urlCONFIGURED_URLSjson
["https://orgfbb52bb7.crm.dynamics.com/api/mcp"]If the file doesn't exist or is empty, treat as empty (). This step must never block the skill.
CONFIGURED_URLS[]读取步骤0中确定的路径下的MCP配置文件,检查已配置的服务器。
CONFIG_PATH配置文件为JSON格式,结构如下:
json
{
"mcpServers": {
"ServerName1": {
"type": "http",
"url": "https://example.com/api/mcp"
}
}
}或者,顶层键可能使用而非。
"servers""mcpServers"提取所有已配置服务器的值并存储为。例如:
urlCONFIGURED_URLSjson
["https://orgfbb52bb7.crm.dynamics.com/api/mcp"]如果文件不存在或为空,则将视为空数组()。此步骤不得阻塞Skill的执行。
CONFIGURED_URLS[]2. Ask how to get the environment URL
2. 询问环境URL的提供方式
Ask the user:
How would you like to provide your Dataverse environment URL?
- Auto-discover — List available environments from your Azure account (requires Azure CLI)
- Manual entry — Enter the URL directly
Based on their choice:
- If Auto-discover: Proceed to step 2a
- If Manual entry: Skip to step 2b
询问用户:
你希望如何提供Dataverse环境URL?
- 自动发现 — 从你的Azure账户列出可用环境(需要Azure CLI)
- 手动输入 — 直接输入URL
根据用户的选择:
- 如果选择自动发现:继续执行步骤2a
- 如果选择手动输入:跳至步骤2b
2a. Auto-discover environments
2a. 自动发现环境
Check prerequisites:
- Verify Azure CLI () is installed (check with
azorwhich azon Windows)where az - If not installed, inform the user and fall back to step 2b
Make the API call:
-
Check if the user is logged into Azure CLI:bash
az account showIf this fails, prompt the user to log in:bashaz login -
Get an access token for the Power Apps API:bash
az account get-access-token --resource https://service.powerapps.com/ --query accessToken --output tsv -
Call the Power Apps API to list environments:
GET https://api.powerapps.com/providers/Microsoft.PowerApps/environments?api-version=2016-11-01 Authorization: Bearer {token} Accept: application/json -
Parse the JSON response and filter for environments whereis not null.
properties?.linkedEnvironmentMetadata?.instanceUrl -
For each matching environment, extract:
- as
properties.displayNamedisplayName - (remove trailing slash) as
properties.linkedEnvironmentMetadata.instanceUrlinstanceUrl
-
Create a list of environments in this format:json
[ { "displayName": "My Org (default)", "instanceUrl": "https://orgfbb52bb7.crm.dynamics.com" }, { "displayName": "Another Env", "instanceUrl": "https://orgabc123.crm.dynamics.com" } ]
If the API call succeeds, proceed to step 3.
If the API call fails (user not logged in, network error, no environments found, or any other error), tell the user what went wrong and fall back to step 2b.
检查前置条件:
- 验证Azure CLI()是否已安装(在Windows上使用
az或which az检查)where az - 如果未安装,告知用户并回退到步骤2b
调用API:
-
检查用户是否已登录Azure CLI:bash
az account show如果此命令失败,提示用户登录:bashaz login -
获取Power Apps API的访问令牌:bash
az account get-access-token --resource https://service.powerapps.com/ --query accessToken --output tsv -
调用Power Apps API列出环境:
GET https://api.powerapps.com/providers/Microsoft.PowerApps/environments?api-version=2016-11-01 Authorization: Bearer {token} Accept: application/json -
解析JSON响应,过滤出不为空的环境。
properties?.linkedEnvironmentMetadata?.instanceUrl -
对于每个匹配的环境,提取:
- 作为
properties.displayNamedisplayName - (移除末尾斜杠)作为
properties.linkedEnvironmentMetadata.instanceUrlinstanceUrl
-
按以下格式创建环境列表:json
[ { "displayName": "我的组织(默认)", "instanceUrl": "https://orgfbb52bb7.crm.dynamics.com" }, { "displayName": "其他环境", "instanceUrl": "https://orgabc123.crm.dynamics.com" } ]
如果API调用成功,继续执行步骤3。
如果API调用失败(用户未登录、网络错误、未找到环境或其他任何错误),告知用户错误原因并回退到步骤2b。
2b. Manual entry — ask for the URL
2b. 手动输入 — 请求用户提供URL
Ask the user to provide their environment URL directly:
Please enter your Dataverse environment URL.Example:https://myorg.crm10.dynamics.comYou can find this in the Power Platform Admin Center under Environments.
Then skip to step 4.
请用户直接提供环境URL:
请输入你的Dataverse环境URL。示例:https://myorg.crm10.dynamics.com你可以在Power Platform管理中心的“环境”页面找到该URL。
然后跳至步骤4。
3. Ask the user to select an environment
3. 请用户选择环境
Present the environments as a numbered list. For each environment, check whether any URL in starts with that environment's — if so, append (already configured) to the line.
CONFIGURED_URLSinstanceUrlI found the following Dataverse environments on your account. Which one would you like to configure?
- My Org (default) —
(already configured)https://orgfbb52bb7.crm.dynamics.com- Another Env —
https://orgabc123.crm.dynamics.comEnter the number of your choice, or type "manual" to enter a URL yourself.
If the user selects an already-configured environment, confirm that they want to re-register it (e.g. to change the endpoint type) before proceeding.
If the user types "manual", fall back to step 2b.
将环境以编号列表的形式展示。对于每个环境,检查中是否有以该环境的开头的URL,如果有,则在该行末尾追加**(已配置)**。
CONFIGURED_URLSinstanceUrl我在你的账户中找到了以下Dataverse环境。你希望配置哪一个?
- 我的组织(默认) —
(已配置)https://orgfbb52bb7.crm.dynamics.com- 其他环境 —
https://orgabc123.crm.dynamics.com输入你选择的编号,或输入“manual”手动输入URL。
如果用户选择了已配置的环境,在继续之前需确认用户是否要重新注册(例如,更改端点类型)。
如果用户输入“manual”,则回退到步骤2b。
4. Confirm the selected URL
4. 确认所选URL
Take the from the chosen environment (or the manually entered URL) and strip any trailing slash. This is for the remainder of the skill.
instanceUrlUSER_URL获取所选环境的(或手动输入的URL),并移除末尾的斜杠。此URL将作为后续Skill执行中的。
instanceUrlUSER_URL5. Confirm if the user wants "Preview" or "Generally Available (GA)" endpoint
5. 确认用户希望使用“预览版”还是“正式版(GA)”端点
Ask the user:
Which endpoint would you like to use?
- Generally Available (GA) —
(recommended)/api/mcp- Preview —
(latest features, may be unstable)/api/mcp_preview
Based on their choice:
- If GA: set to
MCP_URL{USER_URL}/api/mcp - If Preview: set to
MCP_URL{USER_URL}/api/mcp_preview
询问用户:
你希望使用哪个端点?
- 正式版(GA) —
(推荐)/api/mcp- 预览版 —
(包含最新功能,可能不稳定)/api/mcp_preview
根据用户的选择:
- 如果选择正式版(GA):将设置为
MCP_URL{USER_URL}/api/mcp - 如果选择预览版:将设置为
MCP_URL{USER_URL}/api/mcp_preview
6. Register the MCP server
6. 注册MCP服务器
Update the MCP configuration file at (determined in step 0) to add the new server.
CONFIG_PATHGenerate a unique server name from the :
USER_URL- Extract the subdomain (organization identifier) from the URL
- Example: →
https://orgbc9a965c.crm10.dynamics.comorgbc9a965c
- Example:
- Prepend to create the server name
DataverseMcp- Example:
DataverseMcporgbc9a965c
- Example:
This is the .
SERVER_NAMEUpdate the configuration file:
-
Ifis for a project-scoped configuration (
CONFIG_PATH), ensure the directory exists first:.mcp/copilot/mcp.jsonbashmkdir -p .mcp/copilot -
Read the existing configuration file at, or create a new empty config if it doesn't exist:
CONFIG_PATHjson{} -
Determine which top-level key to use:
- If the config already has , use that
"servers" - Otherwise, use
"mcpServers"
- If the config already has
-
Add or update the server entry:json
{ "mcpServers": { "{SERVER_NAME}": { "type": "http", "url": "{MCP_URL}" } } } -
Write the updated configuration back towith proper JSON formatting (2-space indentation).
CONFIG_PATH
Important notes:
- Do NOT overwrite other entries in the configuration file
- Preserve the existing structure and formatting
- If already exists, update it with the new
SERVER_NAMEMCP_URL
Proceed to step 7.
更新步骤0中确定的路径下的MCP配置文件,添加新服务器。
CONFIG_PATH从生成唯一的服务器名称:
USER_URL- 从URL中提取子域名(组织标识符)
- 示例:→
https://orgbc9a965c.crm10.dynamics.comorgbc9a965c
- 示例:
- 在前面添加以创建服务器名称
DataverseMcp- 示例:
DataverseMcporgbc9a965c
- 示例:
此名称即为。
SERVER_NAME更新配置文件:
-
如果是项目范围的配置文件(
CONFIG_PATH),请先确保目录存在:.mcp/copilot/mcp.jsonbashmkdir -p .mcp/copilot -
读取路径下的现有配置文件,如果文件不存在则创建一个空配置:
CONFIG_PATHjson{} -
确定要使用的顶层键:
- 如果配置文件中已存在,则使用该键
"servers" - 否则,使用
"mcpServers"
- 如果配置文件中已存在
-
添加或更新服务器条目:json
{ "mcpServers": { "{SERVER_NAME}": { "type": "http", "url": "{MCP_URL}" } } } -
将更新后的配置以正确的JSON格式(2空格缩进)写回。
CONFIG_PATH
重要注意事项:
- 不得覆盖配置文件中的其他条目
- 保留现有结构和格式
- 如果已存在,使用新的
SERVER_NAME更新该条目MCP_URL
继续执行步骤7。
7. Confirm success and instruct restart
7. 确认配置成功并提示重启编辑器
Tell the user:
✅ Dataverse MCP server configured for GitHub Copilot at.{MCP_URL}Configuration saved to:{CONFIG_PATH}IMPORTANT: You must restart your editor for the changes to take effect.Restart your editor or reload the window, then you will be able to:
- List all tables in your Dataverse environment
- Query records from any table
- Create, update, or delete records
- Explore your schema and relationships
告知用户:
✅ 已为GitHub Copilot配置Dataverse MCP服务器,地址为。{MCP_URL}配置已保存至:{CONFIG_PATH}重要提示:你必须重启编辑器才能使更改生效。重启编辑器或重新加载窗口后,你将能够:
- 列出Dataverse环境中的所有表
- 查询任意表中的记录
- 创建、更新或删除记录
- 浏览你的数据架构和关系
8. Troubleshooting
8. 故障排除
If something goes wrong, help the user check:
- The URL format is correct ()
https://<org>.<region>.dynamics.com - They have access to the Dataverse environment
- The environment URL matches what's shown in the Power Platform Admin Center
- Their Environment Admin has enabled "Dataverse CLI MCP" in the Allowed Clients list
- Their Environment has Dataverse MCP enabled, and if they're trying to use the preview endpoint that is enabled
- For project-scoped configuration, ensure the file was created successfully
.mcp/copilot/mcp.json - For global configuration, check permissions on the directory
~/.copilot/
如果出现问题,帮助用户检查以下内容:
- URL格式是否正确()
https://<组织>.<区域>.dynamics.com - 他们是否有权访问该Dataverse环境
- 环境URL是否与Power Platform管理中心中显示的一致
- 他们的环境管理员是否已在“允许的客户端”列表中启用了“Dataverse CLI MCP”
- 他们的环境是否已启用Dataverse MCP,如果使用预览版端点,该端点是否已启用
- 对于项目范围的配置,确保文件已成功创建
.mcp/copilot/mcp.json - 对于全局配置,检查目录的权限
~/.copilot/