Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit 8ca5e28

Browse files
committed
Output nothing if verbose False (default)
1 parent 5ee2eea commit 8ca5e28

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

mcp_run_python/_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def cli_logic(args_list: Sequence[str] | None = None) -> int:
4141
return 0
4242
elif args.mode:
4343
logging.basicConfig(
44-
level=logging.DEBUG if args.verbose else logging.INFO,
44+
level=logging.DEBUG if args.verbose else logging.ERROR,
4545
stream=sys.stderr,
4646
format='%(message)s',
4747
)

mcp_run_python/main.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def run_mcp_server(
5252
return_mode=return_mode,
5353
deps_log_handler=deps_log_handler,
5454
allow_networking=allow_networking,
55+
quiet=not verbose,
5556
) as env:
5657
if mode in ('streamable_http', 'streamable_http_stateless'):
5758
logger.info('Running mcp-run-python via %s on port %d...', mode, http_port)
@@ -82,6 +83,7 @@ def prepare_deno_env(
8283
return_mode: Literal['json', 'xml'] = 'xml',
8384
deps_log_handler: LogHandler | None = None,
8485
allow_networking: bool = True,
86+
quiet: bool = False,
8587
) -> Iterator[DenoEnv]:
8688
"""Prepare the deno environment for running the mcp-run-python server with Deno.
8789
@@ -97,6 +99,7 @@ def prepare_deno_env(
9799
deps_log_handler: Optional function to receive logs emitted while installing dependencies.
98100
allow_networking: Whether the prepared DenoEnv should allow networking when running code.
99101
Note that we always allow networking during environment initialization to install dependencies.
102+
quiet: Suppresses diagnostic output from Deno when installing dependencies.
100103
101104
Returns:
102105
Yields the deno environment details.
@@ -108,7 +111,7 @@ def prepare_deno_env(
108111
shutil.copytree(src, cwd, ignore=shutil.ignore_patterns('node_modules'))
109112
logger.info('Installing dependencies %s...', dependencies)
110113

111-
args = 'deno', *_deno_install_args(dependencies)
114+
args = 'deno', *_deno_install_args(dependencies, quiet=quiet)
112115
p = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
113116
stdout: list[str] = []
114117
if p.stdout is not None:
@@ -145,6 +148,7 @@ async def async_prepare_deno_env(
145148
return_mode: Literal['json', 'xml'] = 'xml',
146149
deps_log_handler: LogHandler | None = None,
147150
allow_networking: bool = True,
151+
quiet: bool = False,
148152
) -> AsyncIterator[DenoEnv]:
149153
"""Async variant of `prepare_deno_env`."""
150154
ct = await _asyncify(
@@ -155,16 +159,21 @@ async def async_prepare_deno_env(
155159
return_mode=return_mode,
156160
deps_log_handler=deps_log_handler,
157161
allow_networking=allow_networking,
162+
quiet=quiet,
158163
)
159164
try:
160165
yield await _asyncify(ct.__enter__)
161166
finally:
162167
await _asyncify(ct.__exit__, None, None, None)
163168

164169

165-
def _deno_install_args(dependencies: list[str] | None = None) -> list[str]:
170+
def _deno_install_args(dependencies: list[str] | None = None, quiet: bool = False) -> list[str]:
166171
args = [
167-
'run',
172+
'run'
173+
]
174+
if quiet:
175+
args += ['--quiet']
176+
args += [
168177
'--allow-net',
169178
'--allow-read=./node_modules',
170179
'--allow-write=./node_modules',

0 commit comments

Comments
 (0)