1---2name: power-platform-mcp-development3description: Power Platform MCP Custom Connector Development4---5# Power Platform MCP Custom Connector Development67## Instructions89### MCP Protocol Integration10- Always implement JSON-RPC 2.0 standard for MCP communication11- Use `x-ms-agentic-protocol: mcp-streamable-1.0` header for Copilot Studio compatibility12- Structure endpoints to support both standard REST operations and MCP tool invocation13- Transform responses to comply with Copilot Studio constraints (no reference types, single types only)1415### Schema Design Best Practices16- Remove `$ref` and other reference types from JSON schemas as Copilot Studio cannot handle them17- Use single types instead of arrays of types in schema definitions18- Flatten `anyOf`/`oneOf` constructs to single schemas for Copilot Studio compatibility19- Ensure all tool input schemas are self-contained without external references2021### Authentication and Security22- Implement OAuth 2.0 with MCP security best practices within Power Platform constraints23- Use connection parameter sets for flexible authentication configuration24- Validate token audience to prevent passthrough attacks25- Add MCP-specific security headers for enhanced validation26- Support multiple authentication methods (OAuth standard, OAuth enhanced, API key fallback)2728### Custom Script Implementation29- Handle JSON-RPC transformation in the custom script (script.csx)30- Implement proper error handling with JSON-RPC error response format31- Add token validation and audience checking in authentication flow32- Transform MCP server responses for Copilot Studio compatibility33- Use connection parameters for dynamic security configuration3435### Swagger Definition Guidelines36- Use Swagger 2.0 specification for Power Platform compatibility37- Implement proper `operationId` values for each endpoint38- Define clear parameter schemas with appropriate types and descriptions39- Add comprehensive response schemas for all success and error cases40- Include proper HTTP status codes and response headers4142### Resource and Tool Management43- Structure MCP resources to be consumable as tool outputs in Copilot Studio44- Ensure proper MIME type declarations for resource content45- Add audience and priority annotations for better Copilot Studio integration46- Implement resource transformation to meet Copilot Studio requirements4748### Connection Parameter Configuration49- Use enum dropdowns for OAuth version and security level selection50- Provide clear parameter descriptions and constraints51- Support multiple authentication parameter sets for different deployment scenarios52- Include validation rules and default values where appropriate53- Enable dynamic configuration through connection parameter values5455### Error Handling and Logging56- Implement comprehensive error responses following JSON-RPC 2.0 error format57- Add detailed logging for authentication, validation, and transformation steps58- Provide clear error messages that help with troubleshooting59- Include proper HTTP status codes aligned with error conditions6061### Testing and Validation62- Test connector with actual MCP server implementations63- Validate schema transformations work correctly with Copilot Studio64- Verify authentication flows for all supported parameter sets65- Ensure proper error handling for various failure scenarios66- Test connection parameter configurations and dynamic behavior6768## Additional Guidelines6970### Power Platform Certification Requirements71- Include comprehensive documentation (readme.md, CUSTOMIZE.md)72- Provide clear setup and configuration instructions73- Document all authentication options and security considerations74- Include proper publisher and stack owner information75- Ensure compliance with Power Platform connector certification standards7677### MCP Server Compatibility78- Design for compatibility with standard MCP server implementations79- Support common MCP methods like `tools/list`, `tools/call`, `resources/list`80- Handle streaming responses appropriately for `mcp-streamable-1.0` protocol81- Implement proper protocol negotiation and capability detection8283### Copilot Studio Integration84- Ensure tool definitions work correctly within Copilot Studio's constraints85- Test resource access and tool invocation from Copilot Studio interface86- Validate that transformed schemas produce expected behavior in conversations87---8889name: power-platform-mcp-development90description: Instructions for developing Power Platform custom connectors with Model Context Protocol (MCP) integration for Microsoft Copilot Studio Triggers on: **/*.{json,csx,md}91triggers: "**/*.{json,csx,md}"92globs: "**/*.{json,csx,md}"93---94# Power Platform MCP Custom Connector Development9596## Instructions9798### MCP Protocol Integration99- Always implement JSON-RPC 2.0 standard for MCP communication100- Use `x-ms-agentic-protocol: mcp-streamable-1.0` header for Copilot Studio compatibility101- Structure endpoints to support both standard REST operations and MCP tool invocation102- Transform responses to comply with Copilot Studio constraints (no reference types, single types only)103104### Schema Design Best Practices105- Remove `$ref` and other reference types from JSON schemas as Copilot Studio cannot handle them106- Use single types instead of arrays of types in schema definitions107- Flatten `anyOf`/`oneOf` constructs to single schemas for Copilot Studio compatibility108- Ensure all tool input schemas are self-contained without external references109110### Authentication and Security111- Implement OAuth 2.0 with MCP security best practices within Power Platform constraints112- Use connection parameter sets for flexible authentication configuration113- Validate token audience to prevent passthrough attacks114- Add MCP-specific security headers for enhanced validation115- Support multiple authentication methods (OAuth standard, OAuth enhanced, API key fallback)116117### Custom Script Implementation118- Handle JSON-RPC transformation in the custom script (script.csx)119- Implement proper error handling with JSON-RPC error response format120- Add token validation and audience checking in authentication flow121- Transform MCP server responses for Copilot Studio compatibility122- Use connection parameters for dynamic security configuration123124### Swagger Definition Guidelines125- Use Swagger 2.0 specification for Power Platform compatibility126- Implement proper `operationId` values for each endpoint127- Define clear parameter schemas with appropriate types and descriptions128- Add comprehensive response schemas for all success and error cases129- Include proper HTTP status codes and response headers130131### Resource and Tool Management132- Structure MCP resources to be consumable as tool outputs in Copilot Studio133- Ensure proper MIME type declarations for resource content134- Add audience and priority annotations for better Copilot Studio integration135- Implement resource transformation to meet Copilot Studio requirements136137### Connection Parameter Configuration138- Use enum dropdowns for OAuth version and security level selection139- Provide clear parameter descriptions and constraints140- Support multiple authentication parameter sets for different deployment scenarios141- Include validation rules and default values where appropriate142- Enable dynamic configuration through connection parameter values143144### Error Handling and Logging145- Implement comprehensive error responses following JSON-RPC 2.0 error format146- Add detailed logging for authentication, validation, and transformation steps147- Provide clear error messages that help with troubleshooting148- Include proper HTTP status codes aligned with error conditions149150### Testing and Validation151- Test connector with actual MCP server implementations152- Validate schema transformations work correctly with Copilot Studio153- Verify authentication flows for all supported parameter sets154- Ensure proper error handling for various failure scenarios155- Test connection parameter configurations and dynamic behavior156157## Additional Guidelines158159### Power Platform Certification Requirements160- Include comprehensive documentation (readme.md, CUSTOMIZE.md)161- Provide clear setup and configuration instructions162- Document all authentication options and security considerations163- Include proper publisher and stack owner information164- Ensure compliance with Power Platform connector certification standards165166### MCP Server Compatibility167- Design for compatibility with standard MCP server implementations168- Support common MCP methods like `tools/list`, `tools/call`, `resources/list`169- Handle streaming responses appropriately for `mcp-streamable-1.0` protocol170- Implement proper protocol negotiation and capability detection171172### Copilot Studio Integration173- Ensure tool definitions work correctly within Copilot Studio's constraints174- Test resource access and tool invocation from Copilot Studio interface175- Validate that transformed schemas produce expected behavior in conversations176- Confirm proper integration with Copilot Studio's agent framework