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-mcpCalculate 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.
| Name | Required | Description | Default |
|---|---|---|---|
| network_base | Yes | ||
| hosts_needed | Yes | ||
| return_format | No | detailed |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description fails to disclose key behavioral aspects: what specific subnet details are returned, input format requirements (e.g., CIDR or dot-decimal), and edge case handling. The phrase 'subnet details' is vague.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence with no redundancy. However, it could be slightly expanded to include more useful information without becoming verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Without an output schema or annotations, the description is insufficient for an agent to fully understand the tool's capabilities. It lacks information on return values, input validation, and error scenarios.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaning for network_base and hosts_needed but omits the return_format parameter entirely. Given 0% schema description coverage, the description should have explained all parameters, especially the optional return_format options.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool calculates subnet details using a base IP and required hosts, mapping to the two required parameters. However, it does not differentiate from sibling tools like calculate_subnet_from_mask or specify the exact output details.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives such as calculate_subnet_from_mask or get_nth_usable_ip. The description lacks context for decision-making.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
calculate_subnet_from_maskC
Calculate network information from an IP address and subnet mask.
| Name | Required | Description | Default |
|---|---|---|---|
| ip_address | Yes | ||
| subnet_mask | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. Description only states the input-output relationship without disclosing what 'network information' includes (e.g., network address, broadcast, usable range), potential validation, or error behavior. Significantly lacking.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One sentence, concise but too vague to be effective. Lacks structure and key details that would fit in a brief description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema and zero annotations, description should explain what is returned and under what conditions. It only mentions 'network information', leaving the return type and content unspecified. Incomplete for a 2-param tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%. Description mentions the two parameters by name only, adding no additional meaning about format (e.g., dotted decimal vs CIDR) or constraints. The parameter names are self-explanatory but need clarification for correct usage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states verb 'calculate' and resource 'network information' with inputs (IP address and subnet mask). However, it does not distinguish from sibling tool 'calculate_subnet', which likely has overlapping purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Implied usage is that this tool is appropriate when you have an IP and a subnet mask. No explicit guidance on when to use this vs siblings like 'calculate_subnet' or 'get_nth_usable_ip', nor any prerequisites or limitations.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
calculate_wildcard_maskB
Generate OSPF wildcard mask details for a subnet.
| Name | Required | Description | Default |
|---|---|---|---|
| ip_address | Yes | ||
| cidr_prefix | Yes | ||
| include_ospf_command | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must fully disclose behavior. It states it generates details, but does not specify what details are returned, if there are any constraints (e.g., valid CIDR), or side effects. This is insufficient for a safe selection.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence, front-loaded with the purpose. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and zero annotations, the description is too brief. It does not explain output format, constraints, or the optional parameter's effect. Sibling tools exist but are not referenced to aid selection.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description should compensate. The parameters ip_address and cidr_prefix are self-explanatory, but include_ospf_command (default true) is ambiguousβit does not explain what including the OSPF command means. No added value beyond parameter names.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool generates OSPF wildcard mask details for a subnet, which distinguishes it from sibling tools like calculate_subnet (general subnet info), calculate_subnet_from_mask (subnet from mask), get_nth_usable_ip (specific IP), and validate_ip_in_subnet (membership check).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when OSPF wildcard mask is needed, but provides no explicit guidance on when to use this tool versus alternatives, nor any prerequisites or conditions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_nth_usable_ipC
Return the Nth usable IP address in a subnet.
| Name | Required | Description | Default |
|---|---|---|---|
| network | Yes | ||
| position | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so the description must disclose behavior. It only states 'Return' without specifying error handling, performance, or that it is a read-only computation. No mention of constraints like valid position range.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The single-sentence description is efficient and direct, but could be slightly expanded without losing conciseness to include critical context.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given two required parameters, no output schema, and no annotations, the description omits necessary details like input format, output format, and validation rules, making it incomplete for reliable use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description should compensate. It only hints at parameters via 'Nth' and 'subnet' but does not specify network format (e.g., CIDR) or position bounds. Adds minimal value beyond the parameter names.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool returns the Nth usable IP address in a subnet, with a specific verb and resource. However, it does not define 'usable' (e.g., excluding network/broadcast), which could cause ambiguity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus siblings like calculate_subnet or validate_ip_in_subnet. The description lacks context for appropriate usage scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate_ip_in_subnetC
Validate that an IP address belongs to a subnet and provide context.
| Name | Required | Description | Default |
|---|---|---|---|
| ip_address | Yes | ||
| network | Yes | ||
| return_gateway | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, and the description fails to disclose behavioral details beyond basic validation; 'provide context' is vague without specifics.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise but lacks necessary detail; it is a single sentence but not effective in conveying complete information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Without an output schema, the description fails to explain what 'context' is provided (e.g., whether gateway is returned), leaving the agent underinformed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, and the description does not explain parameter meanings or usage, relying solely on parameter names.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool validates an IP address in a subnet, distinguishing it from sibling tools that calculate subnets or get nth IPs.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives like calculate_subnet; lacks explicit context for selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v0.1.2- First observed
calculate_subnet - First observed
calculate_subnet_from_mask - First observed
calculate_wildcard_mask - First observed
get_nth_usable_ip - First observed
validate_ip_in_subnet
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
Validates PESEL/NIP/REGON/IBAN/Luhn/ISBN/EAN/SWIFT-BIC/VAT; RPN calc, date math, hashing, tokens
IP geolocation, ASN and network data, plus VPN, proxy and Tor detection. ASN tools need no key.
Unlock the power of IP geolocation with our tool! Whether you're a developer needing location data
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 gradedqualityDmaintenanceProvides verified IPv4 subnet calculations, IP analysis, and network diagram generation for AI tutoring systems via MCP.1MIT