Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ DEBUG_COLORS=0 DEBUG=* ./awmg --config config.toml
- `MCP_GATEWAY_PAYLOAD_DIR` - Large payload storage directory (sets default for `--payload-dir` flag, default: `/tmp/jq-payloads`)
- `MCP_GATEWAY_PAYLOAD_PATH_PREFIX` - Path prefix for remapping payloadPath returned to clients (sets default for `--payload-path-prefix` flag, default: empty)
- `MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD` - Size threshold in bytes for payload storage; payloads larger than this are stored to disk (sets default for `--payload-size-threshold` flag, default: `524288`)
- `MCP_GATEWAY_SESSION_TIMEOUT` - Session timeout for unified mode (`/mcp`) stateful sessions. Accepts Go duration strings (e.g., `30m`, `1h`, `2h30m`). Routed mode is unaffected (hardcoded 30 min). (default: `2h`)
- `MCP_GATEWAY_SESSION_TIMEOUT` - Session timeout for unified mode (`/mcp`) stateful sessions. Accepts Go duration strings (e.g., `30m`, `1h`, `2h30m`). Routed mode is unaffected (hardcoded 30 min). (default: `6h`)
- `DOCKER_HOST` - Docker daemon socket path (default: `/var/run/docker.sock`)
- `MCP_GATEWAY_GUARDS_SINK_SERVER_IDS` - Comma-separated server IDs whose RPC JSONL logs should include agent secrecy/integrity tag snapshots (sets default for `--guards-sink-server-ids`)
- `MCP_GATEWAY_GUARDS_MODE` - Guards enforcement mode: `strict` (deny violations), `filter` (remove denied tools), `propagate` (auto-adjust agent labels) (sets default for `--guards-mode`, default: `strict`)
Expand Down
2 changes: 1 addition & 1 deletion docs/ENVIRONMENT_VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ When running locally (`run.sh`), these variables are optional (warnings shown if
| `MCP_GATEWAY_PAYLOAD_DIR` | Large payload storage directory (sets default for `--payload-dir` flag) | `/tmp/jq-payloads` |
| `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) |
| `MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD` | Size threshold in bytes for payload storage (sets default for `--payload-size-threshold` flag) | `524288` |
| `MCP_GATEWAY_SESSION_TIMEOUT` | Session timeout for unified mode (`/mcp`) stateful sessions. Accepts Go duration strings (e.g., `30m`, `1h`). Default is 2 hours to accommodate long-running agentic workflows. Routed mode is unaffected (hardcoded 30 min). | `2h` |
| `MCP_GATEWAY_SESSION_TIMEOUT` | Session timeout for unified mode (`/mcp`) stateful sessions. Accepts Go duration strings (e.g., `30m`, `1h`). Default is 6 hours to match the GitHub Actions default timeout. Routed mode is unaffected (hardcoded 30 min). | `6h` |
| `MCP_GATEWAY_WASM_GUARDS_DIR` | Root directory for per-server WASM guards (`<root>/<serverID>/*.wasm`, first match is loaded) | (disabled) |
| `MCP_GATEWAY_GUARDS_MODE` | Guards enforcement mode: `strict` (deny violations), `filter` (remove denied tools), `propagate` (auto-adjust agent labels) (sets default for `--guards-mode`) | `strict` |
| `MCP_GATEWAY_GUARDS_SINK_SERVER_IDS` | Comma-separated sink server IDs for JSONL guards tag enrichment (sets default for `--guards-sink-server-ids`) | (disabled) |
Expand Down
8 changes: 4 additions & 4 deletions internal/envutil/envutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ func TestGetEnvDurationRealWorldScenarios(t *testing.T) {
defer os.Unsetenv("MCP_GATEWAY_SESSION_TIMEOUT")

// Default case
result := GetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", 2*time.Hour)
assert.Equal(t, 2*time.Hour, result)
result := GetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", 6*time.Hour)
assert.Equal(t, 6*time.Hour, result)

// Override with shorter timeout
os.Setenv("MCP_GATEWAY_SESSION_TIMEOUT", "30m")
result = GetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", 2*time.Hour)
result = GetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", 6*time.Hour)
assert.Equal(t, 30*time.Minute, result)

// Override with longer timeout
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment // Override with longer timeout is no longer accurate now that the default in this test is 6h but the override value is 4h (shorter). Consider either updating the override to a value > 6h (e.g., 8h) or adjusting the comment to reflect that it's just a custom override.

Suggested change
// Override with longer timeout
// Override with custom timeout

Copilot uses AI. Check for mistakes.
os.Setenv("MCP_GATEWAY_SESSION_TIMEOUT", "4h")
result = GetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", 2*time.Hour)
result = GetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", 6*time.Hour)
assert.Equal(t, 4*time.Hour, result)
})
}
Expand Down
2 changes: 1 addition & 1 deletion internal/server/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func CreateHTTPServerForMCP(addr string, unifiedServer *UnifiedServer, apiKey st
}, &sdk.StreamableHTTPOptions{
Stateless: false, // Support stateful sessions
Logger: logger.NewSlogLoggerWithHandler(logTransport), // Integrate SDK logging with project logger
SessionTimeout: envutil.GetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", 2*time.Hour), // Configurable; 2h default accommodates long-running workflows with idle periods
SessionTimeout: envutil.GetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", 6*time.Hour), // Configurable; 6h default matches GitHub Actions default timeout
})

// Apply standard middleware stack (SDK logging → shutdown check → auth)
Expand Down
Loading