FortiManager Code Mode MCP
Provides tools to interact with Fortinet FortiManager's JSON-RPC API, enabling AI agents to search the API specification and execute API calls for managing FortiManager devices, ADOMs, policies, and more.
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., "@FortiManager Code Mode MCPSearch the API spec for creating a firewall address object."
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.
Two tools, one API
This Model Context Protocol server exposes search and execute.
The agent searches the API reference, then runs JavaScript inside a QuickJS WASM sandbox.
API calls go through the host; credentials remain outside the sandbox.
Search the reference. Find objects, attributes, URLs, methods and error codes.
Call JSON-RPC. Use
fortimanager.request()with FortiManager 7.4 or 7.6.Choose a transport. Stdio for local clients; Streamable HTTP for hosted use.
Keep credentials on the host. Optional HTTP Bearer auth and per-request
X-FMG-Tokenpassthrough.
Related MCP server: FortiOS 7.6.x MCP Server
Get started
Install from source and point your MCP client at the built dist/index.js.
Requirements
Node.js 22.19.0 or newer and npm. CI checks Node 22 and 24.
FortiManager 7.4 or 7.6, an API token, and locally generated API specs.
Before building, download the Fortinet HTML reference and run npm run generate:spec.
See API spec setup. The proprietary
HTML and generated specs are not redistributed.
Build from source
git clone https://github.com/jmpijll/fortimanager-code-mode-mcp.git
cd fortimanager-code-mode-mcp
npm ci
cp .env.example .env
# Edit .env: FMG_HOST and FMG_API_TOKEN.
npm run generate:spec
npm run build
npm startThe shell examples use Bash. In PowerShell, use Copy-Item .env.example .env and
set variables with $env:NAME = 'value'.
Configure your MCP client with node /absolute/path/to/fortimanager-code-mode-mcp/dist/index.js.
Use an absolute path and supply credentials through the client's environment configuration
when its working directory does not contain your .env file.
See the client setup and usage guide.
For hosted use, set MCP_TRANSPORT=http. See the configuration and auth contract.
Docker instructions are in docker-compose.yml.
Important: API Spec Required
Generate the Fortinet API specs locally before starting the server.
Example session
After discovering the operation with the search tool, use the execute tool:
var response = fortimanager.request('get', [{ url: '/sys/status' }]);
response.result[0].data;See the usage guide for search recipes, configuration and additional call shapes.
Know the boundaries
Area | Current boundary |
API reference | Generated locally from licensed Fortinet documentation; required at startup. |
Permissions | Upstream FortiManager permissions govern API calls. Token passthrough falls back to the environment token when the header is absent. |
Deployment | Node and Docker; no Cloudflare Worker entry. |
Sandbox | Resource limits bound each invocation; allowed API calls still act with the supplied account's permissions. |
Verification status
Local mocked tests cover the client, sandbox, tool responses and HTTP transport. The earlier live FortiManager record is separate from the current offline suite. See the setup and verification reference for the detailed historical evidence and remaining work. New verification reports should identify the server revision, client, upstream version and operations actually exercised.
Project status
Stable · v1.1.0. Generate the required API spec before starting either transport.
Privacy
The host sends API requests to the service configured for this server. Tool results and captured sandbox logs are returned to your MCP client; that client may send them to its configured model provider. Spec caches may be written locally.
Keep .env files and credentials private. Redact account identifiers, IP addresses and
service data before sharing logs or verification reports. See SECURITY.md
for vulnerability reporting.
Development and contribution
npm run checkcheck runs lint, formatting, typecheck, mocked tests and the build. See CONTRIBUTING.md
for the repository layout and contribution checks, and AGENTS.md for
architectural invariants. Live API tests require separate credentials and verification scope.
Documentation
License and acknowledgements
MIT. Built with TypeScript, the MCP SDK and QuickJS, following the Cloudflare Code Mode pattern.
This server cannot be deployed
Maintenance
Related MCP Connectors
Security firewall for AI agents — scans MCP calls for injection, secrets, and risks.
Connect any AI agent to 1,000+ apps and 27,000+ actions through one remote MCP server (OAuth).
- gatewayOAuthai.sealgate
MCP gateway with runtime security policy, tool-call-level control, and audit of agent actions.
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to interact with MCP servers by writing TypeScript/JavaScript code instead of direct tool calls. Provides a code execution sandbox that accesses MCP servers through HTTP proxy endpoints.18 npm124Apache 2.0
- 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
- AlicenseBqualityAmaintenanceEnables AI assistants to interact with FortiManager for centralized firewall policy management, device provisioning, and network configuration through the FortiManager JSON-RPC API.1007MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with FortiAnalyzer for log analysis, reporting, security monitoring, and SOC operations via the JSON-RPC API.16MIT