fortigate-mcp-server
Manages a FortiGate firewall through the FortiOS REST API, providing tools for firewall policies, NAT and port forwarding, DNS and DHCP, application control, inspection, live traffic, logs, and license limit checks.
Reads a k3s cluster to synchronize Kubernetes Ingress hostnames into FortiGate DNS records and keep firewall address objects aligned with cluster node IPs.
Synchronizes Kubernetes Ingress hostnames into FortiGate DNS records and keeps node IP address objects in sync with the cluster.
Reads a Proxmox VE host to enrich FortiGate leases, sessions, FortiView, and logs by mapping IPs and MACs to the names of the VMs behind them.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@fortigate-mcp-server Show me the current firewall policies and any port forwards"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
fortigate-mcp-server lets Claude (or any MCP client) run a Fortinet FortiGate through the FortiOS REST API: firewall policies, NAT and port forwards, DNS and DHCP, application control, inspection, live traffic and logs. It also audits the firewall's security, and it can reach every setting FortiOS has. It was built and tested against a FortiGate-VM on the free permanent evaluation license fronting a k3s cluster on Proxmox, so it knows that license's limits and FortiOS 7.6's quirks, and it can connect the firewall to the cluster and to the hypervisor around it. Licensed VMs and hardware units are supported too.
What makes it different
A security review in one call.
audit_hardeningchecks admin access, local-in policies, crypto and TLS settings, SSL VPN, logging, password policy, FortiGuard updates, policy protection and HA. It returns findings in the order to fix them and marks the fixes that could lock you out.audit_admin_accessandaudit_policy_protectiongo deeper on their areas, and checking against an advisory shows how to hunt for a published campaign with the same read-only tools.Every FortiOS setting, not just the common ones. Besides the dedicated tools,
search_api,describe_config,get_config,set_configandget_monitorwork from the FortiGate's own API schema, so Claude can find and change anything the firmware has (BGP, SD-WAN, IPsec, VDOMs).set_configvalidates every field against that schema and dry-runs first.Built for the free FortiGate-VM. The permanent evaluation license allows 3 policies, 3 interfaces and 3 static routes, has no FortiGuard services and runs in low-encryption mode.
get_license_limitsshows what is used; port forwards attach to existing policies instead of needing new ones; service groups fold several ports into one policy; and this README says what does not work there (deep inspection) before you lose an afternoon to it.It knows FortiOS 7.6's traps. VIPs cannot share a policy with ordinary addresses, app-control profiles start with a catch-all pass rule, DHCP reservations need
action=reserved,vci-matchsilently ignores normal clients, and local DNS zones cannot hold wildcards. The tools check for these up front and say so plainly. See FortiOS 7.6 field notes.It speaks your infrastructure. Optional integrations read your k3s cluster (Ingress hostnames become FortiGate DNS records; node IPs keep the address objects your policies use in sync) and your Proxmox VE host (every IP and MAC in leases, sessions, FortiView and logs gets the name of the VM behind it).
Safe by default. A read-only switch refuses every write before it leaves your machine; TLS certificates are verified; tool arguments are checked against their schema before anything is sent; sync tools dry-run first; license activation needs
confirm=true; a failed port forward rolls itself back; credentials come from the environment (or your keychain), never from tool arguments.Errors that explain. FortiOS hides the reason for a failure in the response body (
cli_error). Every error message includes it, so "HTTP 500" becomes "Addresses/groups cannot be mixed with virtual IPs".Tested against a real FortiGate. Every tool was run against FortiOS 7.6.7 on a FortiGate-VM, on top of a unit-test suite that runs in CI on Python 3.10 to 3.13.
Related MCP server: fortigate-mcp
Quick start
You need Python 3.10+ with uv, a FortiGate running FortiOS 7.6 (appliance or VM, licensed; see zero to firewall to deploy a free one), and a REST API token.
1. Create an API token on the FortiGate
In the GUI: System > Administrators > Create New > REST API Admin. Pick an administrator profile (super_admin to allow changes, or a read-only profile so FortiOS also refuses writes), set Trusted Hosts to the machine that runs this server, and save. The key is shown once.
Or on the CLI (FortiOS asks for your admin password before it creates an admin):
config system api-user
edit mcp-api
set accprofile super_admin
set vdom root
config trusthost
edit 1
set ipv4-trusthost 192.168.1.50 255.255.255.255
next
end
next
end
execute api-user generate-key mcp-api2. Add it to Claude Code
claude mcp add fortigate --scope user \
-e FORTIGATE_HOST=192.168.1.99 \
-e FORTIGATE_API_TOKEN=your-token \
-e FORTIGATE_READ_ONLY=true \
-- uvx --from git+https://github.com/ry-ops/fortigate-mcp-server@v1.1.3 fortigate-mcp-serverOn macOS you can keep the token in your Keychain instead of in Claude's config:
security add-generic-password -a mcp-api -s fortigate-api-token -w # paste the token when asked
claude mcp add fortigate --scope user -e FORTIGATE_HOST=192.168.1.99 -e FORTIGATE_READ_ONLY=true -- \
sh -c 'FORTIGATE_API_TOKEN="$(security find-generic-password -a mcp-api -s fortigate-api-token -w)" exec uvx --from git+https://github.com/ry-ops/fortigate-mcp-server@v1.1.3 fortigate-mcp-server'TLS. The server verifies the FortiGate's certificate by default. A factory certificate won't pass, so either:
give the FortiGate an admin certificate from a CA you trust (
config system global→set admin-server-cert) whose name or IP matchesFORTIGATE_HOST, and setFORTIGATE_VERIFY_SSL=/path/to/your-ca.pemunless the CA is already in the system store; orin a lab only, set
FORTIGATE_VERIFY_SSL=false. The server then prints a warning at startup, and anyone on the network path can read the API token.
Trusting the FortiGate's own Fortinet_CA_SSL doesn't work on evaluation VMs: it has a 512-bit key, and Python rejects it as too weak.
{
"mcpServers": {
"fortigate": {
"command": "uvx",
"args": ["--from", "git+https://github.com/ry-ops/fortigate-mcp-server@v1.1.3", "fortigate-mcp-server"],
"env": {
"FORTIGATE_HOST": "192.168.1.99",
"FORTIGATE_API_TOKEN": "your-token",
"FORTIGATE_READ_ONLY": "true"
}
}
}
}git clone https://github.com/ry-ops/fortigate-mcp-server && cd fortigate-mcp-server
uv sync
cp .env.example .env # fill in FORTIGATE_HOST and FORTIGATE_API_TOKEN
uv run fortigate-mcp-server3. Ask
Start read-only and look around:
"What's the license status, and how many policies can I still add?"
"Show the firewall policies and how often each one is hit."
"Who is using the most bandwidth right now?"
"Which HTTPS sites did 192.168.150.11 visit in the last few minutes?"
"Run a hardening audit and tell me what to fix first."
"Here's a Fortinet PSIRT advisory. Is this FortiGate affected, and do the logs show anything?"
"Back up the running config." (allowed in read-only mode; it writes a local file)
When you want Claude to make changes, set FORTIGATE_READ_ONLY=false.
Zero to firewall
With proxmox-mcp-server (v2.3.0+) alongside, Claude can take an empty Proxmox host to a working firewall:
Deploy. Download Fortinet's FortiGate-VM KVM image (the
.qcow2inside the.zipfrom the Fortinet support site) and serve it over HTTP.deploy_fortigate_vm(proxmox-mcp-server) imports it, creates the VM with port1 (WAN) and port2 (LAN) on the bridges and VLANs you choose, and returns each port's MAC.License. On the VM console, log in as
adminwith an empty password and set a new one (12+ characters with upper, lower, number and symbol). port1 comes up as a DHCP client. An unlicensed VM refuses most API calls and its GUI goes blank after login, so runactivate_vm_eval_licensewith session auth (FORTIGATE_USERNAME/FORTIGATE_PASSWORD) and your FortiCloud account inFORTICLOUD_ACCOUNT/FORTICLOUD_PASSWORD. The FortiGate reboots with the free permanent license. Then create the API token (step 1 of the quick start) and switch to it.Hide the setup popup. The GUI's "FortiGate Setup" popup waits on a FortiConverter eligibility check that evaluation VMs never pass, so it comes back at every login.
forticonverter_setup_promptwithhide=trueturns it off.Build the lab network. Give port2 an address, then
set_dns_server,create_dns_zone,update_dhcp_serverandadd_dhcp_reservationfor DNS and DHCP, andcreate_firewall_policyfor egress and ingress.Name the apps.
k8s_sync_ingress_dnsturns every Ingress hostname in your cluster into FortiGate DNS records.
Built for the free license
The FortiGate-VM permanent evaluation license (FortiOS 7.2.1+) is free with a FortiCloud account and never expires. Its limits, and how this server deals with them:
Limit | What the tools do |
3 firewall policies |
|
3 interfaces, 3 static routes | Counted by |
1 vCPU, 2 GB RAM |
|
No FortiGuard services (AV, IPS, web filter) or FortiCare | App control works with the signatures bundled in FortiOS. Category blocking needs a subscription. |
Low-encryption mode | Certificate inspection works: the app-ctrl log names every HTTPS site without decrypting anything. Deep inspection does not: the factory CA is 512-bit, and even with your own 2048-bit CA, sites with RSA keys are re-signed with 512-bit keys that curl, Go and containerd reject (container image pulls fail). |
On a licensed FortiGate
The same server works on licensed FortiGate-VMs and hardware units (ADR-0002). The tools read the license, apply the evaluation limits only on the evaluation license, and say which FortiGuard service is missing instead of failing with a 401.
get_license_featuresreports the edition, which FortiGuard services are licensed or expiring, and how old each signature database is.get_fortiguard_status,update_fortiguardandget_firmware_statusshow whether updates are actually arriving, refresh them, and list newer firmware with its upgrade path.get_log_targets,set_syslog_target,get_ha_status,list_fortitokensandset_admin_mfacover log shipping, HA clusters and administrator two-factor.list_security_profilesandaudit_policy_protectionshow which profiles policies really use, and flag WAN-facing traffic without IPS, profiles that never run, and profiles whose FortiGuard service has lapsed.The schema-driven tools (
search_api,describe_config,get_config,set_config,get_monitor) reach every setting the firmware has, including HA, VDOMs, SD-WAN and VPN.
Not yet verified on a licensed unit. These tools are tested against the evaluation VM and against fixtures built from FortiOS 7.6's schema. If you run a licensed FortiGate, a read-only run of
get_license_featuresandget_fortiguard_statuswith the output attached to an issue would help confirm them.
Integrations
Both are optional. They switch on when their variables are set, and their tools only appear then.
k3s / Kubernetes (K8S_KUBECONFIG, optional K8S_CONTEXT). The cluster is only read; kubeconfigs with certificate, token or basic users work (not exec plugins).
k8s_cluster_overview: nodes, LoadBalancer services (such as Traefik on k3s ServiceLB) and every Ingress or Traefik IngressRoute hostname.k8s_sync_ingress_dns: FortiOS local DNS zones cannot hold a wildcard like*.lab, so this creates one A record per ingress IP for each hostname inside the zone. Wildcard, apex and out-of-zone hosts are skipped and listed.prune=trueremoves stale records that point at ingress IPs.k8s_sync_node_addresses: keeps the address object your policies use (defaultK3S-NODES) matched to the node IPs: a range when they are contiguous, otherwise one /32 address per node in an address group.
Both sync tools return their plan with dry_run=true (the default) and change the FortiGate only with dry_run=false.
Proxmox VE (PROXMOX_HOST, PROXMOX_USER, PROXMOX_TOKEN_NAME, PROXMOX_TOKEN_VALUE; the same names as proxmox-mcp-server). Only GET requests are made, so create the token with privilege separation and just the PVEAuditor role.
identify_clients: every DHCP lease and ARP entry on the FortiGate, matched by MAC to the Proxmox VM or container behind it (VMID, name, node, bridge, VLAN tag).resolve_vms=trueonget_logs,list_sessions,get_top_trafficandlist_dhcp_leasesadds labels such assrcip_vm: "112 k3s-worker2 (qemu on pve01)".
Tools
92 tools in 15 areas. Expand an area for one line per tool; your MCP client shows each tool's full description and input schema.
Tool | What it does |
| FortiGate model, serial, firmware version/build, hostname and uptime. |
| License and FortiGuard contract status. |
| How much of the license's object limits is used. |
| What this FortiGate is licensed for: free evaluation VM, licensed VM or hardware; whether it reaches FortiGuard; which FortiGuard services (IPS, antivirus, web filter, application control, Internet Service Database, FortiCloud logging...) are licensed, not licensed or expiring within 30 days; and the version and age of each signature database. |
| Current CPU, memory, disk and session usage. |
| List interface configuration (IP, mode, role, alias, allowaccess). |
| Get one interface's full configuration. |
| Live interface state: link, speed, IP and traffic counters. |
| Update an interface. |
| Administrators currently logged in (GUI, SSH, API) and where from. |
| Read-only audit of how the FortiGate can be administered: admins without trusted hosts or MFA, the default 'admin' account, API keys, HTTPS/SSH/HTTP/telnet admin access on WAN interfaces, local-in policies, and admin passwords still stored as legacy SHA-256 instead of PBKDF2. |
| Read-only hardening audit: everything audit_admin_access checks, plus admin access on LAN interfaces, local-in coverage, telnet, FortiCloud SSO, crypto and TLS settings, SSL VPN, logging (implicit deny, local-in denies, remote targets, cleartext syslog), password policy, NTP, FortiGuard updates and stale signatures, whether accept policies are protected by security profiles, and HA heartbeat hardening. |
| Back up the full running configuration (FortiOS CLI text) to a local file and return its path and size. |
| Show or hide the 'Migrate Config with FortiConverter' step of the GUI's FortiGate Setup popup. |
| Activate the free permanent evaluation license on an unlicensed FortiGate-VM by logging in to FortiCloud from the FortiGate (the same call the GUI makes). |
| High availability: the mode (standalone, active-passive, active-active), group, heartbeat interfaces and monitored interfaces, each cluster member with its role, priority and uptime, and whether members' configurations are in sync. |
| FortiTokens on the FortiGate (serial, status, license) and which administrators use two-factor authentication, by which method and token. |
| Turn on two-factor authentication for an administrator: fortitoken (needs an activated token serial), email (needs email_to and a working email server) or sms (needs sms_phone and SMS service); or disable it. |
Tool | What it does |
| Whether FortiGuard updates are actually reaching this FortiGate: connection state, each FortiGuard server's reachability and packet loss, the update schedule, which services are licensed, and how old each signature database is. |
| Ask the FortiGate to contact FortiGuard now and refresh its entitlements and signature packages (the GUI's 'Check update now'). |
| Running firmware (version, build, maturity, release notes), newer images FortiGuard offers, the supported upgrade path, and the automatic firmware upgrade settings. |
Tool | What it does |
| List IPv4 firewall policies in evaluation order. |
| Get one firewall policy. |
| Create a firewall policy. |
| Update a firewall policy. |
| Delete a firewall policy. |
| Move a policy before or after another one (policies match top-down). |
| Hit counts, bytes, packets and last-used time per policy. |
| Current sessions through the firewall, optionally filtered, with the matched and total session counts. |
| List firewall address objects. |
| Get one firewall address object. |
| Create a firewall address: a subnet/host, an IP range, or an FQDN. |
| Update a firewall address object. |
| Delete a firewall address (fails while a policy or group still uses it). |
| List firewall address groups and their members. |
| Create an address group. |
| Update an address group. members replaces the whole member list. |
| Delete an address group (fails while a policy still uses it). |
| List custom firewall services (port definitions). |
| Create a custom TCP/UDP service. |
| List service groups and their members. |
| Create a service group, e.g. K3S-MGMT = [SSH, K8S-API, PING]. |
| Update a service group. members replaces the whole member list. |
| Delete a service group (fails while a policy still uses it). |
| Delete a custom service (fails while a policy still uses it). |
Tool | What it does |
| List virtual IPs (port forwards / static NAT) and the policies that use each one. |
| Create a port forward (VIP): traffic arriving on extintf at extip:extport goes to mappedip:mappedport. |
| Delete a VIP. |
Tool | What it does |
| Search application-control signatures by name (contains, case-insensitive) and/or category, e.g. query=YouTube or category=P2P. |
| Application-control categories (id and name), e.g. P2P, Proxy, Game, Video/Audio. |
| App-control profiles with their rules, showing application and category names instead of ids. |
| Add a rule to an app-control profile matching applications and/or categories by name (or id). |
| Remove a rule from an app-control profile by its id (see list_app_control_profiles). |
Tool | What it does |
| Security profiles by kind (ips, antivirus, webfilter, dnsfilter, application, emailfilter, dlp, file-filter, waf, videofilter, ssh-filter, virtual-patch), each with the firewall policies that use it, and whether the FortiGuard service behind the kind is licensed (and what the profile can still do if not). |
| Check that accept policies are actually protected: traffic from or to a WAN interface with no IPS sensor, profiles attached while security profiles are disabled on the policy, antivirus/DLP/file filter with an inspection profile that can't see inside HTTPS, profiles whose FortiGuard service isn't licensed, and policies that don't log. |
Tool | What it does |
| List SSL/SSH inspection profiles with the CA each one re-signs with. |
| Update an SSL/SSH inspection profile, e.g. the CA used to re-sign certificates during deep inspection. |
| List local and CA certificates with key type and size, validity and usage flags. |
| Download a certificate's PEM (public part only), e.g. the deep-inspection CA Fortinet_CA_SSL so clients can be told to trust it. |
Tool | What it does |
| Live FortiView summary of the sessions passing through right now, grouped by source, destination, application, country, interface, policy or protocol. |
| IPv4 ARP table: which MAC answers for which IP on each interface. |
Tool | What it does |
| Read FortiGate logs, newest first. |
| Where logs go: each syslog server (up to 4), FortiAnalyzer (up to 3), FortiGuard Cloud, local disk and memory, with transport and encryption. |
| Send logs to a syslog server: sets server, port and transport on one of the four syslog slots and enables it. mode is udp (default), reliable (TCP) or legacy-reliable; with reliable, enc_algorithm (high, high-medium, low) adds TLS. |
Tool | What it does |
| Active IPv4 routing table (connected, static, DHCP-learned and dynamic routes). |
| List configured static routes. |
| Add a static route. |
| Delete a static route by its sequence number (seq-num from list_static_routes). |
Tool | What it does |
| System DNS settings: upstream resolvers the FortiGate itself uses and forwards to. |
| Interfaces where the FortiGate answers DNS queries, and in which mode. |
| Serve DNS on an interface. |
| Stop serving DNS on an interface. |
| List local DNS zones (dns-database) with their records. |
| Create a local DNS zone. view=shadow serves internal clients. |
| Delete a local DNS zone and all its records. |
| Add a record to a local DNS zone. |
| Delete a record from a local DNS zone by its id (see list_dns_zones). |
| List DHCP servers with their ranges, options and reservations. |
| Current DHCP leases handed out by the FortiGate. |
| Update a DHCP server. |
| Reserve an IP for a MAC address on a DHCP server (the IP may sit outside the pool). |
| Remove a DHCP reservation by its id (see list_dhcp_servers). |
Tool | What it does |
| Read the Kubernetes cluster from K8S_KUBECONFIG: nodes with IPs and readiness, LoadBalancer services with their IPs (e.g. Traefik on k3s ServiceLB) and every Ingress or Traefik IngressRoute hostname. |
| Create FortiGate DNS records for the cluster's Ingress hostnames that fall inside a local zone (e.g. whoami.lab in zone 'lab'), pointing at the IPs the ingress is served on. |
| Keep a FortiGate address object in step with the cluster's node IPs so policies follow the cluster. |
Tool | What it does |
| Every client the FortiGate knows (DHCP leases and ARP entries) matched by MAC address to the Proxmox VM or container that owns it: VMID, name, node, status, bridge and VLAN tag. |
Tool | What it does |
| Find FortiOS API endpoints by keyword, from the FortiGate's own schema: configuration (cmdb, e.g. 'bgp' -> router/bgp) and live state (monitor, e.g. 'ha peer' -> system/ha-peer). |
| Describe a configuration endpoint from the FortiGate's schema: whether it is a table (many entries, keyed by mkey) or a single settings object, and each field's type, allowed values, range and default. |
| Read any configuration endpoint: a whole settings object, every entry of a table, or one entry by mkey. |
| Change any configuration endpoint, validated against the FortiGate's schema first: field names, option values, integer ranges, string lengths, and table vs single-object rules. action is update (default), create or delete. |
| Read any monitor (live state) endpoint, e.g. system/ha-peer, router/ipv4, vpn/ipsec, user/firewall. |
Tool | What it does |
| Call any FortiOS REST endpoint directly. path must start with /api/v2/ (cmdb/... for configuration, monitor/... for live state). |
Tools take friendly arguments and build the FortiOS body for you: CIDR (10.0.0.0/24) instead of ip mask, plain lists (["port1"]) instead of [{"name": "port1"}], and booleans instead of enable/disable. Create and update tools also accept extra, merged into the request body as-is, for attributes a tool does not model. Anything without a dedicated tool is reachable through fortigate_api.
Safety model
Guard | What it does |
| The client refuses every POST, PUT and DELETE before it reaches the FortiGate. The only exception is |
TLS verification | Certificates are verified by default ( |
Argument validation | Every tool call is checked against the tool's input schema before any request is made. |
Dry runs |
|
Confirmation |
|
Checks before writes |
|
Rollback | A VIP that its policy refuses is deleted again, so nothing is left half-done. |
Secrets | API tokens and the FortiCloud login come from environment variables (or a keychain, see the quick start), never from tool arguments, so they do not end up in chat transcripts. |
FortiOS 7.6 field notes
Things this server handles because they bit us on a real FortiGate-VM:
7.6 dropped
/logincheck. Session login is a JSONPOST /api/v2/authentication, and the CSRF cookie is namedccsrf_token_<port>_<hash>. The client does both and logs in again once if the session times out.VIPs cannot share a policy's destinations with ordinary addresses ("Addresses/groups cannot be mixed with virtual IPs").
App-control profiles start with a catch-all pass rule, so rules appended after it never match. New rules go to the top.
DHCP reservations need
action=reserved. With the defaultassigntheipfield does not exist.New DHCP servers can default to
vci-matchfor FortiSwitch/FortiExtender vendor classes, which silently ignores ordinary clients.update_dhcp_servertakesvci_match=false.Local DNS zones cannot hold
*records.add_dns_recordrefuses them;k8s_sync_ingress_dnswrites one record per name instead.An SSL inspection profile does nothing on its own in flow mode. Traffic is only inspected once a security profile (e.g. application control
default) is attached; policy tools warn when that is missing.Endpoints moved in 7.6. FortiView is
monitor/fortiview/realtime-statistics(the oldstatisticsis gone), sessions aremonitor/firewall/sessions, and config backups are a POST.The setup popup on evaluation VMs never completes its FortiConverter step. The undocumented
POST /api/v2/monitor/forticonverter/show-in-startup/setwith{"hide": true}hides it (forticonverter_setup_prompt).Unlicensed VMs answer most calls with 401, and the GUI goes blank after login, so activate the license through the API (
activate_vm_eval_license).Log filters fail silently. FortiOS ignores a comma OR across different fields (
dstip==X,dstport==Y) or an&in a filter, and returns unfiltered rows.event/<subtype>endpoints are not scoped to their subtype either.get_logsrefuses the bad filters and adds the subtype term itself. docs/threat-hunting.md shows how to check the FortiGate against a security advisory with the existing tools.
Configuration
Variable | Default | |
| (required) | Hostname or IP |
|
| HTTPS admin port |
| REST API admin token (recommended) | |
| Session login, used when no token is set (needed on an unlicensed VM) | |
|
| VDOM for every call (tools also take |
|
| Verify the TLS certificate: |
|
| Refuse every POST/PUT/DELETE before it reaches the FortiGate |
|
| Request timeout in seconds |
| Enables the Kubernetes tools | |
| Enables the Proxmox tools. | |
| Only for |
Variables can also go in a .env file next to the server; see .env.example.
Compatibility
Tested | Expected to work | |
FortiOS | 7.6.7 (build 3704), FortiGate-VM on KVM/Proxmox, permanent evaluation license | Other 7.6 builds and licensed FortiGate-VMs or appliances. 7.4 and older have not been tested; a few endpoints differ (see the field notes). |
Python | 3.10, 3.11, 3.12, 3.13 (CI) | |
MCP clients | Claude Code | Claude Desktop and other stdio MCP clients |
Integrations | k3s v1.36 with Traefik; Proxmox VE 9.2 | Other Kubernetes distributions (standard Ingress); Proxmox VE 8.x |
Releases and versioning
Versions follow Semantic Versioning. Every release is tagged and listed on the releases page, and CHANGELOG.md records what changed. Pin a release with git+https://github.com/ry-ops/fortigate-mcp-server@v1.1.3; drop the @v… to track main. The version is in pyproject.toml and fortigate_mcp.__version__.
Development
uv sync
uv run pytest
uv run ruff check .
python3 scripts/gen_tool_catalog.py # refresh the tool catalog above
python3 scripts/build_demo_svg.py # rebuild docs/demo.svgCI runs ruff, the tests on Python 3.10 to 3.13, and a check that the tool catalog matches the code. Each tool module (fortigate_mcp/tools/*.py) has a TOOLS list and a handle() function; server.py registers them, and the Kubernetes and Proxmox modules only when configured.
Related
proxmox-mcp-server: the Proxmox VE API as MCP tools, including
deploy_fortigate_vm.
Disclaimer
This is an independent project, not affiliated with or endorsed by Fortinet. Fortinet, FortiGate, FortiOS, FortiGuard, FortiCare and FortiCloud are trademarks of Fortinet, Inc.
License
Available Tools
88 toolsactivate_vm_eval_licenseA
Activate the free permanent evaluation license on an unlicensed FortiGate-VM by logging in to FortiCloud from the FortiGate (the same call the GUI makes). The FortiCloud account comes from the FORTICLOUD_ACCOUNT and FORTICLOUD_PASSWORD environment variables, never from tool arguments. The FortiGate reboots to apply it. Unlicensed VMs refuse most API calls, so use session auth (FORTIGATE_USERNAME/PASSWORD) on a fresh VM. FortiCare error 10 means wrong credentials, an IAM sub-user, or 2FA on the account.
Inputs: confirm (required), vdom, is_government.
add_app_control_ruleA
Add a rule to an app-control profile matching applications and/or categories by name (or id). Rules are checked top-down and the built-in profiles start with a catch-all pass rule, so new rules are inserted at the top by default (position=bottom to append). Only affects policies whose application_list is this profile.
Inputs: profile (required), log, vdom, action, +3 more.
add_dhcp_reservationA
Reserve an IP for a MAC address on a DHCP server (the IP may sit outside the pool).
Inputs: ip (required), mac (required), server_id (required), vdom, +1 more.
add_dns_recordB
Add a record to a local DNS zone. Wildcard (*) hostnames are rejected by FortiOS.
Inputs: zone (required), hostname (required), ip, ttl, +4 more.
audit_admin_accessA
Read-only audit of how the FortiGate can be administered: admins without trusted hosts or MFA, the default 'admin' account, API keys, HTTPS/SSH/HTTP/telnet admin access on WAN interfaces, local-in policies, and admin passwords still stored as legacy SHA-256 instead of PBKDF2. Returns findings graded critical/warn/info, each with a suggested fix. The hash check reads a config backup, which the FortiGate logs as a config download; set check_hashes=false to skip it.
Inputs: vdom, check_hashes.
audit_hardeningA
Read-only hardening audit: everything audit_admin_access checks, plus admin access on LAN interfaces, local-in coverage, telnet, FortiCloud SSO, crypto and TLS settings, SSL VPN, logging (implicit deny, local-in denies, remote targets, cleartext syslog), password policy, NTP, FortiGuard updates and stale signatures, whether accept policies are protected by security profiles, and HA heartbeat hardening. Each finding carries the order to fix it in and whether the fix can cut off admin access, and fix_plan lists them in that order. On the evaluation license it lists the FortiGuard features that don't apply and what to rely on instead. check_hashes reads a config backup, as in audit_admin_access.
Inputs: vdom, check_hashes.
audit_policy_protectionA
Check that accept policies are actually protected: traffic from or to a WAN interface with no IPS sensor, profiles attached while security profiles are disabled on the policy, antivirus/DLP/file filter with an inspection profile that can't see inside HTTPS, profiles whose FortiGuard service isn't licensed, and policies that don't log. Read-only.
Inputs: vdom.
backup_configA
Back up the full running configuration (FortiOS CLI text) to a local file and return its path and size. Allowed in read-only mode. Configs are hundreds of KB, so the text itself is not returned.
Inputs: vdom, output_path.
create_addressC
Create a firewall address: a subnet/host, an IP range, or an FQDN.
Inputs: name (required), fqdn, vdom, extra, +4 more.
create_address_groupC
Create an address group.
Inputs: name (required), members (required), vdom, extra, +1 more.
create_dns_zoneB
Create a local DNS zone. view=shadow serves internal clients. FortiOS does not accept wildcard (*) hostnames, so add one record per name.
Inputs: name (required), domain (required), ttl, vdom, +4 more.
create_firewall_policyA
Create a firewall policy. New policies are added at the end of the list; use move_firewall_policy to reorder. FortiGate-VM evaluation licenses allow only 3 policies.
Inputs: name (required), dstaddr (required), dstintf (required), service (required), +17 more.
create_port_forwardA
Create a port forward (VIP): traffic arriving on extintf at extip:extport goes to mappedip:mappedport. A VIP only passes traffic once a policy from extintf uses it as a destination. With attach_to_policy, the VIP is added to that existing policy's destinations instead of needing a new policy (the evaluation license allows only 3). FortiOS does not allow VIPs and ordinary addresses in the same policy's destinations, so the target must already use only VIPs, or pass replace_destinations=true to turn it into a VIP-only policy (its old destinations stop being reachable through it). In that policy, services match the mapped (internal) port.
Inputs: name (required), extintf (required), extport (required), mappedip (required), +8 more.
create_serviceC
Create a custom TCP/UDP service.
Inputs: name (required), vdom, extra, comment, +2 more.
create_service_groupA
Create a service group, e.g. K3S-MGMT = [SSH, K8S-API, PING]. Grouping services lets one policy cover what would otherwise need several, which helps under the evaluation license's 3-policy limit.
Inputs: name (required), members (required), vdom, extra, +1 more.
create_static_routeB
Add a static route. FortiGate-VM evaluation licenses allow only 3 routes.
Inputs: dst (required), device (required), vdom, extra, +3 more.
delete_addressA
Delete a firewall address (fails while a policy or group still uses it).
Inputs: name (required), vdom.
delete_address_groupA
Delete an address group (fails while a policy still uses it).
Inputs: name (required), vdom.
delete_app_control_ruleB
Remove a rule from an app-control profile by its id (see list_app_control_profiles).
Inputs: id (required), profile (required), vdom.
delete_dhcp_reservationC
Remove a DHCP reservation by its id (see list_dhcp_servers).
Inputs: id (required), server_id (required), vdom.
delete_dns_recordB
Delete a record from a local DNS zone by its id (see list_dns_zones).
Inputs: id (required), zone (required), vdom.
delete_dns_serverC
Stop serving DNS on an interface.
Inputs: interface (required), vdom.
delete_dns_zoneB
Delete a local DNS zone and all its records.
Inputs: name (required), vdom.
delete_firewall_policyC
Delete a firewall policy.
Inputs: policyid (required), vdom.
delete_port_forwardA
Delete a VIP. FortiOS refuses while a policy uses it; detach=true first removes it from every policy's destinations. A policy whose only destination is this VIP blocks the delete: change or delete that policy first.
Inputs: name (required), vdom, detach.
delete_serviceA
Delete a custom service (fails while a policy still uses it).
Inputs: name (required), vdom.
delete_service_groupA
Delete a service group (fails while a policy still uses it).
Inputs: name (required), vdom.
delete_static_routeA
Delete a static route by its sequence number (seq-num from list_static_routes).
Inputs: seq_num (required), vdom.
describe_configA
Describe a configuration endpoint from the FortiGate's schema: whether it is a table (many entries, keyed by mkey) or a single settings object, and each field's type, allowed values, range and default. Pass field for one field in full, including the sub-fields of a nested table.
Inputs: endpoint (required), vdom, field.
download_certificateA
Download a certificate's PEM (public part only), e.g. the deep-inspection CA Fortinet_CA_SSL so clients can be told to trust it. Returns the PEM and its SHA-256 fingerprint.
Inputs: name (required), type, vdom.
forticonverter_setup_promptA
Show or hide the 'Migrate Config with FortiConverter' step of the GUI's FortiGate Setup popup. Without hide, only reports the current state. FortiGate-VM evaluation licenses are not eligible for FortiConverter, so that step never completes and the popup reappears at every login until it is hidden. There is no CLI equivalent.
Inputs: hide, vdom.
fortigate_apiA
Call any FortiOS REST endpoint directly. path must start with /api/v2/ (cmdb/... for configuration, monitor/... for live state). FORTIGATE_READ_ONLY still applies. Prefer the dedicated tools when one exists.
Inputs: path (required), method (required), body, vdom, +1 more.
get_addressC
Get one firewall address object.
Inputs: name (required), vdom.
get_arp_tableB
IPv4 ARP table: which MAC answers for which IP on each interface.
Inputs: vdom, interface.
get_configA
Read any configuration endpoint: a whole settings object, every entry of a table, or one entry by mkey. Password and key fields are shown as '', never their values.
Inputs: endpoint (required), mkey, vdom, filter, +1 more.
get_dns_settingsC
System DNS settings: upstream resolvers the FortiGate itself uses and forwards to.
Inputs: vdom.
get_firewall_policyC
Get one firewall policy.
Inputs: policyid (required), vdom.
get_firmware_statusA
Running firmware (version, build, maturity, release notes), newer images FortiGuard offers, the supported upgrade path, and the automatic firmware upgrade settings. Images and upgrade paths come from FortiGuard, so the evaluation license lists none; check https://www.fortiguard.com/psirt for the running release by hand there.
Inputs: vdom.
get_fortiguard_statusA
Whether FortiGuard updates are actually reaching this FortiGate: connection state, each FortiGuard server's reachability and packet loss, the update schedule, which services are licensed, and how old each signature database is. Adds findings for failing servers, stale signatures on licensed services and a disabled update schedule. On the free evaluation license it says that FortiGuard is unavailable by design.
Inputs: vdom.
get_ha_statusA
High availability: the mode (standalone, active-passive, active-active), group, heartbeat interfaces and monitored interfaces, each cluster member with its role, priority and uptime, and whether members' configurations are in sync. Flags out-of-sync members, unencrypted or unauthenticated heartbeats, a single heartbeat interface and no session pickup.
Inputs: vdom.
get_interfaceC
Get one interface's full configuration.
Inputs: name (required), vdom.
get_interface_statusB
Live interface state: link, speed, IP and traffic counters.
Inputs: vdom, interface.
get_license_featuresA
What this FortiGate is licensed for: free evaluation VM, licensed VM or hardware; whether it reaches FortiGuard; which FortiGuard services (IPS, antivirus, web filter, application control, Internet Service Database, FortiCloud logging...) are licensed, not licensed or expiring within 30 days; and the version and age of each signature database. Tools that need a FortiGuard service check this and say so when it's missing.
Inputs: vdom.
get_license_limitsB
How much of the license's object limits is used. The free FortiGate-VM evaluation license allows 1 vCPU, 2 GB RAM and at most 3 interfaces, 3 firewall policies and 3 static routes; this lists what counts against each so you can plan before hitting one.
Inputs: vdom.
get_license_statusA
License and FortiGuard contract status. By default returns only the VM license, FortiCare and FortiGuard sections; set all=true for every entitlement. An unlicensed FortiGate-VM reports vm.status=vm_invalid and refuses most other API calls with 401.
Inputs: all, vdom.
get_logsA
Read FortiGate logs, newest first. Useful types: traffic/forward (sessions through policies, with app identification), app-ctrl (per-connection application and, with certificate inspection, the HTTPS hostname), event/system (admin and config events), ips, webfilter. FortiGate-VMs without a log disk only keep logs in memory, which is lost on reboot.
Inputs: log_type (required), rows, vdom, start, +4 more.
get_log_targetsB
Where logs go: each syslog server (up to 4), FortiAnalyzer (up to 3), FortiGuard Cloud, local disk and memory, with transport and encryption. Flags logs that only live in memory (lost on reboot), syslog sent as cleartext UDP, and FortiAnalyzer without certificate verification.
Inputs: vdom.
get_monitorA
Read any monitor (live state) endpoint, e.g. system/ha-peer, router/ipv4, vpn/ipsec, user/firewall. Only endpoints FortiOS serves with GET are allowed: monitor POST endpoints act on the device (reboots, disconnects, updates), so they stay in the dedicated tools or fortigate_api.
Inputs: endpoint (required), vdom, params.
get_policy_statsC
Hit counts, bytes, packets and last-used time per policy.
Inputs: vdom, policyid.
get_resource_usageC
Current CPU, memory, disk and session usage.
Inputs: vdom.
get_routing_tableB
Active IPv4 routing table (connected, static, DHCP-learned and dynamic routes).
Inputs: vdom.
get_system_statusC
FortiGate model, serial, firmware version/build, hostname and uptime.
Inputs: vdom.
get_top_trafficA
Live FortiView summary of the sessions passing through right now, grouped by source, destination, application, country, interface, policy or protocol. Destinations include the resolved hostname; application IDs are translated to names. Empty when nothing is flowing (it reflects current sessions, not history).
Inputs: vdom, count, dstaddr, sort_by, +4 more.
list_addressesC
List firewall address objects.
Inputs: vdom, filter, format.
list_address_groupsB
List firewall address groups and their members.
Inputs: vdom, filter, format.
list_admin_sessionsC
Administrators currently logged in (GUI, SSH, API) and where from.
Inputs: vdom.
list_app_categoriesB
Application-control categories (id and name), e.g. P2P, Proxy, Game, Video/Audio.
Inputs: vdom.
list_app_control_profilesB
App-control profiles with their rules, showing application and category names instead of ids.
Inputs: name, vdom.
list_certificatesA
List local and CA certificates with key type and size, validity and usage flags. Certificates with RSA keys under 2048 bits are flagged weak: FortiGate-VM evaluation licenses generate 512-bit factory certificates. Bundled public CAs are omitted unless include_bundle is true.
Inputs: vdom, name_contains, include_bundle.
list_dhcp_leasesC
Current DHCP leases handed out by the FortiGate.
Inputs: vdom, resolve_vms.
list_dhcp_serversB
List DHCP servers with their ranges, options and reservations.
Inputs: vdom, filter, format.
list_dns_serversC
Interfaces where the FortiGate answers DNS queries, and in which mode.
Inputs: vdom.
list_dns_zonesB
List local DNS zones (dns-database) with their records.
Inputs: vdom, filter, format.
list_firewall_policiesC
List IPv4 firewall policies in evaluation order.
Inputs: vdom, filter, format.
list_fortitokensA
FortiTokens on the FortiGate (serial, status, license) and which administrators use two-factor authentication, by which method and token. Tokens are activated through FortiGuard, so the evaluation license has none.
Inputs: vdom.
list_interfacesB
List interface configuration (IP, mode, role, alias, allowaccess).
Inputs: vdom, filter, format.
list_port_forwardsB
List virtual IPs (port forwards / static NAT) and the policies that use each one.
Inputs: vdom, filter, format.
list_security_profilesA
Security profiles by kind (ips, antivirus, webfilter, dnsfilter, application, emailfilter, dlp, file-filter, waf, videofilter, ssh-filter, virtual-patch), each with the firewall policies that use it, and whether the FortiGuard service behind the kind is licensed (and what the profile can still do if not). Read or change a profile's settings with get_config / set_config on the endpoint shown.
Inputs: kind, vdom.
list_service_groupsC
List service groups and their members.
Inputs: vdom, filter, format.
list_servicesC
List custom firewall services (port definitions).
Inputs: vdom, filter, format.
list_sessionsA
Current sessions through the firewall, optionally filtered, with the matched and total session counts. Sessions to the FortiGate itself (admin GUI/API) may be counted but not listed.
Inputs: vdom, count, dstaddr, dstport, +3 more.
list_ssl_ssh_profilesA
List SSL/SSH inspection profiles with the CA each one re-signs with. The built-in no-inspection, certificate-inspection and deep-inspection profiles are read-only; edit custom-deep-inspection or a copy instead.
Inputs: vdom, filter, format.
list_static_routesC
List configured static routes.
Inputs: vdom, filter, format.
move_firewall_policyB
Move a policy before or after another one (policies match top-down).
Inputs: policyid (required), vdom, after, before.
search_apiA
Find FortiOS API endpoints by keyword, from the FortiGate's own schema: configuration (cmdb, e.g. 'bgp' -> router/bgp) and live state (monitor, e.g. 'ha peer' -> system/ha-peer). Use it to reach any setting no dedicated tool covers, then describe_config, get_config, set_config or get_monitor.
Inputs: query (required), kind, vdom, limit.
search_applicationsA
Search application-control signatures by name (contains, case-insensitive) and/or category, e.g. query=YouTube or category=P2P. Returns id, name, category and risk.
Inputs: vdom, limit, query, category.
set_admin_mfaA
Turn on two-factor authentication for an administrator: fortitoken (needs an activated token serial), email (needs email_to and a working email server) or sms (needs sms_phone and SMS service); or disable it. Checks the prerequisites first. dry_run (the default) shows the change. Test a login in a private window before closing your current session.
Inputs: admin (required), method (required), vdom, dry_run, +3 more.
set_configA
Change any configuration endpoint, validated against the FortiGate's schema first: field names, option values, integer ranges, string lengths, and table vs single-object rules. action is update (default), create or delete. With dry_run (the default) nothing is sent; the result shows the request and each field's current and new value. Fields that reference other objects take a list of names, e.g. srcaddr: ['LAB-NET'].
Inputs: endpoint (required), mkey, vdom, action, +2 more.
set_dns_serverA
Serve DNS on an interface. Modes: recursive (local zones first, then forward to the system resolvers), non-recursive (local zones only), forward-only.
Inputs: interface (required), mode, vdom.
set_syslog_targetA
Send logs to a syslog server: sets server, port and transport on one of the four syslog slots and enables it. mode is udp (default), reliable (TCP) or legacy-reliable; with reliable, enc_algorithm (high, high-medium, low) adds TLS. Validated against the FortiGate's schema; dry_run (the default) shows the change without sending it.
Inputs: mode, port, slot, vdom, +4 more.
update_addressC
Update a firewall address object.
Inputs: name (required), fqdn, vdom, extra, +4 more.
update_address_groupB
Update an address group. members replaces the whole member list.
Inputs: name (required), vdom, extra, comment, +1 more.
update_dhcp_serverB
Update a DHCP server. Note: vci_match=true makes the server answer only clients whose vendor class matches vci-string (FortiOS defaults to FortiSwitch/FortiExtender), which silently ignores ordinary clients.
Inputs: server_id (required), vdom, extra, domain, +5 more.
update_firewall_policyA
Update a firewall policy. Only the fields given change; list fields are replaced, not appended.
Inputs: policyid (required), nat, name, vdom, +17 more.
update_fortiguardA
Ask the FortiGate to contact FortiGuard now and refresh its entitlements and signature packages (the GUI's 'Check update now'). Needs a FortiGuard license. With dry_run (the default) it only reports what would happen and the current signature ages.
Inputs: vdom, dry_run.
update_interfaceA
Update an interface. Changing the interface this server connects through (its IP, mode or allowaccess) can cut off API access, so double-check those changes.
Inputs: name (required), ip, mode, role, +6 more.
update_service_groupB
Update a service group. members replaces the whole member list.
Inputs: name (required), vdom, extra, comment, +1 more.
update_ssl_ssh_profileB
Update an SSL/SSH inspection profile, e.g. the CA used to re-sign certificates during deep inspection. Clients must trust that CA, and FortiGate-VM evaluation licenses re-sign RSA sites with 512-bit keys regardless of the CA, which modern clients reject.
Inputs: name (required), vdom, extra, caname, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 88 tools
Most tools target distinct resources and actions (e.g., list_addresses vs create_address_group vs list_firewall_policies), and descriptions clarify boundaries. Some overlap exists between the generic API tools (get_config/set_config/fortigate_api) and dedicated update/create tools, and audit_admin_access overlaps with audit_hardening, but descriptions generally resolve which to use.
The set predominantly follows a consistent verb_noun snake_case pattern (list_, get_, create_, update_, delete_, audit_, set_). A couple of tools break the pattern (forticonverter_setup_prompt and fortigate_api are noun phrases), but overall naming is predictable and readable.
88 tools is far beyond the typical 3-15 range and qualifies as an extreme mismatch. The presence of generic config tools (search_api, get_config, set_config, fortigate_api) makes many dedicated tools redundant, bloating the surface and increasing selection cost.
Coverage is exceptionally thorough: firewall policies, addresses, services, DNS/DHCP, routing, interfaces, licenses, HA, audits, logs, security profiles, certificates, and a generic REST escape hatch. There are no obvious gaps for managing a FortiGate.
Maintenance
Related MCP Connectors
Connect ChatGPT and Claude to Fortnox: invoices, customers, reports. Every write needs your OK.
Real-time MCP & A2A prompt-injection, jailbreak, and tool-schema poisoning firewall for AI agents.
Connect Claude, ChatGPT, Codex, Claude Code or another MCP client to your real multi-broker investment portfolio. Fortunest tracks stocks, ETFs and crypto across brokers and exchanges; its MCP server lets your agent read holdings, returns, allocation, risk, trades and tax lots, calculated by Fortunest rather than guessed by the model. Reads run on their own; every change waits for your approval in the Fortunest app, and no tool places an order or moves money. Sign-in is OAuth 2.1 and needs Fortunest Pro (14-day trial, no card). A free demo that needs no account is listed as Fortunest demo.
Run field service from Claude, ChatGPT or Copilot: dispatch, billing, customer messages, photos, and change the software itself, with a confirm step before every change. This address is the India region; US East, Canada, Norway and NZ addresses are at fieldproxy.ai/mcp.
Related MCP Servers
- AlicenseBqualityDmaintenanceA complete MCP server for Fortinet FortiOS 7.6.x that exposes the entire REST API as typed MCP tools for use with MCP-compatible clients like Claude Desktop.10011MIT
- FlicenseAqualityDmaintenanceConnects Claude Desktop to FortiGate firewalls via REST API for read-only config inspection and safe write operations with dry-run confirmation.18-
- AlicenseNot gradedqualityDmaintenanceProvides programmatic access to FortiGate devices for managing firewall policies, routing, virtual IPs, and device operations, enabling integration with MCP-compatible clients like Claude Desktop.MIT
- FlicenseNot gradedqualityAmaintenanceEnables natural-language management of a pfSense firewall from Claude Desktop, Claude Code, or any MCP client, covering firewall rules, NAT, VPNs, routing, DNS, DHCP, certificates, and diagnostics across 332 wire-format-verified tools. Every destructive change passes through confirmation guardrails, rate limits, and config-revision rollback with secrets redacted from logs.-