Create a runtime patch to override the timeout.
()
| 136 | |
| 137 | |
| 138 | def create_runtime_patch(): |
| 139 | """Create a runtime patch to override the timeout.""" |
| 140 | print("\n🔧 Creating runtime patch...") |
| 141 | |
| 142 | patch_code = """ |
| 143 | # Runtime patch for MCP CLI timeout |
| 144 | import os |
| 145 | |
| 146 | # Set environment variables that might be checked |
| 147 | os.environ["MCP_TOOL_TIMEOUT"] = "300" |
| 148 | os.environ["CHUK_TOOL_TIMEOUT"] = "300" |
| 149 | os.environ["DEFAULT_TIMEOUT"] = "300" |
| 150 | |
| 151 | # Try to monkey patch common timeout locations |
| 152 | try: |
| 153 | from chuk_tool_processor.execution.strategies.inprocess_strategy import InProcessStrategy |
| 154 | |
| 155 | # Store original __init__ |
| 156 | _original_init = InProcessStrategy.__init__ |
| 157 | |
| 158 | def patched_init(self, registry, max_concurrency=None, default_timeout=300.0, **kwargs): |
| 159 | print(f"🔧 InProcessStrategy patched: timeout={default_timeout}") |
| 160 | return _original_init(self, registry, max_concurrency=max_concurrency, |
| 161 | default_timeout=default_timeout, **kwargs) |
| 162 | |
| 163 | InProcessStrategy.__init__ = patched_init |
| 164 | print("✅ Successfully patched InProcessStrategy") |
| 165 | |
| 166 | except Exception as e: |
| 167 | print(f"❌ Failed to patch InProcessStrategy: {e}") |
| 168 | |
| 169 | # Save this as patch.py and import it before running MCP CLI |
| 170 | """ |
| 171 | |
| 172 | with open("mcp_timeout_patch.py", "w") as f: |
| 173 | f.write(patch_code) |
| 174 | |
| 175 | print("✅ Created mcp_timeout_patch.py") |
| 176 | print(" Usage: python -c 'import mcp_timeout_patch' && mcp-cli chat") |
| 177 | |
| 178 | |
| 179 | if __name__ == "__main__": |
no outgoing calls
no test coverage detected