This repository contains two production-ready Power Automate custom connectors built using the Model Connector Protocol (MCP) that integrate AI models with specialized capabilities:
Build AI agents with custom tools using Model Context Protocol (MCP). Define your own tools, resources, and prompts for intelligent automation.
Use Cases:
- Business process automation with custom APIs
- Multi-system orchestration
- Intelligent routing and decision making
- Data enrichment and analysis
AI assistant powered by Microsoft Learn documentation. Ask questions about Microsoft technologies and get answers grounded in official documentation with citations.
Use Cases:
- Developer assistance and training
- Technical support automation
- Documentation search and summarization
- Code sample discovery
| Feature | Generic MCP Connector | MS Learn MCP Connector |
|---|---|---|
| Purpose | Custom tool orchestration | Microsoft Learn documentation |
| Tools | You define them | Pre-built (docs search, code samples, fetch) |
| Data Source | Your APIs/systems | Microsoft Learn (learn.microsoft.com) |
| Customization | Fully customizable | Fixed tools, customizable AI behavior |
| Best For | Building unique AI agents | Microsoft tech questions & docs |
Model Connector Protocol/
├── readme.md # This file - repository overview
├── Generic-MCP-Connector.md # Generic MCP Connector documentation
├── script.csx # Generic MCP Connector code
├── apiDefinition.swagger.json # Generic connector API definition
├── apiProperties.json # Generic connector properties
├── Alternate Authentication Types/ # Auth examples (API key, OAuth, etc.)
└── MS Learn ModelConnectorProtocol/ # MS Learn MCP Connector (complete)
├── readme.md # MS Learn connector documentation
├── script.csx # MS Learn connector code
├── apiDefinition.swagger.json # MS Learn API definition
└── apiProperties.json # MS Learn connector properties
- Power Platform environment with Premium licensing
- Power Platform CLI (installation guide)
- AI model API key:
- Anthropic Claude (recommended) - Get key from Anthropic Console
- OpenAI - Get key from OpenAI Platform
- Azure OpenAI - Deploy in Azure Portal
For Custom AI Agents:
- Use the Generic MCP Connector (root folder)
- Follow the Generic MCP Connector Guide
- Define your custom tools in
script.csx
For Microsoft Learn Documentation:
- Use the MS Learn MCP Connector (
MS Learn ModelConnectorProtocol/folder) - Follow the MS Learn Connector Guide
- Configure Azure OpenAI or other AI provider
-
Authenticate with Power Platform CLI:
pac auth create --environment https://yourorg.crm.dynamics.com
-
Navigate to connector folder:
# For Generic MCP: cd "Model Connector Protocol" # For MS Learn MCP: cd "Model Connector Protocol/MS Learn ModelConnectorProtocol"
-
Create the connector:
pac connector create --api-definition-file apiDefinition.swagger.json --api-properties-file apiProperties.json --script-file script.csx
-
Create connection in Power Automate:
- Go to Power Automate → Data → Connections
- Create new connection
- Enter your AI model API key
-
Test in a flow:
- Create a test flow
- Add connector action
- Send a natural language request
Both connectors support:
- Multiple AI Providers: Anthropic Claude, OpenAI, Azure OpenAI
- Customizable System Instructions: Control AI behavior and personality
- Configurable Parameters: Temperature, token limits, tool execution settings
- Custom Code: Full C# scripting for advanced scenarios
Update these constants in your chosen connector's script.csx:
// For Anthropic Claude (default)
private const string DEFAULT_BASE_URL = "https://api.anthropic.com/v1";
private const string DEFAULT_MODEL = "claude-sonnet-4-20250514";
// For OpenAI
private const string DEFAULT_BASE_URL = "https://api.openai.com/v1";
private const string DEFAULT_MODEL = "gpt-4o";
// For Azure OpenAI
private const string DEFAULT_BASE_URL = "https://YOUR_RESOURCE_NAME.openai.azure.com";
private const string DEFAULT_MODEL = "gpt-4o";- ✅ Define custom tools (APIs, databases, web scraping, etc.)
- ✅ Resource management (HTTP/HTTPS data sources)
- ✅ Reusable prompts library
- ✅ Automatic tool selection and chaining
- ✅ Multi-step reasoning
- ✅ Full Model Context Protocol support
- ✅ Search Microsoft Learn documentation
- ✅ Search code samples with language filtering
- ✅ Fetch complete documentation pages
- ✅ Automatic source citations with URLs and titles
- ✅ AI synthesis of multiple sources
- ✅ Markdown-formatted responses
Input: "Check the weather in Seattle and if it's raining, send a Slack message to #team"
AI Agent:
1. Calls WeatherAPI tool for Seattle
2. Analyzes result (raining = true)
3. Calls SlackAPI tool to send message
4. Returns: "It's currently raining in Seattle. I've notified #team channel."
Input: "How do I create a custom connector with OAuth authentication?"
AI Assistant:
1. Searches Microsoft Learn docs for custom connectors + OAuth
2. Fetches relevant pages
3. Synthesizes answer with code samples
4. Returns: Markdown response with step-by-step guide and 5+ citation links
AI Model Usage:
- You pay your AI provider directly based on tokens used
- Typical costs (per 1M tokens):
- Claude 3.5 Sonnet: $3 input / $15 output
- GPT-4o: $2.50 input / $10 output
- Azure OpenAI: Similar, plus Azure hosting
Power Platform:
- Custom connectors require Premium licensing
- No additional per-request costs from Microsoft
External APIs (Generic MCP only):
- Your custom tools may call paid APIs
- Costs vary by service
- ✅ Store API keys in Power Platform connections (secure storage)
- ✅ Use HTTPS for all external calls
- ✅ Validate all tool inputs
- ✅ Implement rate limiting in custom tools
- ✅ Log tool executions for audit trails
- ❌ Never hardcode API keys in connector code
- ❌ Don't expose sensitive data in tool responses
- ❌ Avoid unrestricted access to dangerous operations
- Ensure you entered the API key when creating the connection
- Verify the key is valid in your AI provider's console
- Delete and recreate the connection
- Wait for the specified retry time
- Request higher quota from your AI provider
- Use a model with higher rate limits
- Check tool implementation in
script.csx - Verify external APIs are accessible
- Review Power Platform connector logs
- Ensure custom code connectors use a valid host
- Both connectors use dummy hosts (e.g.,
api.example.com) - Custom code handles all requests internally
- Review connector-specific READMEs for detailed guides
- Check Power Platform Community
- Review Custom Connectors Documentation
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Test your changes thoroughly
- Submit a pull request with clear description
Include:
- Which connector (Generic MCP or MS Learn MCP)
- AI provider being used
- Sample request (sanitized)
- Error message and logs
- Steps to reproduce
MIT License - See individual connector folders for full license text.
Troy Taylor
- Email: troy@troystaylor.com
- Publisher: Troy Taylor
Ready to get started?
- Build custom AI agents → Generic MCP Connector Guide
- Search Microsoft Learn docs → MS Learn MCP Connector Guide