fix(mcp): clean up connections on exit in interactive and gateway modes
This commit is contained in:
parent
61e9f7f58a
commit
d30523f460
@ -387,6 +387,8 @@ def gateway(
|
||||
)
|
||||
except KeyboardInterrupt:
|
||||
console.print("\nShutting down...")
|
||||
finally:
|
||||
await agent._close_mcp()
|
||||
heartbeat.stop()
|
||||
cron.stop()
|
||||
agent.stop()
|
||||
@ -465,6 +467,7 @@ def agent(
|
||||
signal.signal(signal.SIGINT, _exit_on_sigint)
|
||||
|
||||
async def run_interactive():
|
||||
try:
|
||||
while True:
|
||||
try:
|
||||
_flush_pending_tty_input()
|
||||
@ -489,6 +492,8 @@ def agent(
|
||||
_restore_terminal()
|
||||
console.print("\nGoodbye!")
|
||||
break
|
||||
finally:
|
||||
await agent_loop._close_mcp()
|
||||
|
||||
asyncio.run(run_interactive())
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user