mcp-copilot-studio-server-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePower Platform MCP Connector Generator
Power Platform MCP连接器生成器
Generate a complete Power Platform custom connector with Model Context Protocol (MCP) integration for Microsoft Copilot Studio. This prompt creates all necessary files following Power Platform connector standards with MCP streamable HTTP support.
为Microsoft Copilot Studio生成一个集成了模型上下文协议(MCP)的完整Power Platform自定义连接器。本提示将遵循Power Platform连接器标准创建所有必要文件,并支持MCP可流式传输HTTP。
Instructions
说明
Create a complete MCP server implementation that:
-
Uses Copilot Studio MCP Pattern:
- Implement
x-ms-agentic-protocol: mcp-streamable-1.0 - Support JSON-RPC 2.0 communication protocol
- Provide streamable HTTP endpoint at
/mcp - Follow Power Platform connector structure
- Implement
-
Schema Compliance Requirements:
- NO reference types in tool inputs/outputs (filtered by Copilot Studio)
- Single type values only (not arrays of multiple types)
- Avoid enum inputs (interpreted as string, not enum)
- Use primitive types: string, number, integer, boolean, array, object
- Ensure all endpoints return full URIs
-
MCP Components to Include:
- Tools: Functions for the language model to call (✅ Supported in Copilot Studio)
- Resources: File-like data outputs from tools (✅ Supported in Copilot Studio - must be tool outputs to be accessible)
- Prompts: Predefined templates for specific tasks (❌ Not yet supported in Copilot Studio)
-
Implementation Structure:
/apiDefinition.swagger.json (Power Platform connector schema) /apiProperties.json (Connector metadata and configuration) /script.csx (Custom code transformations and logic) /server/ (MCP server implementation) /tools/ (Individual MCP tools) /resources/ (MCP resource handlers)
创建一个完整的MCP服务器实现,满足以下要求:
-
采用Copilot Studio MCP模式:
- 实现
x-ms-agentic-protocol: mcp-streamable-1.0 - 支持JSON-RPC 2.0通信协议
- 在路径提供可流式传输的HTTP端点
/mcp - 遵循Power Platform连接器结构
- 实现
-
架构合规要求:
- 工具输入/输出中禁止使用引用类型(Copilot Studio会过滤此类类型)
- 仅允许单一类型值(不允许多类型数组)
- 避免使用枚举输入(会被解释为字符串而非枚举)
- 使用原始类型:string、number、integer、boolean、array、object
- 确保所有端点返回完整URI
-
需包含的MCP组件:
- 工具(Tools):供语言模型调用的函数(✅ Copilot Studio支持)
- 资源(Resources):工具输出的类文件数据(✅ Copilot Studio支持 - 必须作为工具输出才能被访问)
- 提示词(Prompts):特定任务的预定义模板(❌ Copilot Studio暂不支持)
-
实现结构:
/apiDefinition.swagger.json (Power Platform连接器架构文件) /apiProperties.json (连接器元数据和配置) /script.csx (自定义代码转换和逻辑) /server/ (MCP服务器实现代码) /tools/ (独立MCP工具) /resources/ (MCP资源处理器)
Context Variables
上下文变量
- Server Purpose: [Describe what the MCP server should accomplish]
- Tools Needed: [List of specific tools to implement]
- Resources: [Types of resources to provide]
- Authentication: [Auth method: none, api-key, oauth2]
- Host Environment: [Azure Function, Express.js, FastAPI, etc.]
- Target APIs: [External APIs to integrate with]
- 服务器用途:[描述MCP服务器的目标功能]
- 所需工具:[列出需实现的具体工具]
- 资源:[需提供的资源类型]
- 认证方式:[认证方法:无、api-key、oauth2]
- 宿主环境:[Azure Function、Express.js、FastAPI等]
- 目标API:[需集成的外部API]
Expected Output
预期输出
Generate:
-
apiDefinition.swagger.json with:
- Proper
x-ms-agentic-protocol: mcp-streamable-1.0 - MCP endpoint at POST
/mcp - Compliant schema definitions (no reference types)
- McpResponse and McpErrorResponse definitions
- Proper
-
apiProperties.json with:
- Connector metadata and branding
- Authentication configuration
- Policy templates if needed
-
script.csx with:
- Custom C# code for request/response transformations
- MCP JSON-RPC message handling logic
- Data validation and processing functions
- Error handling and logging capabilities
-
MCP Server Code with:
- JSON-RPC 2.0 request handler
- Tool registration and execution
- Resource management (as tool outputs)
- Proper error handling
- Copilot Studio compatibility checks
-
Individual Tools that:
- Accept only primitive type inputs
- Return structured outputs
- Include resources as outputs when needed
- Provide clear descriptions for Copilot Studio
-
Deployment Configuration for:
- Power Platform environment
- Copilot Studio agent integration
- Testing and validation
生成以下内容:
-
apiDefinition.swagger.json:
- 正确配置
x-ms-agentic-protocol: mcp-streamable-1.0 - 在POST 路径提供MCP端点
/mcp - 符合规范的架构定义(无引用类型)
- 包含McpResponse和McpErrorResponse定义
- 正确配置
-
apiProperties.json:
- 连接器元数据和品牌信息
- 认证配置
- 必要时提供策略模板
-
script.csx:
- 用于请求/响应转换的自定义C#代码
- MCP JSON-RPC消息处理逻辑
- 数据验证和处理函数
- 错误处理和日志记录功能
-
MCP服务器代码:
- JSON-RPC 2.0请求处理器
- 工具注册与执行逻辑
- 资源管理(作为工具输出)
- 完善的错误处理
- Copilot Studio兼容性检查
-
独立工具:
- 仅接受原始类型输入
- 返回结构化输出
- 必要时将资源作为输出返回
- 为Copilot Studio提供清晰的描述
-
部署配置:
- Power Platform环境配置
- Copilot Studio Agent集成配置
- 测试与验证方案
Validation Checklist
验证清单
Ensure generated code:
- No reference types in schemas
- All type fields are single types
- Enum handling via string with validation
- Resources available through tool outputs
- Full URI endpoints
- JSON-RPC 2.0 compliance
- Proper x-ms-agentic-protocol header
- McpResponse/McpErrorResponse schemas
- Clear tool descriptions for Copilot Studio
- Generative Orchestration compatible
确保生成的代码满足以下要求:
- 架构中无引用类型
- 所有类型字段均为单一类型
- 通过字符串加验证的方式处理枚举
- 资源可通过工具输出访问
- 端点返回完整URI
- 符合JSON-RPC 2.0规范
- 配置正确的x-ms-agentic-protocol头
- 包含McpResponse/McpErrorResponse架构
- 为Copilot Studio提供清晰的工具描述
- 兼容生成式编排
Example Usage
示例用法
yaml
Server Purpose: Customer data management and analysis
Tools Needed:
- searchCustomers
- getCustomerDetails
- analyzeCustomerTrends
Resources:
- Customer profiles
- Analysis reports
Authentication: oauth2
Host Environment: Azure Function
Target APIs: CRM System REST APIyaml
Server Purpose: Customer data management and analysis
Tools Needed:
- searchCustomers
- getCustomerDetails
- analyzeCustomerTrends
Resources:
- Customer profiles
- Analysis reports
Authentication: oauth2
Host Environment: Azure Function
Target APIs: CRM System REST API