|
1 | | -## Enterprise Integration |
| 1 | +# Enterprise Integration |
2 | 2 |
|
3 | | -Integrating MCP with enterprise systems like Azure OpenAI and Microsoft AI Foundry. |
| 3 | +When building MCP Servers in an enterprise context, you often need to integrate with existing AI platforms and services. This section covers how to integrate MCP with enterprise systems like Azure OpenAI and Microsoft AI Foundry, enabling advanced AI capabilities and tool orchestration. |
4 | 4 |
|
5 | | -### Azure OpenAI Integration |
| 5 | +## Introduction |
| 6 | + |
| 7 | +In this lesson, you'll learn how to integrate Model Context Protocol (MCP) with enterprise AI systems, focusing on Azure OpenAI and Microsoft AI Foundry. These integrations allow you to leverage powerful AI models and tools while maintaining the flexibility and extensibility of MCP. |
| 8 | + |
| 9 | +## Learning Objectives |
| 10 | + |
| 11 | +By the end of this lesson, you will be able to: |
| 12 | + |
| 13 | +- Integrate MCP with Azure OpenAI to utilize its AI capabilities. |
| 14 | +- Implement MCP tool orchestration with Azure OpenAI. |
| 15 | +- Combine MCP with Microsoft AI Foundry for advanced AI agent capabilities. |
| 16 | +- Leverage Azure Machine Learning (ML) for executing ML pipelines and registering models as MCP tools. |
| 17 | + |
| 18 | +## Azure OpenAI Integration |
| 19 | + |
| 20 | +Azure OpenAI provides access to powerful AI models like GPT-4 and others. Integrating MCP with Azure OpenAI allows you to utilize these models while maintaining the flexibility of MCP's tool orchestration. |
| 21 | + |
| 22 | +<details> |
| 23 | +<summary>csharp</summary> |
| 24 | + |
| 25 | +In this code snippet, we demonstrate how to integrate MCP with Azure OpenAI using the Azure OpenAI SDK. |
6 | 26 |
|
7 | 27 | ```csharp |
8 | 28 | // .NET Azure OpenAI Integration |
@@ -66,7 +86,24 @@ namespace EnterpriseIntegration |
66 | 86 | } |
67 | 87 | ``` |
68 | 88 |
|
69 | | -### Microsoft AI Foundry Integration |
| 89 | +In the preceding code we've: |
| 90 | + |
| 91 | +- Configured the Azure OpenAI client with the endpoint, deployment name and API key. |
| 92 | +- Created a method `GetCompletionWithToolsAsync` to get completions with tool support. |
| 93 | +- Handled tool calls in the response. |
| 94 | + |
| 95 | +You're encouraged to implement the actual tool handling logic based on your specific MCP server setup. |
| 96 | + |
| 97 | +</details> |
| 98 | + |
| 99 | +## Microsoft AI Foundry Integration |
| 100 | + |
| 101 | +Azure AI Foundry provides a platform for building and deploying AI agents. Integrating MCP with AI Foundry allows you to leverage its capabilities while maintaining the flexibility of MCP. |
| 102 | + |
| 103 | +In the below code, we develop an Agent integration that processes requests and handles tool calls using MCP. |
| 104 | + |
| 105 | +<details> |
| 106 | +<summary>Java</summary> |
70 | 107 |
|
71 | 108 | ```java |
72 | 109 | // Java AI Foundry Agent Integration |
@@ -124,7 +161,20 @@ public class AIFoundryMcpBridge { |
124 | 161 | } |
125 | 162 | ``` |
126 | 163 |
|
127 | | -### Python Enterprise Integration Example |
| 164 | +In the preceding code, we've: |
| 165 | + |
| 166 | +- Created an `AIFoundryMcpBridge` class that integrates with both AI Foundry and MCP. |
| 167 | +- Implemented a method `processAgentRequest` that processes an AI Foundry agent request. |
| 168 | +- Handled tool calls by executing them through the MCP client and submitting the results back to the AI Foundry agent. |
| 169 | + |
| 170 | +</details> |
| 171 | + |
| 172 | +## Integrating MCP with Azure ML |
| 173 | + |
| 174 | +Integrating MCP with Azure Machine Learning (ML) allows you to leverage Azure's powerful ML capabilities while maintaining the flexibility of MCP. This integration can be used to execute ML pipelines, register models as tools, and manage compute resources. |
| 175 | + |
| 176 | +<details> |
| 177 | +<summary>Python</summary> |
128 | 178 |
|
129 | 179 | ```python |
130 | 180 | # Python Azure AI Integration |
@@ -247,3 +297,17 @@ class EnterpriseAiIntegration: |
247 | 297 | } |
248 | 298 | return mapping.get(ml_type, "string") |
249 | 299 | ``` |
| 300 | + |
| 301 | +In the preceding code, we've: |
| 302 | + |
| 303 | +- Created an `EnterpriseAiIntegration` class that integrates MCP with Azure ML. |
| 304 | +- Implemented an `execute_ml_pipeline` method that processes input data using MCP tools and submits an ML pipeline to Azure ML. |
| 305 | +- Implemented a `register_ml_model_as_tool` method that registers an Azure ML model as an MCP tool, including creating the necessary deployment environment and compute resources. |
| 306 | +- Mapped Azure ML data types to JSON schema types for tool registration. |
| 307 | +- Used asynchronous programming to handle potentially long-running operations like ML pipeline execution and model registration. |
| 308 | + |
| 309 | +</details> |
| 310 | + |
| 311 | +## What's next |
| 312 | + |
| 313 | +- [Multi modality](../mcp-multi-modality/README.md) |
0 commit comments