Skip to content

Commit bcd1ffe

Browse files
committed
fix: wrapper command ingestion
1 parent 386ad6c commit bcd1ffe

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

mcphawk/cli.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ def mcp(
234234
sys.exit(0)
235235

236236

237-
@app.command()
237+
@app.command(context_settings={"allow_extra_args": True, "allow_interspersed_args": False})
238238
def wrap(
239-
command: list[str] = typer.Argument(..., help="MCP server command and arguments"),
239+
ctx: typer.Context,
240240
debug: bool = typer.Option(False, "--debug", "-d", help="Enable debug output")
241241
):
242242
"""Wrap an MCP server to capture stdio traffic transparently.
@@ -253,17 +253,19 @@ def wrap(
253253
"command": "mcphawk",
254254
"args": ["wrap", "/path/to/mcp-server", "--arg1", "--arg2"]
255255
"""
256+
# Get the command from remaining args
257+
command = ctx.args
258+
if not command:
259+
logger.error("No command specified to wrap")
260+
raise typer.Exit(1)
261+
256262
# Configure logging
257263
logger.handlers.clear()
258264
handler = logging.StreamHandler(sys.stderr) # Use stderr to avoid interfering with stdio
259265
handler.setFormatter(logging.Formatter('%(message)s'))
260266
logger.addHandler(handler)
261267
logger.setLevel(logging.DEBUG if debug else logging.INFO)
262268

263-
if not command:
264-
logger.error("No command specified to wrap")
265-
raise typer.Exit(1)
266-
267269
logger.info(f"Starting MCP wrapper for: {' '.join(command)}")
268270

269271
# Run the wrapper

0 commit comments

Comments
 (0)