1
---
2
name: mcp-copilot-studio-server-generator
3
description: 'Generate a complete MCP server implementation optimized for Copilot Studio integration with proper schema constraints and streamable HTTP support'
4
---
5
6
# Power Platform MCP Connector Generator
7
8
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.
9
10
## Instructions
11
12
Create a complete MCP server implementation that:
13
14
1. **Uses Copilot Studio MCP Pattern:**
15
- Implement `x-ms-agentic-protocol: mcp-streamable-1.0`
16
- Support JSON-RPC 2.0 communication protocol
17
- Provide streamable HTTP endpoint at `/mcp`
18
- Follow Power Platform connector structure
19
20
2. **Schema Compliance Requirements:**
21
- **NO reference types** in tool inputs/outputs (filtered by Copilot Studio)
22
- **Single type values only** (not arrays of multiple types)
23
- **Avoid enum inputs** (interpreted as string, not enum)
24
- Use primitive types: string, number, integer, boolean, array, object
25
- Ensure all endpoints return full URIs
26
27
3. **MCP Components to Include:**
28
- **Tools**: Functions for the language model to call (✅ Supported in Copilot Studio)
29
- **Resources**: File-like data outputs from tools (✅ Supported in Copilot Studio - must be tool outputs to be accessible)
30
- **Prompts**: Predefined templates for specific tasks (❌ Not yet supported in Copilot Studio)
31
32
4. **Implementation Structure:**
33
```
34
/apiDefinition.swagger.json (Power Platform connector schema)
35
/apiProperties.json (Connector metadata and configuration)
36
/script.csx (Custom code transformations and logic)
37
/server/ (MCP server implementation)
38
/tools/ (Individual MCP tools)
39
/resources/ (MCP resource handlers)
40
```
41
42
## Context Variables
43
44
- **Server Purpose**: [Describe what the MCP server should accomplish]
45
- **Tools Needed**: [List of specific tools to implement]
46
- **Resources**: [Types of resources to provide]
47
- **Authentication**: [Auth method: none, api-key, oauth2]
48
- **Host Environment**: [Azure Function, Express.js, FastAPI, etc.]
49
- **Target APIs**: [External APIs to integrate with]
50
51
## Expected Output
52
53
Generate:
54
55
1. **apiDefinition.swagger.json** with:
56
- Proper `x-ms-agentic-protocol: mcp-streamable-1.0`
57
- MCP endpoint at POST `/mcp`
58
- Compliant schema definitions (no reference types)
59
- McpResponse and McpErrorResponse definitions
60
61
2. **apiProperties.json** with:
62
- Connector metadata and branding
63
- Authentication configuration
64
- Policy templates if needed
65
66
3. **script.csx** with:
67
- Custom C# code for request/response transformations
68
- MCP JSON-RPC message handling logic
69
- Data validation and processing functions
70
- Error handling and logging capabilities
71
72
4. **MCP Server Code** with:
73
- JSON-RPC 2.0 request handler
74
- Tool registration and execution
75
- Resource management (as tool outputs)
76
- Proper error handling
77
- Copilot Studio compatibility checks
78
79
5. **Individual Tools** that:
80
- Accept only primitive type inputs
81
- Return structured outputs
82
- Include resources as outputs when needed
83
- Provide clear descriptions for Copilot Studio
84
85
6. **Deployment Configuration** for:
86
- Power Platform environment
87
- Copilot Studio agent integration
88
- Testing and validation
89
90
## Validation Checklist
91
92
Ensure generated code:
93
- [ ] No reference types in schemas
94
- [ ] All type fields are single types
95
- [ ] Enum handling via string with validation
96
- [ ] Resources available through tool outputs
97
- [ ] Full URI endpoints
98
- [ ] JSON-RPC 2.0 compliance
99
- [ ] Proper x-ms-agentic-protocol header
100
- [ ] McpResponse/McpErrorResponse schemas
101
- [ ] Clear tool descriptions for Copilot Studio
102
- [ ] Generative Orchestration compatible
103
104
## Example Usage
105
106
```yaml
107
Server Purpose: Customer data management and analysis
108
Tools Needed:
109
- searchCustomers
110
- getCustomerDetails
111
- analyzeCustomerTrends
112
Resources:
113
- Customer profiles
114
- Analysis reports
115
Authentication: oauth2
116
Host Environment: Azure Function
117
Target APIs: CRM System REST API
118
```
119