We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 994af3b commit 129d5afCopy full SHA for 129d5af
2 files changed
python/blacknode/cli.py
@@ -199,13 +199,16 @@ def add(label: str, ok: bool, detail: str, *, required: bool = True) -> None:
199
def _mcp(args: argparse.Namespace | None = None) -> int:
200
from .mcp import main as run_mcp
201
202
- run_mcp(
203
- transport=getattr(args, "transport", "stdio"),
204
- host=getattr(args, "host", None),
205
- port=getattr(args, "port", None),
206
- path=getattr(args, "path", None),
207
- allowed_hosts=getattr(args, "allowed_hosts", None),
208
- )
+ try:
+ run_mcp(
+ transport=getattr(args, "transport", "stdio"),
+ host=getattr(args, "host", None),
+ port=getattr(args, "port", None),
+ path=getattr(args, "path", None),
+ allowed_hosts=getattr(args, "allowed_hosts", None),
209
+ )
210
+ except KeyboardInterrupt:
211
+ return 130
212
return 0
213
214
tests/test_cli.py
@@ -223,6 +223,12 @@ def test_mcp_forwards_streamable_http_options(self):
223
allowed_hosts=["localhost:*", "blacknode-mcp:*"],
224
)
225
226
+ def test_mcp_ctrl_c_exits_without_traceback(self):
227
+ with patch("blacknode.mcp.main", side_effect=KeyboardInterrupt):
228
+ code = main(["mcp", "--transport", "streamable-http"])
229
+
230
+ self.assertEqual(code, 130)
231
232
233
def _valid_workflow() -> dict:
234
return workflow(
0 commit comments