-
Notifications
You must be signed in to change notification settings - Fork 137
Configure payloadDir for MCP gateway to enable large payload sharing #14026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -502,6 +502,15 @@ func (c *Compiler) generateMCPSetup(yaml *strings.Builder, tools map[string]any, | |||||
| } else { | ||||||
| yaml.WriteString(" export MCP_GATEWAY_API_KEY=\"" + apiKey + "\"\n") | ||||||
| } | ||||||
|
|
||||||
| // Export payload directory and ensure it exists | ||||||
| payloadDir := gatewayConfig.PayloadDir | ||||||
| if payloadDir == "" { | ||||||
| payloadDir = constants.DefaultMCPGatewayPayloadDir | ||||||
| } | ||||||
| yaml.WriteString(" export MCP_GATEWAY_PAYLOAD_DIR=\"" + payloadDir + "\"\n") | ||||||
| yaml.WriteString(" mkdir -p \"${MCP_GATEWAY_PAYLOAD_DIR}\"\n") | ||||||
|
|
||||||
| yaml.WriteString(" export DEBUG=\"*\"\n") | ||||||
| yaml.WriteString(" \n") | ||||||
| yaml.WriteString(" # Register API key as secret to mask it from logs\n") | ||||||
|
|
@@ -544,6 +553,7 @@ func (c *Compiler) generateMCPSetup(yaml *strings.Builder, tools map[string]any, | |||||
| containerCmd += " -e MCP_GATEWAY_PORT" | ||||||
| containerCmd += " -e MCP_GATEWAY_DOMAIN" | ||||||
| containerCmd += " -e MCP_GATEWAY_API_KEY" | ||||||
| containerCmd += " -e MCP_GATEWAY_PAYLOAD_DIR" | ||||||
| containerCmd += " -e DEBUG" | ||||||
| // Pass environment variables that MCP servers reference in their config | ||||||
| // These are needed because awmg v0.0.12+ validates and resolves ${VAR} patterns at config load time | ||||||
|
|
@@ -624,7 +634,7 @@ func (c *Compiler) generateMCPSetup(yaml *strings.Builder, tools map[string]any, | |||||
|
|
||||||
| // Mark standard environment variables as already added | ||||||
| standardEnvVars := []string{ | ||||||
| "MCP_GATEWAY_PORT", "MCP_GATEWAY_DOMAIN", "MCP_GATEWAY_API_KEY", "DEBUG", | ||||||
| "MCP_GATEWAY_PORT", "MCP_GATEWAY_DOMAIN", "MCP_GATEWAY_API_KEY", "MCP_GATEWAY_PAYLOAD_DIR", "DEBUG", | ||||||
| "MCP_GATEWAY_LOG_DIR", "GH_AW_MCP_LOG_DIR", "GH_AW_SAFE_OUTPUTS", | ||||||
| "GH_AW_SAFE_OUTPUTS_CONFIG_PATH", "GH_AW_SAFE_OUTPUTS_TOOLS_PATH", | ||||||
| "GH_AW_ASSETS_BRANCH", "GH_AW_ASSETS_MAX_SIZE_KB", "GH_AW_ASSETS_ALLOWED_EXTS", | ||||||
|
|
@@ -679,6 +689,12 @@ func (c *Compiler) generateMCPSetup(yaml *strings.Builder, tools map[string]any, | |||||
| } | ||||||
|
|
||||||
| // Add volume mounts | ||||||
| // First, add the payload directory mount (rw for both agent and gateway) | ||||||
|
||||||
| // First, add the payload directory mount (rw for both agent and gateway) | |
| // First, add the payload directory mount for the gateway container with read-write access |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test coverage: The test verifies that the gateway configuration has the PayloadDir set to the default value, but it doesn't verify that the agent sandbox configuration also receives the payloadDir mount with read-only (:ro) permissions. According to the PR description, the agent should have a read-only mount of the payloadDir added to AgentSandboxConfig.Mounts.
Add assertions to verify: