使用说明
FortiOS MCP服务器
MCP服务器,用于通过AI代理管理FortiGate防火墙。使用FastMCP构建,部署为容器。
公共端点: https://mcp-fortios.fortidemoscloud.com/mcp
工具
| 工具 | 说明 |
|---|---|
ping_fortigate |
测试与FortiGate的连接 |
create_firewall_policy |
创建防火墙策略 |
get_firewall_policies |
列出防火墙策略 |
create_address |
创建地址对象(ipmask、iprange、fqdn) |
get_addresses |
列出地址对象 |
delete_address |
删除地址对象 |
create_address_group |
创建地址组 |
get_address_groups |
列出地址组 |
delete_address_group |
删除地址组 |
create_vip |
创建虚拟IP(NAT/端口转发) |
get_vips |
列出VIP对象 |
每个工具都需要 fortigate_url 和 fortigate_token 作为参数。服务器是无状态的,它不存储凭据。
从克劳德桌面连接
添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):
{
"mcpServers": {
"fortios": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mcp-fortios.fortidemoscloud.com/mcp"
],
"env": {
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
}
}
}
}
从Gemini CLI连接
添加到您的Gemini设置(~/.gemini/settings.json):
{
"mcpServers": {
"fortios": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mcp-fortios.fortidemoscloud.com/mcp"
],
"env": {
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
}
}
}
}
从Kiro/VS代码连接
添加 .kiro/settings/mcp.json 或同等产品:
{
"mcpServers": {
"fortios": {
"url": "https://mcp-fortios.fortidemoscloud.com/mcp"
}
}
}
卷曲测试
# 1. Initialize session and capture Mcp-Session-Id from headers
export SESSION_ID=$(curl -s -i -X POST https://mcp-fortios.fortidemoscloud.com/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test-curl","version":"1.0"}}}' \
| grep -i "mcp-session-id" | awk '{print $2}' | tr -d '\r')
echo "Session ID: $SESSION_ID"
# 2. List tools using the captured Session ID
curl -s -X POST https://mcp-fortios.fortidemoscloud.com/mcp \
-H "Content-Type: application/json" \
-H "Mcp-Session-Id: $SESSION_ID" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
在本地运行
# Docker
docker-compose up --build -d
# Or directly
uv sync
uv run uvicorn app.server:app --host 0.0.0.0 --port 8000
服务器可用 http://localhost:8000/mcp 健康检查在 /health.
部署到Kubernetes
kubectl apply -f k8s-deployment.yaml
暴露在节点端口30081上。图片: jviguerasfortinet/mcp-fortios-server:v1.0.8
发布
./scripts/release.sh patch # 1.0.8 → 1.0.9
推a v*.*.* 标签触发GitHub Actions管道来构建Docker镜像并将其推送到Docker Hub。
许可证
麻省理工学院
