Skip to main content
Glama
sanjayshreeyans

subnet-calculator-mcp

Subnet Calculator MCP Server

CI PyPI Downloads 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.server

Run instantly (no install)

uvx subnet-calculator-mcp

Install as a reusable CLI

uv tool install subnet-calculator-mcp
# later
subnet-calculator-mcp

Client 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), optional return_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), optional include_ospf_command (bool).

  • Returns: network address, mask, wildcard mask, binary wildcard string, and optional network ... area 0 statement.

  • Use it for: creating OSPF configurations or ACLs that rely on wildcard masks.

validate_ip_in_subnet

  • Inputs: ip_address, network (CIDR string), optional return_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 build

License

MIT License – see LICENSE for details.

Available Tools

5 tools
calculate_subnetC

Calculate subnet details given a base IP and required hosts.

ParametersJSON Schema
NameRequiredDescriptionDefault
network_baseYes
hosts_neededYes
return_formatNodetailed

TDQS

C2.7/5.0
Behavior2/5

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.

Conciseness4/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
ip_addressYes
subnet_maskYes

TDQS

C2.8/5.0
Behavior2/5

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.

Conciseness3/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines3/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
ip_addressYes
cidr_prefixYes
include_ospf_commandNo

TDQS

B3.3/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
networkYes
positionYes

TDQS

C2.7/5.0
Behavior2/5

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.

Conciseness4/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
ip_addressYes
networkYes
return_gatewayNo

TDQS

C2.9/5.0
Behavior2/5

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.

Conciseness3/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose5/5

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.

Usage Guidelines2/5

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.

  1. 5 tool updatesv0.1.2
    • First observedcalculate_subnet
    • First observedcalculate_subnet_from_mask
    • First observedcalculate_wildcard_mask
    • First observedget_nth_usable_ip
    • First observedvalidate_ip_in_subnet

TDQS

B3.4/5.0

Scored across 5 tools

Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count5/5

With 5 tools, the server is well-scoped for a subnet calculator. Each tool serves a necessary function without redundancy or bloat.

Completeness4/5

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

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables 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
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides network utility tools including DNS lookup, WHOIS lookup, SPF record inspection, SSL/TLS certificate checking, and subnet/CIDR analysis powered by networkcalc.com services.
    1
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Provides accurate IPv4 subnet and address tools for LLMs using Python's ipaddress library. Includes CIDR parsing, overlap detection, IP classification, and more.
    11
    GPL 3.0