MCP server for Firewalla MSP API - provides CRUD operations for all Firewalla MSP endpoints
npm install @unknown-sh/firewalla-msp-mcp-serverA Model Context Protocol (MCP) server that provides access to the Firewalla Managed Service Provider (MSP) API. This server enables AI assistants and other MCP clients to interact with Firewalla MSP resources including boxes, devices, alarms, rules, flows, and target lists.
- Complete API Coverage: Full CRUD operations for all Firewalla MSP API endpoints
- Advanced Search: Global search across devices, alarms, rules, flows, and boxes
- Analytics & Insights: Network statistics, historical trends, and performance metrics
- Security Management: Create, modify, and monitor security rules and alarms
- Network Monitoring: Real-time flow analysis and device tracking
- Target Lists: Manage IP/domain allow/block lists
- Secure Authentication: API token-based authentication
- Smart Pagination: Cursor-based pagination for large datasets
- Comprehensive Testing: Extensive test suite with safe read-only validation
- Type Safety: Full TypeScript support with complete type definitions
- Error Handling: Robust error handling and recovery mechanisms
``bash`
npm install -g @unknown-sh/firewalla-msp-mcp-server
Or install locally in your project:
`bash`
npm install @unknown-sh/firewalla-msp-mcp-server
The server requires two environment variables to be set:
- FIREWALLA_MSP_API_KEY: Your Firewalla MSP personal access tokenFIREWALLA_MSP_DOMAIN
- : Your MSP domain (e.g., your-company.firewalla.net)
1. Log in to your Firewalla MSP portal
2. Navigate to Account Settings
3. Create a new personal access token
4. Note your MSP domain from the URL
#### 1. Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json %APPDATA%\Claude\claude_desktop_config.json
Windows:
`json`
{
"mcpServers": {
"firewalla-msp": {
"command": "npx",
"args": ["@unknown-sh/firewalla-msp-mcp-server"],
"env": {
"FIREWALLA_MSP_API_KEY": "your-api-key-here",
"FIREWALLA_MSP_DOMAIN": "your-domain.firewalla.net"
}
}
}
}
#### 2. Claude Code
Add the MCP server using the Claude Code CLI:
`bash`
claude mcp add firewalla-msp -e FIREWALLA_MSP_API_KEY=your-api-key-here -e FIREWALLA_MSP_DOMAIN=your-domain.firewalla.net -- npx @unknown-sh/firewalla-msp-mcp-server
Or if you have the server installed globally:
`bash`
claude mcp add firewalla-msp -e FIREWALLA_MSP_API_KEY=your-api-key-here -e FIREWALLA_MSP_DOMAIN=your-domain.firewalla.net -- firewalla-msp-mcp-server
#### 3. Gemini-CLI
Add to ~/.config/gemini-cli/config.json:
`json`
{
"mcpServers": {
"firewalla-msp": {
"command": "npx",
"args": ["@unknown-sh/firewalla-msp-mcp-server"],
"env": {
"FIREWALLA_MSP_API_KEY": "your-api-key-here",
"FIREWALLA_MSP_DOMAIN": "your-domain.firewalla.net"
}
}
}
}
#### 4. Cursor
Add to your Cursor settings file:
macOS: ~/Library/Application Support/Cursor/User/globalStorage/cursor-ai.cursor-chat/config/mcp.json %APPDATA%\Cursor\User\globalStorage\cursor-ai.cursor-chat\config\mcp.json
Windows:
`json`
{
"mcpServers": {
"firewalla-msp": {
"command": "npx",
"args": ["@unknown-sh/firewalla-msp-mcp-server"],
"env": {
"FIREWALLA_MSP_API_KEY": "your-api-key-here",
"FIREWALLA_MSP_DOMAIN": "your-domain.firewalla.net"
}
}
}
}
#### 5. Windsurf (Codeium)
Add to Windsurf's MCP configuration:
macOS: ~/Library/Application Support/Windsurf/mcp.json %APPDATA%\Windsurf\mcp.json
Windows:
`json`
{
"mcpServers": {
"firewalla-msp": {
"command": "npx",
"args": ["@unknown-sh/firewalla-msp-mcp-server"],
"env": {
"FIREWALLA_MSP_API_KEY": "your-api-key-here",
"FIREWALLA_MSP_DOMAIN": "your-domain.firewalla.net"
}
}
}
}
#### 6. VS Code (via Continue or other MCP extensions)
For Continue extension, add to ~/.continue/config.json:
`json`
{
"models": [
// Your existing models
],
"mcpServers": {
"firewalla-msp": {
"command": "npx",
"args": ["@unknown-sh/firewalla-msp-mcp-server"],
"env": {
"FIREWALLA_MSP_API_KEY": "your-api-key-here",
"FIREWALLA_MSP_DOMAIN": "your-domain.firewalla.net"
}
}
}
}
#### Local Installation Alternative
If you prefer to install the server locally instead of using npx:
`bash`
npm install -g @unknown-sh/firewalla-msp-mcp-server
Then use this configuration (same for all clients):
`json`
{
"mcpServers": {
"firewalla-msp": {
"command": "firewalla-msp-mcp-server",
"args": [],
"env": {
"FIREWALLA_MSP_API_KEY": "your-api-key-here",
"FIREWALLA_MSP_DOMAIN": "your-domain.firewalla.net"
}
}
}
}
#### Development Installation
For development or local testing, use absolute paths:
`json`
{
"mcpServers": {
"firewalla-msp": {
"command": "node",
"args": ["/absolute/path/to/firewalla-msp-mcp-server/dist/index.js"],
"env": {
"FIREWALLA_MSP_API_KEY": "your-api-key-here",
"FIREWALLA_MSP_DOMAIN": "your-domain.firewalla.net"
}
}
}
}
Note: After adding the configuration, restart the respective application for changes to take effect.
The server provides 26 tools across 8 API categories for comprehensive Firewalla MSP management:
- list_boxes - Get all Firewalla boxes in the MSP
- Optional: group - Filter by group ID
- list_devices - Get all devices across boxes
- Optional: box - Filter by specific box IDgroup
- Optional: - Filter by specific box group ID
- list_alarms - Get alarms with optional filtering
- Optional: query - Search query (e.g., 'status:active box:boxId type:9')groupBy
- Optional: - Group results (comma-separated)sortBy
- Optional: - Sort results (e.g., 'ts:desc,total:asc')limit
- Optional: - Max results per page (≤500, default 200)cursor
- Optional: - Pagination cursor
- get_alarm - Get a specific alarm
- Required: gid - Box GIDaid
- Required: - Alarm ID
- delete_alarm - Delete a specific alarm
- Required: gid - Box GIDaid
- Required: - Alarm ID
- list_rules - Get all rules (requires MSP 2.7.0+)
- Optional: query - Search query (e.g., 'status:active box.id:boxId')
- create_rule - Create a new security rule
- Required: action - Rule action: allow, block, time_limitdirection
- Required: - Traffic direction: inbound, outbound, bidirectionprotocol
- Required: - Protocol type: tcp, udp, icmp, anytarget
- Required: - Rule target specification:type
- - Target type: ip, domain, category, device, networkvalue
- - Target value (IP, domain, etc.)name
- Optional: - Rule name (auto-generated if not provided)scope
- Optional: - Rule scope specificationschedule
- Optional: - Rule schedule (for time_limit rules)
- update_rule - Update an existing rule
- Required: id - Rule IDstatus
- Optional: All fields from create_rule
- Optional: - Rule status: active, paused
- delete_rule - Delete a security rule
- Required: id - Rule ID
- pause_rule - Pause a specific rule
- Required: id - Rule ID
- resume_rule - Resume a paused rule
- Required: id - Rule ID
- list_flows - Get network flows with filtering
- Optional: query - Search query (e.g., 'ts:1234567890-1234567899 box.id:boxId')groupBy
- Optional: - Group resultssortBy
- Optional: - Sort results (default: 'ts:desc')limit
- Optional: - Max results per page (≤500, default 200)cursor
- Optional: - Pagination cursor
- list_target_lists - Get all target lists
- get_target_list - Get a specific target list
- Required: id - Target list ID
- create_target_list - Create a new target list
- Required: name - Name of the target listtargets
- Required: - Array of IP addresses or domainsowner
- Optional: - Owner of the target listcategory
- Optional: - Category of the target listnotes
- Optional: - Notes about the target list
- update_target_list - Update an existing target list
- Required: id - Target list IDname
- Optional: - Name of the target listtargets
- Optional: - Array of IP addresses or domainsowner
- Optional: - Owner of the target listcategory
- Optional: - Category of the target listnotes
- Optional: - Notes about the target list
- delete_target_list - Delete a target list
- Required: id - Target list ID
- get_simple_statistics - Get overview statistics (boxes, alarms, rules counts)
- Optional: group - Filter by specific box group ID
- get_statistics - Get detailed statistics by type
- Required: type - Statistics type:topBoxesByBlockedFlows
- - Top boxes by blocked flowstopBoxesBySecurityAlarms
- - Top boxes by security alarms topRegionsByBlockedFlows
- - Top regions by blocked flowsgroup
- Optional: - Filter by specific box group IDlimit
- Optional: - Maximum results (1-50, default: 5)
- get_trends - Get historical trend data over time
- Required: type - Trend data type:flows
- - Daily blocked flows trendsalarms
- - Daily security alarms trendsrules
- - Daily rule creation trendsgroup
- Optional: - Filter by specific box group ID
Based on comprehensive API testing, search is supported on 4 out of 8 data model types using Firewalla's advanced query syntax.
#### Supported Search Types
- Devices - Full text search and device-specific qualifiers
- Alarms - Advanced filtering with alarm-specific qualifiers
- Flows - Comprehensive search with flow-specific qualifiers
- Boxes - Basic query support
#### Search Tools
- search_global - Search across all searchable entity types
- Required: query - Search query using Firewalla syntaxtypes
- Optional: - Array of entity types: ["devices", "alarms", "flows", "boxes"]limit
- Optional: - Max results per type (1-500, default: 10)cursor
- Optional: - Pagination cursor for continuing results
- search_devices - Search devices with device-specific qualifiers
- Required: query - Search query with qualifiers: device.name, device.id, box.id, box.name, box.group.idlimit
- Optional: - Maximum results (1-500, default: 50)cursor
- Optional: - Pagination cursor
- search_alarms - Search alarms with alarm-specific qualifiers
- Required: query - Search query with qualifiers: ts, type, status, box.id, box.name, box.group.id, device.id, device.name, remote.category, remote.domain, remote.region, transfer.download, transfer.upload, transfer.totallimit
- Optional: - Maximum results (1-500, default: 50)cursor
- Optional: - Pagination cursor
- search_flows - Search flows with flow-specific qualifiers
- Required: query - Search query with qualifiers: ts, status, direction, box.id, box.name, box.group.id, device.id, device.name, category, domain, region, sport, dport, download, upload, totallimit
- Optional: - Maximum results (1-500, default: 50)cursor
- Optional: - Pagination cursor
#### Query Syntax
Firewalla search supports advanced query syntax:
Basic Text Search:
``
"iPhone"
"MacBook Pro"
apple
Qualified Search:
``
status:active
device.name:iPhone
box.name:"Gold Plus"
Wildcard Search:
``
device.name:iphone
domain:*.google.com
Numeric Comparisons:
``
ts:>1720000000
download:>1MB
total:>=500KB
transfer.total:<100MB
Range Search:
``
ts:1720000000-1720086400
download:100KB-1MB
Combined Queries:
``
status:active type:1
direction:outbound domain:google
device.name:iphone ts:>1720000000
Exclusion Search:
``
-status:resolved
-type:1
#### Supported Units
- B (Byte)
- KB (1000 B)
- MB (1000 KB)
- GB (1000 MB)
- TB (1000 GB)
#### Timestamp Format
Use Unix timestamps (seconds since epoch):
``
ts:>1720000000 # After specific time
ts:1720000000-1720086400 # Time range
#### Non-Searchable Types
These endpoints do not support search queries:
- Target Lists (list_target_lists)get_statistics
- Statistics (, get_simple_statistics)get_trends
- Trends ()
Many endpoints support advanced querying using specific qualifiers:
- Timestamp
- type - Alarm type
- status - Alarm status (active/archived)
- box.id - Box ID
- box.name - Box name
- device.id - Device ID
- device.name - Device name
- remote.category - Remote category
- remote.domain - Remote domain
- transfer.download - Download amount
- transfer.upload - Upload amount
- transfer.total - Total transfer$3
- ts - Timestamp
- status - Flow status
- direction - Traffic direction
- box.id - Box ID
- box.name - Box name
- device.id - Device ID
- device.name - Device name
- category - Flow category
- domain - Domain
- region - Geographic region
- sport - Source port
- dport - Destination port
- download - Download amount
- upload - Upload amount
- total - Total traffic$3
- status - Rule status
- action - Rule action
- box.id - Box ID
- box.group.id - Box group ID
- device.id - Device IDExamples
$3
Once configured, you can ask Claude to interact with your Firewalla MSP:
`
"List all active alarms from the last 24 hours"
"Show me all devices that are currently offline"
"Create a new target list with suspicious IP addresses"
"Pause all rules on box xyz123"
`$3
`javascript
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";const transport = new StdioClientTransport({
command: "npx",
args: ["@unknown-sh/firewalla-msp-mcp-server"],
env: {
FIREWALLA_MSP_API_KEY: "your-api-key",
FIREWALLA_MSP_DOMAIN: "your-domain.firewalla.net"
}
});
const client = new Client({
name: "firewalla-client",
version: "1.0.0"
}, {
capabilities: {}
});
await client.connect(transport);
// List all boxes
const result = await client.callTool({
name: "list_boxes",
arguments: {}
});
console.log(result);
`Testing
The server includes comprehensive test scripts to validate all API functionality:
$3
All test scripts are located in the
tests/ directory and can be run individually:`bash
cd testsSafe read-only test (recommended first test)
node test-readonly.jsSearch API functionality
node test-search.jsStatistics API tests
node test-statistics.jsTrends API tests
node test-trends.jsRules CRUD operations (modifies your Firewalla)
node test-rules-crud.jsBasic server connectivity
node test-server.js
`$3
-
test-readonly.js - Safe read-only operations across all APIs (boxes, devices, alarms, rules, target lists)
- test-search.js - Global search functionality across all entity types with filtering
- test-statistics.js - Network statistics including top boxes, regions, and overview data
- test-trends.js - Historical trend analysis for flows, alarms, and rules
- test-rules-crud.js - Complete CRUD operations for security rules (use with caution)
- test-server.js - Basic MCP server connectivity and tool listing$3
For convenience, run all safe tests at once:
`bash
cd tests
./run-all-tests.sh
`This runs all read-only tests in sequence and provides a comprehensive validation of the MCP server functionality.
$3
⚠️ Important:
- Start with
test-readonly.js to verify your setup safely
- test-rules-crud.js modifies your Firewalla configuration - use carefully
- All other tests are read-only and safe to run
- The test runner (run-all-tests.sh) excludes write operations for safetyDevelopment
To run the server in development mode:
`bash
Clone the repository
git clone https://github.com/your-username/firewalla-msp-mcp-server.git
cd firewalla-msp-mcp-serverInstall dependencies
npm installSet environment variables
export FIREWALLA_MSP_API_KEY="your-api-key"
export FIREWALLA_MSP_DOMAIN="your-domain.firewalla.net"Run in development mode
npm run devBuild the project
npm run buildRun tests
npm test
`Security Considerations
- Never commit your API key to version control
- Use environment variables or secure credential management
- The API key provides full access to your MSP account - keep it secure
- Consider using read-only tokens if you only need to query data
Error Handling
The server provides detailed error messages for common issues:
-
401 Unauthorized - Check your API key
- 404 Not Found - Resource doesn't exist
- 400 Bad Request - Invalid parameters or query syntaxLicense
GNU General Public License v3.0
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
See the LICENSE file for the full license text.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
When contributing:
1. Ensure all tests pass (
cd tests && ./run-all-tests.sh`)For issues related to:
- This MCP server: Open an issue on GitHub
- Firewalla MSP API: Contact help@firewalla.com
- MCP protocol: See the MCP documentation
This is an independent, open-source MCP server implementation for the Firewalla MSP API.
Important: This project is:
- ✅ Independent: Created and maintained by the open-source community
- ✅ Unofficial: Not affiliated with, endorsed by, or developed by Firewalla Inc.
- ✅ Open Source: Licensed under GNU GPL v3.0
- ✅ Community-Driven: Contributions and feedback welcome
Firewalla® is a trademark of Firewalla Inc. The use of this trademark in this project is purely for descriptive purposes to indicate compatibility and does not imply any official relationship or endorsement.