Forum Discussion
aayush7g
Jun 09, 2026Copper Contributor
Unable to Connect Localhost MCP Server from Azure AI Foundry Hosted Agent (o4-mini)
I'm using the Azure AI Foundry Toolkit in VS Code and have configured an MCP server running on my local machine (localhost). When I run my Azure AI Foundry-hosted agent (o4-mini), it fails to connec...
Jamony
Jun 27, 2026MCT
A hosted Foundry agent will not be able to reach localhost on your machine. From the agent runtime, localhost means the hosted environment, not your laptop. Put the MCP server behind an HTTPS endpoint the agent can reach, such as Container Apps, App Service, Functions, or a short-lived secure tunnel for testing. For anything beyond a test, add auth instead of exposing the dev server directly.