Added
- Optional Bearer auth on the HTTP
/mcpendpoint — setMCP_API_KEY=<key>and every request must includeAuthorization: Bearer <key>(timing-safe compare). Missing/wrong tokens get401with aWWW-Authenticate: Bearer realm="mcp"header./healthstays open for health-checkers. Unset = open endpoint (preserves current behavior). HTTP transport only — stdio is single-process and unaffected. (#11) — thanks @kb1isz for the request. - Per-client FortiManager token passthrough — set
MCP_TOKEN_PASSTHROUGH=trueand each MCP client can supply its own FortiManager admin token via theX-FMG-Tokenheader. That token is used (instead ofFMG_API_TOKEN) for live API calls made by theexecutetool for that request only, so FortiManager's own admin-profile RBAC enforces per-user permissions. Requests without the header fall back toFMG_API_TOKEN, so existing single-tenant deployments keep working unchanged. HTTP transport only. (#11) FmgClient.rawRequest(method, params, opts?: { tokenOverride })— new optional per-call token override threaded throughCodeExecutor.execute(code, opts?: { fmgToken }). The sharedFmgClient(and its undici dispatcher) is reused across requests; only theAuthorizationheader is swapped per call.- 18 new tests across config / client / code-executor / HTTP transport covering the auth gate, passthrough, fallback, and combined modes (total 90).
Changed
- HTTP transport's
serverFactorynow receives anMcpRequestContext(currently exposingfmgToken) instead of being called with no arguments. The stdio path is unchanged. startHttpTransportnow removes its installedSIGINT/SIGTERMlisteners whenclose()is called, so repeated test runs no longer leak signal handlers on the host process.
Full Changelog: https://github.com/jmpijll/fortimanager-code-mode-mcp/compare/...
Note: This server requires locally-generated API spec files. See README for setup instructions.