You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add payload path prefix configuration to fix underlying path problem
- Added payload_path_prefix field to GatewayConfig
- Added --payload-path-prefix flag and MCP_GATEWAY_PAYLOAD_PATH_PREFIX env var
- Updated middleware to remap payloadPath using configurable prefix
- Updated savePayload() to accept pathPrefix parameter
- Updated all test files to include pathPrefix parameter
- Added comprehensive documentation in README.md and config examples
- All tests pass (make agent-finished successful)
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
- TOML config file: `payload_path_prefix = "<path>"` in `[gateway]` section
232
+
- When set, the `payloadPath` returned to clients uses this prefix instead of the actual filesystem path
233
+
- Example: Gateway saves to `/tmp/jq-payloads/session/query/payload.json`, but returns `/workspace/payloads/session/query/payload.json` to clients if `payload_path_prefix = "/workspace/payloads"`
234
+
- This allows agents running in containers to access payload files via mounted volumes
228
235
229
236
**Environment Variable Features**:
230
237
-**Passthrough**: Set value to empty string (`""`) to pass through from host
@@ -333,6 +340,7 @@ When running locally (`run.sh`), these variables are optional (warnings shown if
333
340
|`MCP_GATEWAY_API_KEY`| API authentication key | (disabled) |
334
341
|`MCP_GATEWAY_LOG_DIR`| Log file directory (sets default for `--log-dir` flag) |`/tmp/gh-aw/mcp-logs`|
335
342
|`MCP_GATEWAY_PAYLOAD_DIR`| Large payload storage directory (sets default for `--payload-dir` flag) |`/tmp/jq-payloads`|
343
+
|`MCP_GATEWAY_PAYLOAD_PATH_PREFIX`| Path prefix for remapping payloadPath returned to clients (sets default for `--payload-path-prefix` flag) | (empty - use actual filesystem path) |
336
344
|`MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD`| Size threshold in bytes for payload storage (sets default for `--payload-size-threshold` flag) |`524288`|
cmd.Flags().StringVar(&logDir, "log-dir", getDefaultLogDir(), "Directory for log files (falls back to stdout if directory cannot be created)")
27
29
cmd.Flags().StringVar(&payloadDir, "payload-dir", getDefaultPayloadDir(), "Directory for storing large payload files (segmented by session ID)")
30
+
cmd.Flags().StringVar(&payloadPathPrefix, "payload-path-prefix", getDefaultPayloadPathPrefix(), "Path prefix to use when returning payloadPath to clients (allows remapping host paths to client/agent container paths)")
28
31
cmd.Flags().IntVar(&payloadSizeThreshold, "payload-size-threshold", getDefaultPayloadSizeThreshold(), "Size threshold (in bytes) for storing payloads to disk. Payloads larger than this are stored, smaller ones returned inline")
0 commit comments