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
feat: make httpx connection pool size configurable via flags and env
The single shared httpx.AsyncClient that serves all proxied MCP tool
calls was constructed with a hardcoded
httpx.Limits(max_keepalive_connections=1, max_connections=5). MCP
clients that fan out parallel aws_* tool calls per turn (Claude Code,
opencode — typically 4-8 concurrent) saturate the 5-connection pool,
causing intermittent failures.
Expose the pool size via new CLI flags --max-connections /
--max-keepalive-connections with environment-variable fallbacks
MCP_PROXY_MAX_CONNECTIONS / MCP_PROXY_MAX_KEEPALIVE_CONNECTIONS. The two
values are threaded from cli -> server -> create_transport_with_sigv4 ->
create_sigv4_client, and through the per-profile override middleware.
Defaults are unchanged: max_connections=5, max_keepalive_connections=1,
so existing deployments behave byte-for-byte as before. A backward-
compat test asserts the default limits equal the original hardcoded
Limits object.
Scope: pool-sizing knob only. Does not touch the auth-path
serialization (_sign_request_hook / next(auth_flow)), which is tracked
separately in #270.
Fixes#295
|`--tool-timeout`| Maximum seconds a tool call may take before being cancelled. When set, returns a graceful error to the agent instead of hanging indefinitely | 300 |No |
113
113
|`--skip-auth`| Skip request signing when AWS credentials are unavailable instead of failing |`False`|No |
114
114
|`--disable-telemetry`| Disables telemetry data collection |`False`|No |
115
+
|`--max-connections`| Maximum number of concurrent HTTP connections in the shared pool used for all proxied tool calls. Increase this when your MCP client fans out parallel `aws_*` tool calls per turn (e.g. Claude Code, opencode). | 5 (falls back to `MCP_PROXY_MAX_CONNECTIONS`) |No |
116
+
|`--max-keepalive-connections`| Maximum number of idle keep-alive connections to retain in the pool | 1 (falls back to `MCP_PROXY_MAX_KEEPALIVE_CONNECTIONS`) |No |
# Multi-profile switching (alternative to --profile flag, useful for plugin integration)
133
135
export AWS_MCP_PROXY_PROFILES="prod-readonly dev staging"
136
+
137
+
# HTTP connection pool sizing (alternative to --max-connections / --max-keepalive-connections)
138
+
# Raise the pool size when your MCP client issues many parallel aws_* tool calls per turn.
139
+
export MCP_PROXY_MAX_CONNECTIONS=25
140
+
export MCP_PROXY_MAX_KEEPALIVE_CONNECTIONS=5
134
141
```
135
142
136
143
> **Note:**`AWS_MCP_PROXY_PROFILES` takes precedence over `--profile` / `AWS_PROFILE` when set.
144
+
>
145
+
> **Note:**`--max-connections` / `--max-keepalive-connections` take precedence over `MCP_PROXY_MAX_CONNECTIONS` / `MCP_PROXY_MAX_KEEPALIVE_CONNECTIONS` when explicitly passed. Defaults are `5` / `1`, preserving the previous behavior.
0 commit comments