multiple webhooks port option

This commit is contained in:
Kartik Sarangmath
2025-07-19 01:26:34 -07:00
parent 4f429df41a
commit 7ce16e34d3
3 changed files with 33 additions and 5 deletions

View File

@@ -30,7 +30,9 @@ def run_stdio_server(args):
subprocess.run(cmd)
def run_webhook_server(cloudflare_tunnel=False, dangerously_skip_permissions=False):
def run_webhook_server(
cloudflare_tunnel=False, dangerously_skip_permissions=False, port=None
):
"""Run the Claude Code webhook FastAPI server"""
cmd = [
sys.executable,
@@ -44,6 +46,9 @@ def run_webhook_server(cloudflare_tunnel=False, dangerously_skip_permissions=Fal
if cloudflare_tunnel:
cmd.append("--cloudflare-tunnel")
if port is not None:
cmd.extend(["--port", str(port)])
print("[INFO] Starting Claude Code webhook server...")
subprocess.run(cmd)
@@ -67,6 +72,9 @@ Examples:
# Run webhook server with Cloudflare tunnel
omnara --claude-code-webhook --cloudflare-tunnel
# Run webhook server on custom port
omnara --claude-code-webhook --port 8080
# Run with custom API base URL
omnara --stdio --api-key YOUR_API_KEY --base-url http://localhost:8000
""",
@@ -96,6 +104,11 @@ Examples:
action="store_true",
help="Skip permission prompts in Claude Code (webhook mode only) - USE WITH CAUTION",
)
parser.add_argument(
"--port",
type=int,
help="Port to run the webhook server on (webhook mode only, default: 6662)",
)
# Arguments for stdio mode
parser.add_argument(
@@ -117,10 +130,14 @@ Examples:
if args.cloudflare_tunnel and not args.claude_code_webhook:
parser.error("--cloudflare-tunnel can only be used with --claude-code-webhook")
if args.port is not None and not args.claude_code_webhook:
parser.error("--port can only be used with --claude-code-webhook")
if args.claude_code_webhook:
run_webhook_server(
cloudflare_tunnel=args.cloudflare_tunnel,
dangerously_skip_permissions=args.dangerously_skip_permissions,
port=args.port,
)
else:
if not args.api_key: