Commit 5d2e312
authored
feat: add per-server tool_timeout to override global gateway timeout (#5206)
Reusable shared workflows wrapping long-running HTTP MCP servers (e.g.
Repo Mind Light) have no way to set the gateway's tool invocation
timeout — consumers must know to configure `MCP_GATEWAY_TOOL_TIMEOUT` in
`sandbox.mcp.env`, breaking the reusable component contract.
## Changes
- **`ServerConfig.ToolTimeout`** — new per-server field (TOML:
`tool_timeout`, JSON stdin: `tool_timeout`); minimum 10s; zero/omitted
means fall back to `gateway.toolTimeout`
- **`callBackendTool`** — per-server `ToolTimeout` takes precedence over
`gateway.ToolTimeout` when set
- **JSON schema** — `tool_timeout` added to `stdioServerConfig` and
`httpServerConfig` definitions so stdin validation accepts the field
- **Validation** — `validateStandardServerConfig` enforces minimum of 10
for per-server `tool_timeout`
- **Docs** — `CONFIGURATION.md` documents the field and its relationship
to the global timeout
## Example
A reusable shared workflow can now declare its own timeout directly on
the server:
```json
{
"mcpServers": {
"repo-mind": {
"type": "http",
"url": "http://127.0.0.1:8000/mcp",
"tool_timeout": 600
}
},
"gateway": { "port": 3000, "domain": "localhost", "apiKey": "${API_KEY}" }
}
```
Consumers get a sane 600s timeout without needing to know about
`MCP_GATEWAY_TOOL_TIMEOUT`. They can still override at the consumer
level if needed.
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `example.com`
> - Triggering command: `/tmp/go-build2847888803/b509/launcher.test
/tmp/go-build2847888803/b509/launcher.test
-test.testlogfile=/tmp/go-build2847888803/b509/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true 997891/b463/_pkg_.a
-trimpath ache/go/1.25.9/x64/pkg/tool/linux_amd64/vet -p ny/timefmt-go
-lang=go1.25 ache/go/1.25.9/x-buildtags` (dns block)
> - Triggering command: `/tmp/go-build1669811436/b513/launcher.test
/tmp/go-build1669811436/b513/launcher.test
-test.testlogfile=/tmp/go-build1669811436/b513/testlog.txt
-test.paniconexit0 -test.timeout=10m0s dock�� -stringintconv -tests
64/pkg/tool/linux_amd64/link _.a 997891/b150/ x_amd64/vet
64/pkg/tool/linux_amd64/link --no�� test.test x_amd64/vet x_amd64/vet
1.80.0/channelz/docker 997891/b150/ 64/pkg/tool/linu-nilfunc
x_amd64/vet` (dns block)
> - `invalid-host-that-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build871958364/b001/config.test
/tmp/go-build871958364/b001/config.test -test.paniconexit0
-test.timeout=2m0s -test.count=1 rtcf��
1024825-9d38bb4040a9/status/status.pb.go
64/src/internal/google.golang.org/grpc/internal/channelz x86_64/as` (dns
block)
> - Triggering command: `/tmp/go-build2847888803/b491/config.test
/tmp/go-build2847888803/b491/config.test
-test.testlogfile=/tmp/go-build2847888803/b491/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true msSmPlS8N cfg
x_amd64/vet . -imultiarch x86_64-linux-gnu--noprofile x_amd64/vet 9978��
om/spf13/[email protected]/active_he-errorsas cfg x_amd64/vet --gdwarf-5
b/gh-aw-mcpg/intphp8.3 -o x_amd64/vet` (dns block)
> - Triggering command: `/tmp/go-build1669811436/b495/config.test
/tmp/go-build1669811436/b495/config.test
-test.testlogfile=/tmp/go-build1669811436/b495/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -ato�� -bool -buildtags
x_amd64/vet -errorsas -ifaceassert -nilfunc x_amd64/vet run test -tests
ache/go/1.25.9/x64/pkg/tool/linux_amd64/compile _.a
aw-mcpg/internal/tmp/go-build1282575160/b425/vet.cfg x_amd64/vet
ache/go/1.25.9/x64/pkg/tool/linux_amd64/compile` (dns block)
> - `nonexistent.local`
> - Triggering command: `/tmp/go-build2847888803/b509/launcher.test
/tmp/go-build2847888803/b509/launcher.test
-test.testlogfile=/tmp/go-build2847888803/b509/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true 997891/b463/_pkg_.a
-trimpath ache/go/1.25.9/x64/pkg/tool/linux_amd64/vet -p ny/timefmt-go
-lang=go1.25 ache/go/1.25.9/x-buildtags` (dns block)
> - Triggering command: `/tmp/go-build1669811436/b513/launcher.test
/tmp/go-build1669811436/b513/launcher.test
-test.testlogfile=/tmp/go-build1669811436/b513/testlog.txt
-test.paniconexit0 -test.timeout=10m0s dock�� -stringintconv -tests
64/pkg/tool/linux_amd64/link _.a 997891/b150/ x_amd64/vet
64/pkg/tool/linux_amd64/link --no�� test.test x_amd64/vet x_amd64/vet
1.80.0/channelz/docker 997891/b150/ 64/pkg/tool/linu-nilfunc
x_amd64/vet` (dns block)
> - `slow.example.com`
> - Triggering command: `/tmp/go-build2847888803/b509/launcher.test
/tmp/go-build2847888803/b509/launcher.test
-test.testlogfile=/tmp/go-build2847888803/b509/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true 997891/b463/_pkg_.a
-trimpath ache/go/1.25.9/x64/pkg/tool/linux_amd64/vet -p ny/timefmt-go
-lang=go1.25 ache/go/1.25.9/x-buildtags` (dns block)
> - Triggering command: `/tmp/go-build1669811436/b513/launcher.test
/tmp/go-build1669811436/b513/launcher.test
-test.testlogfile=/tmp/go-build1669811436/b513/testlog.txt
-test.paniconexit0 -test.timeout=10m0s dock�� -stringintconv -tests
64/pkg/tool/linux_amd64/link _.a 997891/b150/ x_amd64/vet
64/pkg/tool/linux_amd64/link --no�� test.test x_amd64/vet x_amd64/vet
1.80.0/channelz/docker 997891/b150/ 64/pkg/tool/linu-nilfunc
x_amd64/vet` (dns block)
> - `this-host-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build2847888803/b518/mcp.test
/tmp/go-build2847888803/b518/mcp.test
-test.testlogfile=/tmp/go-build2847888803/b518/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true se
958364/b060/vet.cfg ache/go/1.25.9/x64/pkg/tool/linux_amd64/vet .
--gdwarf2 --64 ache/go/1.25.9/x-trimpath` (dns block)
> - Triggering command: `/tmp/go-build3024656909/b518/mcp.test
/tmp/go-build3024656909/b518/mcp.test
-test.testlogfile=/tmp/go-build3024656909/b518/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true
/tmp/go-build689997891/b448/_pkg_.a -trimpath docker-buildx -p
go.opentelemetryinspect -lang=go1.24 docker-buildx -uns��
-unreachable=false /tmp/go-build871958364/b091/vet.-ifaceassert .cfg
-c=4 -nolocalimports -importcfg
ache/go/1.25.9/x64/pkg/tool/linu{{.Config.OpenStdin}}` (dns block)
> - Triggering command: `/tmp/go-build3319390857/b518/mcp.test
/tmp/go-build3319390857/b518/mcp.test
-test.testlogfile=/tmp/go-build3319390857/b518/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true g_.a
/tmp/go-build871958364/b023/vet.journal-or-kmsg x_amd64/vet -c=4
-nolocalimports -importcfg x_amd64/vet -uns�� hI9joKUGJ
/tmp/go-build871958364/b152/vet.cfg
ache/go/1.25.9/x64/pkg/tool/linux_amd64/vet en.go en.go
ache/go/1.25.9/x-o ctHi6v3/br4fXcgGpaHZ4LUv69Ml` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/github/gh-aw-mcpg/settings/copilot/coding_agent)
(admins only)
>
> </details>10 files changed
Lines changed: 424 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
179 | 184 | | |
180 | 185 | | |
181 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
220 | 225 | | |
221 | 226 | | |
222 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
130 | 136 | | |
131 | 137 | | |
132 | 138 | | |
| |||
170 | 176 | | |
171 | 177 | | |
172 | 178 | | |
| 179 | + | |
173 | 180 | | |
174 | 181 | | |
175 | 182 | | |
| |||
429 | 436 | | |
430 | 437 | | |
431 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
432 | 442 | | |
433 | 443 | | |
434 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1725 | 1725 | | |
1726 | 1726 | | |
1727 | 1727 | | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
128 | 143 | | |
129 | 144 | | |
130 | 145 | | |
| |||
180 | 195 | | |
181 | 196 | | |
182 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
183 | 213 | | |
184 | 214 | | |
185 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
121 | 130 | | |
122 | 131 | | |
123 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1082 | 1082 | | |
1083 | 1083 | | |
1084 | 1084 | | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
0 commit comments