mcp-configure

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Configure 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.,
DataverseMcporgbc9a965c
). If the user provided a URL it is: $ARGUMENTS.
本Skill用于为GitHub Copilot配置与你的组织环境URL关联的Dataverse MCP服务器。每个组织都会基于组织标识符注册一个唯一的服务器名称(例如:
DataverseMcporgbc9a965c
)。如果用户提供了URL,该URL为:$ARGUMENTS。

Instructions

操作步骤

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:
  1. Globally (available in all projects)
  2. Project-only (available only in this project)
Based on their choice, set the
CONFIG_PATH
variable:
  • Global:
    ~/.copilot/mcp-config.json
    (use the user's home directory)
  • Project:
    .mcp/copilot/mcp.json
    (relative to the current working directory)
Store this path for use in steps 1 and 6.
请问你希望将MCP服务器配置为全局可用还是仅当前项目可用:
请问你希望配置Dataverse MCP服务器的范围:
  1. 全局(所有项目中可用)
  2. 仅项目(仅当前项目中可用)
根据用户的选择设置
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
CONFIG_PATH
(determined in step 0) to check for already-configured servers.
The 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
"servers"
instead of
"mcpServers"
as the top-level key.
Extract all
url
values from the configured servers and store them as
CONFIGURED_URLS
. For example:
json
["https://orgfbb52bb7.crm.dynamics.com/api/mcp"]
If the file doesn't exist or is empty, treat
CONFIGURED_URLS
as empty (
[]
). This step must never block the skill.
读取步骤0中确定的
CONFIG_PATH
路径下的MCP配置文件,检查已配置的服务器。
配置文件为JSON格式,结构如下:
json
{
  "mcpServers": {
    "ServerName1": {
      "type": "http",
      "url": "https://example.com/api/mcp"
    }
  }
}
或者,顶层键可能使用
"servers"
而非
"mcpServers"
提取所有已配置服务器的
url
值并存储为
CONFIGURED_URLS
。例如:
json
["https://orgfbb52bb7.crm.dynamics.com/api/mcp"]
如果文件不存在或为空,则将
CONFIGURED_URLS
视为空数组(
[]
)。此步骤不得阻塞Skill的执行。

2. Ask how to get the environment URL

2. 询问环境URL的提供方式

Ask the user:
How would you like to provide your Dataverse environment URL?
  1. Auto-discover — List available environments from your Azure account (requires Azure CLI)
  2. 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?
  1. 自动发现 — 从你的Azure账户列出可用环境(需要Azure CLI)
  2. 手动输入 — 直接输入URL
根据用户的选择:
  • 如果选择自动发现:继续执行步骤2a
  • 如果选择手动输入:跳至步骤2b

2a. Auto-discover environments

2a. 自动发现环境

Check prerequisites:
  • Verify Azure CLI (
    az
    ) is installed (check with
    which az
    or
    where az
    on Windows)
  • If not installed, inform the user and fall back to step 2b
Make the API call:
  1. Check if the user is logged into Azure CLI:
    bash
    az account show
    If this fails, prompt the user to log in:
    bash
    az login
  2. Get an access token for the Power Apps API:
    bash
    az account get-access-token --resource https://service.powerapps.com/ --query accessToken --output tsv
  3. 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
  4. Parse the JSON response and filter for environments where
    properties?.linkedEnvironmentMetadata?.instanceUrl
    is not null.
  5. For each matching environment, extract:
    • properties.displayName
      as
      displayName
    • properties.linkedEnvironmentMetadata.instanceUrl
      (remove trailing slash) as
      instanceUrl
  6. 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(
    az
    )是否已安装(在Windows上使用
    which az
    where az
    检查)
  • 如果未安装,告知用户并回退到步骤2b
调用API:
  1. 检查用户是否已登录Azure CLI:
    bash
    az account show
    如果此命令失败,提示用户登录:
    bash
    az login
  2. 获取Power Apps API的访问令牌:
    bash
    az account get-access-token --resource https://service.powerapps.com/ --query accessToken --output tsv
  3. 调用Power Apps API列出环境:
    GET https://api.powerapps.com/providers/Microsoft.PowerApps/environments?api-version=2016-11-01
    Authorization: Bearer {token}
    Accept: application/json
  4. 解析JSON响应,过滤出
    properties?.linkedEnvironmentMetadata?.instanceUrl
    不为空的环境。
  5. 对于每个匹配的环境,提取:
    • properties.displayName
      作为
      displayName
    • properties.linkedEnvironmentMetadata.instanceUrl
      (移除末尾斜杠)作为
      instanceUrl
  6. 按以下格式创建环境列表:
    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.com
You 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
CONFIGURED_URLS
starts with that environment's
instanceUrl
— if so, append (already configured) to the line.
I found the following Dataverse environments on your account. Which one would you like to configure?
  1. My Org (default) —
    https://orgfbb52bb7.crm.dynamics.com
    (already configured)
  2. Another Env —
    https://orgabc123.crm.dynamics.com
Enter 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.
将环境以编号列表的形式展示。对于每个环境,检查
CONFIGURED_URLS
中是否有以该环境的
instanceUrl
开头的URL,如果有,则在该行末尾追加**(已配置)**。
我在你的账户中找到了以下Dataverse环境。你希望配置哪一个?
  1. 我的组织(默认) —
    https://orgfbb52bb7.crm.dynamics.com
    (已配置)
  2. 其他环境 —
    https://orgabc123.crm.dynamics.com
输入你选择的编号,或输入“manual”手动输入URL。
如果用户选择了已配置的环境,在继续之前需确认用户是否要重新注册(例如,更改端点类型)。
如果用户输入“manual”,则回退到步骤2b。

4. Confirm the selected URL

4. 确认所选URL

Take the
instanceUrl
from the chosen environment (or the manually entered URL) and strip any trailing slash. This is
USER_URL
for the remainder of the skill.
获取所选环境的
instanceUrl
(或手动输入的URL),并移除末尾的斜杠。此URL将作为后续Skill执行中的
USER_URL

5. Confirm if the user wants "Preview" or "Generally Available (GA)" endpoint

5. 确认用户希望使用“预览版”还是“正式版(GA)”端点

Ask the user:
Which endpoint would you like to use?
  1. Generally Available (GA)
    /api/mcp
    (recommended)
  2. Preview
    /api/mcp_preview
    (latest features, may be unstable)
Based on their choice:
  • If GA: set
    MCP_URL
    to
    {USER_URL}/api/mcp
  • If Preview: set
    MCP_URL
    to
    {USER_URL}/api/mcp_preview
询问用户:
你希望使用哪个端点?
  1. 正式版(GA)
    /api/mcp
    (推荐)
  2. 预览版
    /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
CONFIG_PATH
(determined in step 0) to add the new server.
Generate a unique server name from the
USER_URL
:
  1. Extract the subdomain (organization identifier) from the URL
    • Example:
      https://orgbc9a965c.crm10.dynamics.com
      orgbc9a965c
  2. Prepend
    DataverseMcp
    to create the server name
    • Example:
      DataverseMcporgbc9a965c
This is the
SERVER_NAME
.
Update the configuration file:
  1. If
    CONFIG_PATH
    is for a project-scoped configuration (
    .mcp/copilot/mcp.json
    ), ensure the directory exists first:
    bash
    mkdir -p .mcp/copilot
  2. Read the existing configuration file at
    CONFIG_PATH
    , or create a new empty config if it doesn't exist:
    json
    {}
  3. Determine which top-level key to use:
    • If the config already has
      "servers"
      , use that
    • Otherwise, use
      "mcpServers"
  4. Add or update the server entry:
    json
    {
      "mcpServers": {
        "{SERVER_NAME}": {
          "type": "http",
          "url": "{MCP_URL}"
        }
      }
    }
  5. Write the updated configuration back to
    CONFIG_PATH
    with proper JSON formatting (2-space indentation).
Important notes:
  • Do NOT overwrite other entries in the configuration file
  • Preserve the existing structure and formatting
  • If
    SERVER_NAME
    already exists, update it with the new
    MCP_URL
Proceed to step 7.
更新步骤0中确定的
CONFIG_PATH
路径下的MCP配置文件,添加新服务器。
USER_URL
生成唯一的服务器名称
  1. 从URL中提取子域名(组织标识符)
    • 示例:
      https://orgbc9a965c.crm10.dynamics.com
      orgbc9a965c
  2. 在前面添加
    DataverseMcp
    以创建服务器名称
    • 示例:
      DataverseMcporgbc9a965c
此名称即为
SERVER_NAME
更新配置文件:
  1. 如果
    CONFIG_PATH
    项目范围的配置文件(
    .mcp/copilot/mcp.json
    ),请先确保目录存在:
    bash
    mkdir -p .mcp/copilot
  2. 读取
    CONFIG_PATH
    路径下的现有配置文件,如果文件不存在则创建一个空配置:
    json
    {}
  3. 确定要使用的顶层键:
    • 如果配置文件中已存在
      "servers"
      ,则使用该键
    • 否则,使用
      "mcpServers"
  4. 添加或更新服务器条目:
    json
    {
      "mcpServers": {
        "{SERVER_NAME}": {
          "type": "http",
          "url": "{MCP_URL}"
        }
      }
    }
  5. 将更新后的配置以正确的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
    .mcp/copilot/mcp.json
    file was created successfully
  • For global configuration, check permissions on the
    ~/.copilot/
    directory
如果出现问题,帮助用户检查以下内容:
  • URL格式是否正确(
    https://<组织>.<区域>.dynamics.com
  • 他们是否有权访问该Dataverse环境
  • 环境URL是否与Power Platform管理中心中显示的一致
  • 他们的环境管理员是否已在“允许的客户端”列表中启用了“Dataverse CLI MCP”
  • 他们的环境是否已启用Dataverse MCP,如果使用预览版端点,该端点是否已启用
  • 对于项目范围的配置,确保
    .mcp/copilot/mcp.json
    文件已成功创建
  • 对于全局配置,检查
    ~/.copilot/
    目录的权限