forti-mcp
forti-mcp is an MCP server for FortiGate firewalls. It lets an AI client (Claude Code, Codex or any other MCP client) discover, read and change FortiOS configuration through the FortiOS REST API only. It never runs SSH or CLI commands on the device.
1forti configure # a device profile in ~/.forti2forti mcp install --scope workspace # the forti workspace: ~/.forti3cd ~/.forti && claude # or: cd ~/.forti && codex
Everything lives in one directory, the forti home (~/.forti, or $FORTI_HOME): device
profiles, file-stored credentials, client certificates, plans and the audit log. It is also the workspace where AI
agents get the firewall tools. An agent started in any other project does not see them.
What you get
Runtime
Native and on demand
One executable that the AI client starts over stdio when it needs it and that exits when the client closes it. No daemon, no network listener, no background service.
Tools
Four tools
forti_discover (profiles, device identity and mode, resource search, attributes), forti_read
(configuration and monitor data), forti_plan (previews a change as a stored plan) and
forti_apply (makes a change in one call, or applies a stored plan).
Modes
The operator decides what may change
Each device profile has its own mode, read-only (the default), guarded or autonomous, set in
forti configure. One server reaches every FortiGate in the forti home. In guarded mode you approve
each change in the conversation, or with forti approve in a terminal; nothing the model sends can
change a mode or approve a plan.
Paging
Bounded results
Every tool result fits a byte budget (48 KiB of JSON by default) and is always complete JSON; when a listing is cut, the result says where to continue.
Security
Secrets stay out of the conversation
Device secrets in read results come back as "<redacted>", API tokens never appear in the client's
configuration, and the workspace's deny rules keep the agent out of ~/.forti/credentials/.
Protocol
Both protocol eras
MCP 2026-07-28 (stateless) and the initialize-based 2025-11-25 and 2025-06-18 revisions.
How it relates to forti-cli
forti-mcp compiles in the command engine of forti-cli,
the forti command-line tool, which is built on the
forti-api SDK. The engine owns the semantics (resource
catalog, validation, plans, modes, approvals, audit); forti-mcp maps MCP tool calls to engine
requests and back. It never runs the forti executable, so the two packages install independently.
You still want forti next to forti-mcp. Device profiles and credentials are created with
forti configure, terminal approvals are given with forti approve, and
forti mcp install sets up the workspace for Claude Code and Codex. Both programs use the same forti
home (~/.forti), so a plan made in one can be inspected, approved or applied in the other.
Where to go next
Getting started
Installation
Install forti-mcp from the APT repository or Homebrew, or build it from source.
Getting started
Connecting AI clients
Set up the ~/.forti workspace with forti mcp install, or register forti-mcp by hand.
Guide
The workflow: discover, read, plan, apply
How a model uses the four tools, learns a profile's mode and handles guarded approvals.
Guide
Safety and modes
What each mode allows, what guarded mode does not stop, and the limits of recovery.
Guide
Several FortiGates
A profile per device, --profile and the per-request profile field.
Reference
Security
Where secrets and certificates live, redaction, and what the server can never do.
Reference
Tools reference
The four tools, their input schemas, results and annotations.
Reference
Protocol
Supported MCP versions, methods, error codes and the stdio transport rules.