Share via

I am having problem to run the microsoft MCP monitoring within a ACA

Giovanni Ramundi 0 Reputation points
2026-03-18T11:23:47.8933333+00:00

The container keep going to fail activation with console log showing this error :

INFO: Connecting to the container 'mcp-server'...

ERROR: {"Error":{"Code":"ClusterExecEndpointWebSocketConnectionError","Message":"Failed to establish WebSocket connection with the container, error is Failed to establish WebSocket connection with Managed Environment exec endpoint, error: The server returned status code \u0027500\u0027 when status code \u0027101\u0027 was expected..","Details":null,"Target":null,"AdditionalInfo":null,"TraceId":null}}

the system log states:

{"TimeStamp":"2026-03-18 11:16:38 \u002B0000 UTC","Type":"Warning","ContainerAppName":"azure-monitor-mcp","RevisionName":"azure-monitor-mcp--0000005","ReplicaName":"azure-monitor-mcp--0000005-59d557c88c-4mqf6","Msg":"startup probe failed: connection refused","Reason":"ReplicaUnhealthy","EventSource":"ContainerAppController","Count":25}

Environment Variables are:

User's image

Azure Container Apps
Azure Container Apps

An Azure service that provides a general-purpose, serverless container platform.


1 answer

Sort by: Most helpful
  1. Q&A Assist
    2026-03-18T11:24:05.84+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The logs indicate that the container itself is failing its startup probe (connection refused), and the exec WebSocket error is a consequence of the app not being healthy rather than the root cause. Focus on getting the MCP server inside the container to start and listen correctly before using the “Connect”/exec feature.

    Use the following checks and steps:

    1. Verify the container is reachable on the configured port
      • The environment variable PORT is set to 8080. Confirm that the MCP server process inside the image is actually listening on port 8080.
      • In the Container Apps definition, ensure:
        • The container’s targetPort is 8080.
        • Any startup probe / liveness / readiness probes are configured to hit the correct port and path (for MCP over HTTP this is typically /mcp or whatever the server exposes).
      • If the probe is configured on a different port or path, it will fail with connection refused and keep the replica in ReplicaUnhealthy state.
    2. Confirm MCP endpoint path and transport
      • With MCP_TRANSPORT=http, the server is expected to expose an HTTP JSON-RPC endpoint.
      • For most MCP server frameworks on Container Apps, the common path is /mcp:
        • For .NET MapMcp/mcp
        • For Python FastMCP → /mcp
        • For Node.js Express → /mcp
      • Ensure the startup/readiness probe and any external tests use the correct path. A wrong path can result in 404s or connection issues.
    3. Test the MCP server directly with curl
      • Before using the Container Apps exec console, validate that the app responds:
             curl -X POST "https://<APP_NAME>.azurecontainerapps.io/mcp" \
                 -H "Content-Type: application/json" \
                 -d '{"jsonrpc":"2.0","id":"1","method":"initialize"}'
        
      • Replace <APP_NAME> with the container app name and adjust the path if the server uses a different route.
      • If this call fails or times out, the issue is with the app startup or ingress configuration, not with MCP monitoring.
    4. Check container logs for application errors
      • Use Container Apps log streaming to see why the MCP server process is exiting or not binding to the port:
             az containerapp logs show \
                 --name azure-monitor-mcp \
                 --resource-group <RESOURCE_GROUP> \
                 --follow
        
      • Look for stack traces, binding errors (e.g., wrong port), or configuration errors related to MCP_TRANSPORT, MCP_MODE, or workspace settings.
    5. Validate ingress and environment
      • Ensure ingress is configured correctly (for example, external ingress if the MCP server must be reachable from outside) and that the FQDN is correct.
      • If using browser-based MCP clients, also ensure CORS is configured, but this is secondary to fixing the startup probe failure.

    Once the container starts successfully (startup probe passes and the replica is healthy), the exec WebSocket connection from the Container Apps “Connect” experience should stop returning HTTP 500 and the MCP monitoring scenario can proceed.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.