subnet-calculator-mcp
Provides subnet calculation tools that generate Cisco-friendly OSPF wildcard masks and network statements, enabling efficient IPv4 planning for Cisco networks.
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., "@subnet-calculator-mcp Calculate subnet for 10.0.0.0 with 50 hosts"
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.
Subnet Calculator MCP Server
subnet-calculator-mcp is a production-ready Model Context Protocol server that delivers reliable IPv4 subnet planning utilities to LLM-powered assistants. It eliminates tedious manual math by exposing fast, well-tested tools for subnet sizing, wildcard mask generation, gateway selection, and host validation.
Why Use This Server?
🔢 Convert host requirements into accurate subnet masks and CIDR prefixes
🌐 Produce Cisco-friendly OSPF wildcard masks and network statements
✅ Verify whether an IP belongs to a subnet, including gateway hints and address position
🔄 Reverse-calculations from dotted masks or find the Nth usable address instantly
⚙️ Built on the official Python MCP SDK with thorough type hints, validation, and tests
Related MCP server: NetworkCalc MCP Server
Install & Run
The package is published on PyPI: https://pypi.org/project/subnet-calculator-mcp/
Install with pip
pip install subnet-calculator-mcp
python -m subnet_calculator_mcp.serverRun instantly (no install)
uvx subnet-calculator-mcpInstall as a reusable CLI
uv tool install subnet-calculator-mcp
# later
subnet-calculator-mcpClient Configuration
Claude Desktop / Claude for Windows
Add the server to claude_desktop_config.json.
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"subnet-calculator": {
"command": "uvx",
"args": ["subnet-calculator-mcp"]
}
}
}If you installed via uv tool install or pip, change the command to "subnet-calculator-mcp" and omit args.
Generic mcp.json
Many editors (Cursor, Windsurf, etc.) use an mcp.json file. Add the following entry:
{
"subnet-calculator": {
"command": "uvx",
"args": ["subnet-calculator-mcp"],
"env": {}
}
}Set command to "subnet-calculator-mcp" if the binary is installed globally.
Tool Reference
calculate_subnet
Inputs:
network_base(IPv4 address),hosts_needed(int), optionalreturn_format("detailed"or"simple").Returns: CIDR prefix, dotted mask, wildcard mask, usable range, broadcast, binary representations, total/usable host counts.
Use it for: deriving the smallest subnet that can host the requested number of usable addresses.
calculate_wildcard_mask
Inputs:
ip_address(any IP in the subnet),cidr_prefix(0–32), optionalinclude_ospf_command(bool).Returns: network address, mask, wildcard mask, binary wildcard string, and optional
network ... area 0statement.Use it for: creating OSPF configurations or ACLs that rely on wildcard masks.
validate_ip_in_subnet
Inputs:
ip_address,network(CIDR string), optionalreturn_gateway(bool).Returns: membership flag, mask, prefix, network/broadcast flags, usability, likely gateway, position index, and remaining usable addresses.
Use it for: quickly verifying assignments and identifying first-hop router addresses.
calculate_subnet_from_mask
Inputs:
ip_address,subnet_mask(dotted decimal).Returns: network boundary, prefix, wildcard mask, usable range, broadcast, and host counts.
Use it for: analysing legacy configurations that provide dotted masks instead of CIDR notation.
get_nth_usable_ip
Inputs:
network(CIDR string),position(1-based index).Returns: IP address at that position, whether it is last usable, total usable hosts, and associated network address.
Use it for: allocating deterministic host positions (first server, second router, etc.).
Example invocation:
{
"tool": "calculate_subnet",
"arguments": {
"network_base": "172.16.0.16",
"hosts_needed": 14
}
}Development Workflow
git clone https://github.com/sanjayshreeyans/subnet-calculator-mcp.git
cd subnet-calculator-mcp
# Install dependencies (dev group includes pytest, mypy, ruff, black)
uv sync --group dev
# Run the automated test suite
uv run pytest
# Type-check, lint, and format
uv run mypy src
uv run ruff check src tests
uv run black --check src tests
# Build distribution artifacts
uv buildLicense
MIT License – see LICENSE for details.
Available Tools
5 toolscalculate_subnetC
Calculate subnet details given a base IP and required hosts.
Inputs: network_base (required), hosts_needed (required), return_format.
calculate_subnet_from_maskC
Calculate network information from an IP address and subnet mask.
Inputs: ip_address (required), subnet_mask (required).
calculate_wildcard_maskB
Generate OSPF wildcard mask details for a subnet.
Inputs: ip_address (required), cidr_prefix (required), include_ospf_command.
get_nth_usable_ipC
Return the Nth usable IP address in a subnet.
Inputs: network (required), position (required).
validate_ip_in_subnetC
Validate that an IP address belongs to a subnet and provide context.
Inputs: ip_address (required), network (required), return_gateway.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: calculate_subnet and calculate_subnet_from_mask differ by input type, calculate_wildcard_mask is specific, get_nth_usable_ip retrieves a specific IP, and validate_ip_in_subnet checks membership. No ambiguity.
All tools use a consistent verb_noun pattern with snake_case: calculate_subnet, calculate_subnet_from_mask, calculate_wildcard_mask, get_nth_usable_ip, validate_ip_in_subnet. The verbs 'calculate', 'get', and 'validate' are clear and predictable.
With 5 tools, the server is well-scoped for a subnet calculator. Each tool serves a necessary function without redundancy or bloat.
The set covers core subnet operations (calculation from hosts/mask, wildcard, nth IP, validation). Minor gaps exist, such as no explicit tool for listing all usable IPs or calculating total hosts, but core workflows are supported.
Maintenance
Related MCP Connectors
Calculates IPv4 subnet information from an IP address and CIDR prefix or dotted decimal subnet mask
Open-source IP address and CIDR tools for network calculations and public IP lookup.
DNS, WHOIS, SSL, IP geolocation, email validation, DNSBL blacklist, HTTP headers, subnet calc.
Inspect IPv4/IPv6 subnets, allocate labeled prefixes and detect overlaps with exact address counts.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables subnet mask calculations and network planning through MCP framework. Provides detailed subnet information including network addresses, IP ranges, and broadcast addresses, plus LAN planning advice for different network scales.MIT
- AlicenseNot gradedqualityDmaintenanceProvides network utility tools including DNS lookup, WHOIS lookup, SPF record inspection, SSL/TLS certificate checking, and subnet/CIDR analysis powered by networkcalc.com services.1MIT
- AlicenseAqualityDmaintenanceProvides accurate IPv4 subnet and address tools for LLMs using Python's ipaddress library. Includes CIDR parsing, overlap detection, IP classification, and more.11GPL 3.0
- AlicenseNot gradedqualityCmaintenanceProvides verified IPv4 subnet calculations, IP analysis, and network diagram generation for AI tutoring systems via MCP.2MIT