Skip to main content
Glama

fortigate-mcp

An MCP (Model Context Protocol) server for managing and monitoring FortiGate firewalls through the FortiOS REST API.

Connect your AI assistant (Claude Code, Claude Desktop, or any MCP client) to one or more FortiGates and ask things like:

"Which firewall policies have never been hit?" "Is the IPsec tunnel to the branch office up?" "Show me all active sessions from 10.0.0.15."

Initial setup (creating the API user and token on the FortiGate) is automated over SSH — after that, everything runs over the REST API with a token. SSH credentials are never stored.

Features

Phase 1 — read-only (current):

Tool

What it does

get_system_status

Hostname, model, FortiOS version, HA mode, CPU/memory/session usage

list_interfaces

Interfaces with link status, IP, speed, traffic counters

get_routing_table

Active IPv4 routing table (connected, static, OSPF, BGP, …)

list_firewall_policies

Policy list in evaluation order, optional hit counts

get_firewall_policy

Full detail of a single policy

list_address_objects

Address objects (subnet, FQDN, range, geography)

list_services

Custom service objects

get_vpn_status

IPsec tunnel status + active SSL-VPN sessions

search_sessions

Session table search with src/dst/port filters

Roadmap:

  • Phase 2 — guarded write operations (create/update policies and objects, block an IP) with a read_only kill-switch and dry-run support

  • Phase 3 — analysis tools (unused policies, shadowed rules, config audit)

  • Optional SSH transport for diagnose/execute commands not exposed by REST

Related MCP server: FortiGate MCP Server

FortiOS version support

Primary target is FortiOS 7.0 – 7.6, with best-effort support for 6.4. Versions below 6.4 are rejected (end-of-life). The device version is detected automatically from API responses; per-version differences live in one place (src/fortigate_mcp/quirks.py).

Quick start

# 1. Install (Python 3.10+)
git clone https://github.com/irfanharis/fortigate-mcp.git
cd fortigate-mcp
python -m venv .venv
.venv/Scripts/activate          # Windows  (Linux/macOS: source .venv/bin/activate)
pip install -e .

# 2. Bootstrap your FortiGate (creates the API user over SSH, one time)
fortigate-mcp-bootstrap --host 192.168.1.99 --ssh-user admin \
    --trusthost 192.168.1.50 --name lab

# 3. Register with your MCP client, e.g. Claude Code
claude mcp add fortigate -- fortigate-mcp

See the Usage Guide for full documentation: manual setup without SSH, multi-device and multi-VDOM configuration, per-tool examples, and troubleshooting.

Security model

  • Read-only by default, at two layers: the access profile created on the FortiGate only grants read, and the MCP config has read_only: true (used to reject write tools in Phase 2). Pass --read-write to bootstrap only when you need write access.

  • Trusthost pinning: with --trusthost, the token only works from the machine running the MCP server.

  • No stored SSH credentials: SSH is used once for bootstrap; only the API token is persisted, in a config file that is git-ignored.

License

MIT — see LICENSE.

Available Tools

9 tools
get_firewall_policyA

Full detail of a single firewall policy (all cmdb fields).

Inputs: policy_id (required), vdom, device.

get_routing_tableB

Active IPv4 routing table (connected, static, OSPF, BGP, etc.).

Inputs: vdom, device.

get_system_statusA

General FortiGate status: hostname, model, FortiOS version, serial, HA mode, plus current CPU/memory/session usage.

Inputs: device. Returns: object

get_vpn_statusB

VPN status: IPsec tunnels (up/down, traffic) and active SSL-VPN sessions.

Inputs: vdom, device. Returns: object

list_address_objectsB

List address objects (subnet, fqdn, iprange, geography).

Inputs: vdom, device.

list_firewall_policiesA

List firewall policies (compact fields). List order = rule evaluation order.

Inputs: vdom, device, include_hit_counts.

list_interfacesA

List interfaces with link status, IP, speed, and traffic counters.

Inputs: vdom, device.

list_servicesB

List custom service objects (protocol and port ranges).

Inputs: vdom, device.

search_sessionsA

Search the active session table with source/destination/port filters.

Inputs: vdom, count, device, source_ip, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 9 tools

    Disambiguation5/5

    Each tool targets a distinct resource or action: system status, interfaces, routing, firewall policies, address objects, services, VPN, and sessions. The list/get distinction for firewall policies is clear, with list providing summary and get providing details. No two tools appear to overlap in purpose.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with snake_case. Verbs are limited to 'get', 'list', and 'search', and are used predictably: 'list_' for plural resources, 'get_' for single items, and 'search_' for queries. This makes the tool set easy to navigate.

    Tool Count5/5

    Nine tools is well within the ideal range for a focused server. Each tool covers a meaningful aspect of FortiGate status and configuration, without redundancy. The scope is broad enough to be useful but not so large that it becomes overwhelming.

    Completeness4/5

    The tool surface provides solid read-only coverage of the FortiGate domain: system health, interfaces, routing, policies, objects, services, VPN, and sessions. The only notable gap is the lack of any write operations (e.g., create/update/delete firewall policies or address objects), which would be expected for full management but is acceptable for a monitoring-focused server. Minor missing details like a single-address-object lookup are not critical.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers