Hello Gabriel Mousa,
I understand your question regarding Azure AI Foundry support for locally hosted MCP servers, and your goal is to connect these agents to an MCP server instance that you are running locally on your client machine for development purposes.
The architecture of cloud-based services like Azure AI Foundry agents requires a stable and network-accessible endpoint (a URI) to reliably communicate with external tools like an MCP server.
A server running on localhost on a developer's machine is generally not accessible from the Azure cloud environment due to networking constraints, firewalls, and non-static IP addresses. This is the primary reason the integration focuses on remotely hosted, reachable servers.
1)Workaround for Development & Testing:
To enable AI Foundry agents to communicate with your local MCP server for development, you can use a tunneling service to expose your local port to the internet with a public URL. A common tool for this is ngrok.
- Start your local MCP server on a specific port (e.g.,
PORT 3000). - Install ngrok and run the following command in a new terminal:
ngrok http 3000 -
ngrokwill provide a public HTTPS forwarding URL (e.g.,https://random-string.ngrok-free.app). - You can now use this public URL as the endpoint for your AI Foundry agent configuration. The agent will send requests to this URL, and
ngrokwill securely tunnel them to your local server.
For reference documentation:
- https://ngrok.com/docs/agent
- https://www.sitepoint.com/use-ngrok-test-local-site/
- https://www.youtube.com/watch?v=NAyrJYG11JA
Note: Reference shared is only for your help and Microsoft doesn't support them.
This approach is highly recommended for development and proof-of-concept scenarios only and is not suitable for production workloads due to stability and security considerations.
2)Approach for Staging/Production:
For a stable and secure setup, the recommended approach is to host your MCP server on an Azure resource. This provides a reliable endpoint that AI Foundry can integrate with seamlessly. Consider the following services:
- Azure App Service: A fully managed platform ideal for hosting web applications and APIs.
- Azure Container Instances (ACI): To quickly run your MCP server in a container without managing infrastructure.
- Azure Virtual Machine (VM): For full control over the hosting environment.
For reference documentation:
Regarding future plans, I cannot comment on specific, unannounced features.
You can follow:
https://devblogs.microsoft.com/foundry/category/whats-new/
https://azure.microsoft.com/en-us/blog/product/azure-ai-foundry/
I hope it helps.
Please accept the answer and upvote to make it useful to other members of the community.