A Model Context Protocol (MCP) server with tools for IP validation and filtering using FastMCP.
- IP address validation tool supporting both IPv4 and IPv6
- Configurable CIDR range checking for IP filtering
- Tor exit node detection capability
- Simple interface via MCP for use with AI assistants
- Install dependencies:
yarn install- Start the server:
# Start with stdio transport (default)
yarn start
# Test with FastMCP CLI tool
yarn dev
# Inspect with FastMCP Inspector
yarn inspectThe main tool provided by this server is the IP filtering functionality:
- Validates both IPv4 and IPv6 addresses
- Checks if an IP is within specified CIDR ranges
- Detects if an IP is a Tor exit node (optional)
- Handles IPv4-mapped IPv6 addresses for compatibility
ip_address: IPv4 or IPv6 address to check (string)cidr_ranges: Array of CIDR ranges to validate against (string[])check_tor: Whether to check if the IP is a Tor exit node (boolean, default: false)
{
"ip_address": "192.168.1.1",
"cidr_ranges": ["192.168.0.0/16", "10.0.0.0/8"],
"check_tor": true
}To use this server with Claude Desktop or other AI assistants that support MCP, follow the MCP Quickstart Guide and add the following configuration:
{
"mcpServers": {
"ip-filter-mcp": {
"command": "yarn",
"args": [
"tsx",
"/path/to/your/ip-filter-mcp/src/index.ts"
],
"env": {
"TRANSPORT_TYPE": "stdio"
}
}
}
}Replace /path/to/your/ip-filter-mcp with the actual path to your project directory.