Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions labs/mcp-a2a-agents/deploy-a2a-infra-assests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@
" print(f\" Input Schema: {tool.inputSchema}\")\n",
"\n",
"try:\n",
" asyncio.run(list_tools(f\"{apim_resource_gateway_url}/weather\"))\n",
" asyncio.run(list_tools(f\"{apim_resource_gateway_url}/oncall\"))\n",
" asyncio.run(list_tools(f\"{apim_resource_gateway_url}/weather/mcp\"))\n",
" asyncio.run(list_tools(f\"{apim_resource_gateway_url}/oncall/mcp\"))\n",
"finally:\n",
" print(f\"✅ Connection closed\")\n"
]
Expand Down Expand Up @@ -300,13 +300,13 @@
"\n",
"weather_plugin = MCPStreamableHttpPlugin(\n",
" name=\"Weather\",\n",
" url=f\"{apim_resource_gateway_url}/weather\",\n",
" url=f\"{apim_resource_gateway_url}/weather/mcp\",\n",
" description=\"Weather Plugin\",\n",
" )\n",
"\n",
"oncall_plugin = MCPStreamableHttpPlugin(\n",
" name=\"OnCall\",\n",
" url=f\"{apim_resource_gateway_url}/oncall\",\n",
" url=f\"{apim_resource_gateway_url}/oncall/mcp\",\n",
" description=\"OnCall Plugin\",\n",
")\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions labs/mcp-a2a-agents/mcp-agent-as-a2a-server.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
"outputs": [],
"source": [
"title=\"Weather\"\n",
"mcp_url = \"/weather\"\n",
"mcp_url = \"/weather/mcp\"\n",
"\n",
"utils.run(f'az containerapp secret set -n {a2a_weather_containerapp_resource_name} -g {resource_group_name} --secrets apimsubscriptionkey={apim_subscription_key}', \"Weather A2A Server secret updated\", \"Weather A2A Server secret update failed\")\n",
"utils.run(f'az containerapp update -n {a2a_weather_containerapp_resource_name} -g {resource_group_name} --image \"{container_registry_name}.azurecr.io/{a2a_sk_server_image}:v0.{build}\" --set-env-vars TITLE={title} MCP_URL={mcp_url} A2A_URL={apim_resource_gateway_url}/weather-agent-a2a APIM_GATEWAY_URL={apim_resource_gateway_url} OPENAI_API_VERSION={openai_api_version} OPENAI_DEPLOYMENT_NAME={openai_deployment_name} APIM_SUBSCRIPTION_KEY=secretref:apimsubscriptionkey', \n",
Expand All @@ -201,7 +201,7 @@
"outputs": [],
"source": [
"title=\"Oncall\"\n",
"mcp_url = \"/oncall\"\n",
"mcp_url = \"/oncall/mcp\"\n",
"\n",
"utils.run(f'az containerapp secret set -n {a2a_oncall_containerapp_resource_name} -g {resource_group_name} --secrets apimsubscriptionkey={apim_subscription_key}', f\"{title} A2A Server secret updated\", f\"{title} A2A Server secret update failed\")\n",
"utils.run(f'az containerapp update -n {a2a_oncall_containerapp_resource_name} -g {resource_group_name} --image \"{container_registry_name}.azurecr.io/{a2a_ag_server_image}:v0.{build}\" --set-env-vars TITLE={title} MCP_URL={mcp_url} A2A_URL={apim_resource_gateway_url}/oncall-agent-a2a APIM_GATEWAY_URL={apim_resource_gateway_url} OPENAI_API_VERSION={openai_api_version} OPENAI_DEPLOYMENT_NAME={openai_deployment_name} APIM_SUBSCRIPTION_KEY=secretref:apimsubscriptionkey', \n",
Expand Down
4 changes: 2 additions & 2 deletions labs/mcp-a2a-agents/mcp-agent-as-mcp-server.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@
"outputs": [],
"source": [
"title=\"Weather\"\n",
"mcp_url = \"/weather\"\n",
"mcp_url = \"/weather/mcp\"\n",
"\n",
"utils.run(f'az containerapp secret set -n {a2a_weather_containerapp_resource_name} -g {resource_group_name} --secrets apimsubscriptionkey={apim_subscription_key}', \"Weather A2A Server secret updated\", \"Weather A2A Server secret update failed\")\n",
"utils.run(f'az containerapp update -n {a2a_weather_containerapp_resource_name} -g {resource_group_name} --image \"{container_registry_name}.azurecr.io/{mcp_sk_server_image}:v0.{build}\" --set-env-vars TITLE={title} MCP_URL={mcp_url} APIM_GATEWAY_URL={apim_resource_gateway_url} OPENAI_API_VERSION={openai_api_version} OPENAI_DEPLOYMENT_NAME={openai_deployment_name} APIM_SUBSCRIPTION_KEY=secretref:apimsubscriptionkey', \n",
" \"Weather MCP SK Server with MCP deployment succeeded\", \"Weather MCP SK Server with MCP deployment failed\")\n",
"\n",
"title=\"Oncall\"\n",
"mcp_url = \"/oncall\"\n",
"mcp_url = \"/oncall/mcp\"\n",
"\n",
"utils.run(f'az containerapp secret set -n {a2a_oncall_containerapp_resource_name} -g {resource_group_name} --secrets apimsubscriptionkey={apim_subscription_key}', \"Oncall A2A Server secret updated\", \"Oncall A2A Server secret update failed\")\n",
"utils.run(f'az containerapp update -n {a2a_oncall_containerapp_resource_name} -g {resource_group_name} --image \"{container_registry_name}.azurecr.io/{mcp_sk_server_image}:v0.{build}\" --set-env-vars TITLE={title} MCP_URL={mcp_url} APIM_GATEWAY_URL={apim_resource_gateway_url} OPENAI_API_VERSION={openai_api_version} OPENAI_DEPLOYMENT_NAME={openai_deployment_name} APIM_SUBSCRIPTION_KEY=secretref:apimsubscriptionkey', \n",
Expand Down
67 changes: 45 additions & 22 deletions labs/model-context-protocol/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ param inferenceAPIType string = 'AzureOpenAI'
param inferenceAPIPath string = 'inference' // Path to the inference API in the APIM service
param foundryProjectName string = 'default'


param githubAPIPath string = 'github'
param weatherAPIPath string = 'weather'
param oncallAPIPath string = 'oncall'
param servicenowAPIPath string = 'servicenow'
param gitHubAuthorizationProviderName string = 'github'
param githubPath string = 'github'
param weatherPath string = 'weather'
param oncallPath string = 'oncall'
param servicenowPath string = 'servicenow'
param serviceNowInstanceName string = ''

// ------------------
Expand Down Expand Up @@ -188,7 +188,7 @@ resource gitHubMCPServerContainerApp 'Microsoft.App/containerApps@2023-11-02-pre
env: [
{
name: 'APIM_GATEWAY_URL'
value: '${apimService.properties.gatewayUrl}/${githubAPIPath}'
value: '${apimService.properties.gatewayUrl}/${githubPath}/api'
}
{
name: 'AZURE_CLIENT_ID'
Expand All @@ -210,9 +210,13 @@ resource gitHubMCPServerContainerApp 'Microsoft.App/containerApps@2023-11-02-pre
name: 'APIM_SERVICE_NAME'
value: apimService.name
}
{
name: 'AUTHORIZATION_PROVIDER_ID'
value: gitHubAuthorizationProviderName
}
{
name: 'POST_LOGIN_REDIRECT_URL'
value: 'http://www.bing.com'
value: 'http://www.github.com'
}
{
name: 'APIM_IDENTITY_OBJECT_ID'
Expand Down Expand Up @@ -352,7 +356,7 @@ resource servicenowMCPServerContainerApp 'Microsoft.App/containerApps@2023-11-02
env: [
{
name: 'APIM_GATEWAY_URL'
value: '${apimService.properties.gatewayUrl}/${servicenowAPIPath}'
value: '${apimService.properties.gatewayUrl}/${servicenowPath}/api'
}
{
name: 'AZURE_CLIENT_ID'
Expand Down Expand Up @@ -397,43 +401,62 @@ resource servicenowMCPServerContainerApp 'Microsoft.App/containerApps@2023-11-02
}
}

module githubAPIModule '../../modules/apim-streamable-mcp/api.bicep' = {
module githubAPIModule './src/github/apim-api/api.bicep' = {
name: 'githubAPIModule'
params: {
apimServiceName: apimService.name
MCPPath: githubAPIPath
MCPServiceURL: 'https://${gitHubMCPServerContainerApp.properties.configuration.ingress.fqdn}/${githubAPIPath}'
APIPath: githubPath
APIServiceURL: 'https://api.github.com'
authorizationProviderName: gitHubAuthorizationProviderName
}
}

module weatherAPIModule '../../modules/apim-streamable-mcp/api.bicep' = {
name: 'weatherAPIModule'
module githubMCPModule '../../modules/apim-streamable-mcp/api.bicep' = {
name: 'githubMCPModule'
params: {
apimServiceName: apimService.name
MCPPath: weatherAPIPath
MCPServiceURL: 'https://${weatherMCPServerContainerApp.properties.configuration.ingress.fqdn}/${weatherAPIPath}'
MCPPath: githubPath
MCPServiceURL: 'https://${gitHubMCPServerContainerApp.properties.configuration.ingress.fqdn}'
}
}

module oncallAPIModule '../../modules/apim-streamable-mcp/api.bicep' = {
name: 'oncallAPIModule'
module weatherMCPModule '../../modules/apim-streamable-mcp/api.bicep' = {
name: 'weatherMCPModule'
params: {
apimServiceName: apimService.name
MCPPath: oncallAPIPath
MCPServiceURL: 'https://${oncallMCPServerContainerApp.properties.configuration.ingress.fqdn}/${oncallAPIPath}'
MCPPath: weatherPath
MCPServiceURL: 'https://${weatherMCPServerContainerApp.properties.configuration.ingress.fqdn}'
}
}

module serviceNowAPIModule 'src/servicenow/apim-api/api.bicep' = if(length(serviceNowInstanceName) > 0) {
module oncallMCPModule '../../modules/apim-streamable-mcp/api.bicep' = {
name: 'oncallMCPModule'
params: {
apimServiceName: apimService.name
MCPPath: oncallPath
MCPServiceURL: 'https://${oncallMCPServerContainerApp.properties.configuration.ingress.fqdn}'
}
}

module servicenowAPIModule './src/servicenow/apim-api/api.bicep' = if(length(serviceNowInstanceName) > 0) {
name: 'servicenowAPIModule'
params: {
apimServiceName: apimService.name
APIPath: servicenowAPIPath
APIServiceURL: 'https://${servicenowMCPServerContainerApp.properties.configuration.ingress.fqdn}/${servicenowAPIPath}'
APIPath: servicenowPath
APIServiceURL: 'https://api.servicenow.com'
serviceNowInstanceName: serviceNowInstanceName
}
}

module serviceNowMCPModule '../../modules/apim-streamable-mcp/api.bicep' = if(length(serviceNowInstanceName) > 0) {
name: 'servicenowMCPModule'
params: {
apimServiceName: apimService.name
MCPPath: servicenowPath
MCPServiceURL: 'https://${servicenowMCPServerContainerApp.properties.configuration.ingress.fqdn}/${servicenowPath}/mcp'
}
}

var apimContributorRoleDefinitionID = resourceId('Microsoft.Authorization/roleDefinitions', '312a565d-c81f-4fd8-895a-4e21e48d571c')
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
scope: apimService
Expand Down
Loading
Loading