Skip to content

Commit 84ad76f

Browse files
author
luoshasha
committed
fix: add host to cli error info.
1 parent 35a93ab commit 84ad76f

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

mcp_run_python/_cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ def cli_logic(args_list: Sequence[str] | None = None) -> int:
2020
description=f'mcp-run-python CLI v{__version__}\n\nMCP server for running untrusted Python code.\n',
2121
formatter_class=argparse.RawTextHelpFormatter,
2222
)
23-
parser.add_argument('--host', type=str, default='127.0.0.1',
24-
help='Host to bind the HTTP server to (default: 127.0.0.1). Use 0.0.0.0 for Docker.')
23+
parser.add_argument('--host', type=str, help='Host to bind the HTTP server to (default: 127.0.0.1). Use 0.0.0.0 for Docker.')
2524
parser.add_argument('--port', type=int, help='Port to run the server on, default 3001.')
2625
parser.add_argument('--deps', '--dependencies', help='Comma separated list of dependencies to install')
2726
parser.add_argument(

mcp_run_python/deno/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Usage: deno ... deno/main.ts [stdio|streamable_http|install_deps|noop]
5252
5353
options:
5454
--port <port> Port to run the HTTP server on (default: 3001)
55+
--host <host> Host to bind to (default: 127.0.0.1)
5556
--deps <deps> Comma separated list of dependencies to install
5657
--return-mode <xml/json> Return mode for output data (default: xml)`
5758
);

mcp_run_python/main.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
__all__ = "run_mcp_server", "DenoEnv", "prepare_deno_env", "async_prepare_deno_env"
1515

1616
logger = logging.getLogger(__name__)
17-
LoggingLevel = Literal[
18-
"debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"
19-
]
20-
Mode = Literal["stdio", "streamable_http", "example"]
17+
LoggingLevel = Literal['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency']
18+
Mode = Literal['stdio', 'streamable_http', 'streamable_http_stateless', 'example']
2119
LogHandler = Callable[[LoggingLevel, str], None]
2220

2321

@@ -37,6 +35,7 @@ def run_mcp_server(
3735
Args:
3836
mode: The mode to run the server in.
3937
http_port: The port to run the server on if mode is `streamable_http`.
38+
http_host: The host to run the server on if mode is `streamable_http`.
4039
dependencies: The dependencies to install.
4140
return_mode: The mode to return tool results in.
4241
deps_log_handler: Optional function to receive logs emitted while installing dependencies.
@@ -86,7 +85,7 @@ def prepare_deno_env(
8685
http_port: int | None = None,
8786
http_host: str | None = None,
8887
dependencies: list[str] | None = None,
89-
return_mode: Literal["json", "xml"] = "xml",
88+
return_mode: Literal['json', 'xml'] = 'xml',
9089
deps_log_handler: LogHandler | None = None,
9190
allow_networking: bool = True,
9291
) -> Iterator[DenoEnv]:
@@ -99,6 +98,7 @@ def prepare_deno_env(
9998
Args:
10099
mode: The mode to run the server in.
101100
http_port: The port to run the server on if mode is `streamable_http`.
101+
http_host: The host to run the server on if mode is `streamable_http`.
102102
dependencies: The dependencies to install.
103103
return_mode: The mode to return tool results in.
104104
deps_log_handler: Optional function to receive logs emitted while installing dependencies.
@@ -155,7 +155,7 @@ async def async_prepare_deno_env(
155155
http_port: int | None = None,
156156
http_host: str | None = None,
157157
dependencies: list[str] | None = None,
158-
return_mode: Literal["json", "xml"] = "xml",
158+
return_mode: Literal['json', 'xml'] = 'xml',
159159
deps_log_handler: LogHandler | None = None,
160160
allow_networking: bool = True,
161161
) -> AsyncIterator[DenoEnv]:
@@ -197,7 +197,7 @@ def _deno_run_args(
197197
http_port: int | None = None,
198198
http_host: str | None = None,
199199
dependencies: list[str] | None = None,
200-
return_mode: Literal["json", "xml"] = "xml",
200+
return_mode: Literal['json', 'xml'] = 'xml',
201201
allow_networking: bool = True,
202202
) -> list[str]:
203203
args = ["run"]
@@ -227,6 +227,4 @@ def _deno_run_args(
227227

228228

229229
async def _asyncify(func: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> T:
230-
return await asyncio.get_event_loop().run_in_executor(
231-
None, partial(func, *args, **kwargs)
232-
)
230+
return await asyncio.get_event_loop().run_in_executor(None, partial(func, *args, **kwargs))

0 commit comments

Comments
 (0)