-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathstart_http_server.sh
More file actions
executable file
·42 lines (36 loc) · 1.21 KB
/
Copy pathstart_http_server.sh
File metadata and controls
executable file
·42 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Start FortiGate MCP HTTP Server
set -e
# Default values
# Loopback by default: the shipped config has auth.require_auth=false, and an
# unauthenticated HTTP server must never bind wider than 127.0.0.1. Set
# MCP_HTTP_HOST explicitly (with auth.require_auth=true) for a wider bind.
HOST="${MCP_HTTP_HOST:-127.0.0.1}"
PORT="${MCP_HTTP_PORT:-8814}"
# MCP_PATH (not PATH): assigning the MCP mount path to PATH would clobber the
# shell's executable search path and break the python lookup below.
MCP_PATH="${MCP_HTTP_PATH:-/fortigate-mcp}"
CONFIG="${FORTIGATE_MCP_CONFIG:-$(pwd)/config/config.json}"
# Check if config exists
if [ ! -f "$CONFIG" ]; then
echo "Error: Configuration file not found at $CONFIG"
echo "Please create config.json from config.example.json"
exit 1
fi
echo "Starting FortiGate MCP HTTP Server..."
echo "Host: $HOST"
echo "Port: $PORT"
echo "Path: $MCP_PATH"
echo "Config: $CONFIG"
echo ""
# Activate virtual environment if it exists
if [ -d ".venv" ]; then
echo "Activating virtual environment..."
source .venv/bin/activate
fi
# Run the server
exec python -m src.fortigate_mcp.server_http \
--host "$HOST" \
--port "$PORT" \
--path "$MCP_PATH" \
--config "$CONFIG"