{% set endpoint = lookup('config', application_id, 'mcp.endpoint') -%} {% set upstream_key = lookup('config', application_id, 'mcp.adapter.upstream_network', '') -%} {% set implementation = lookup('config', application_id, 'mcp.implementation') -%} {% set entity = application_id | get_entity_name -%} MCP_AUTH_HEADER='{{ {'id': application_id, 'auth': lookup('config', application_id, 'mcp.auth'), 'token': lookup('mcp_client_bearer', application_id), 'owner': lookup('config', application_id, 'mcp.credential.owner')} | mcp_authorization }}' MCP_DEADLINE_SECONDS={{ lookup('timeout', 420) | int }} MCP_DEPLOYMENT_MODE={{ compose_mode }} MCP_EXPECTED_NETWORKS={{ ([entity] + ([entity ~ '_' ~ upstream_key] if upstream_key else [])) | join(',') }} MCP_EXPECTED_TOOLS='{{ lookup('config', application_id, 'mcp.tools.allowlist', []) | to_json }}' MCP_HOST_HEADER={{ lookup('domain', application_id) if endpoint.get('host_header', false) else '' }} MCP_PATH_KEY= MCP_READ_ARGUMENTS='{{ lookup('config', application_id, 'mcp.tools.read_probe.arguments', {}) | to_json }}' MCP_READ_TOOL={{ lookup('config', application_id, 'mcp.tools.read_probe.tool', '') }} MCP_SIDECAR_SERVICE={{ ((entity ~ '_' ~ endpoint.service_key) if compose_mode == 'swarm' else lookup('config', application_id, 'services.' ~ endpoint.service_key ~ '.name')) if implementation == 'adapter' else '' }} MCP_TEST_ENABLED={{ lookup('config', application_id, 'mcp.enabled') | string | lower }} MCP_TEST_IMAGE={{ lookup('config', 'svc-ai-mcp-adapter', 'services.mcp-adapter.image') }}:{{ lookup('config', 'svc-ai-mcp-adapter', 'services.mcp-adapter.version') }} MCP_TEST_NETWORK={{ entity }} MCP_TRANSPORT={{ lookup('config', application_id, 'mcp.transport') }} MCP_UPSTREAM_SERVES='{{ ([] if implementation == 'adapter' else lookup('config', application_id, 'mcp.tools.upstream_serves', [])) | to_json }}' MCP_URL=http://{{ endpoint.service_key }}:{{ lookup('config', application_id, 'services.' ~ endpoint.service_key ~ '.ports.internal.' ~ endpoint.port_key) }}{{ endpoint.path }}