phpipam-mcp-server
This MCP server lets you query and manage phpIPAM IP address management and network infrastructure data through MCP tools, plus an agent-friendly CLI, over stdio or authenticated streaming HTTP.
List and inspect IP sections, subnets, VLANs, VRFs, locations, and DNS nameservers.
Search for IP addresses, hostnames including wildcards, and subnets by CIDR or description.
Retrieve detailed subnet information, optionally including limited IP address listings and usage statistics.
Create subnets, reserve IP addresses, and update or delete IP address records.
Update or delete subnets, with subnet deletion also removing all contained IP addresses.
Use context-optimized defaults and configurable limits to keep output manageable.
Run locally via stdio or remotely via streamable HTTP with bearer-token auth, a health endpoint, and optional per-client phpIPAM credentials.
Use the
phpipamCLI as an automation fallback with--jsonoutput, stable exit codes, and confirmation-gated writes.
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., "@phpipam-mcp-server Show me subnets in section 1"
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.
phpIPAM MCP Server
Model Context Protocol server for phpIPAM IP address management and network infrastructure.
Installation
Prerequisites
Python 3.10+
phpIPAM instance with API access
App configured in phpIPAM with "SSL with App Code token" security
From PyPI (when published)
pip install phpipam-mcp-serverFrom Source
git clone https://github.com/InfraMCP/phpipam-mcp-server.git
cd phpipam-mcp-server
pip install -e .Development Installation
pip install -e ".[dev]"Related MCP server: io.github.antonio-mello-ai/mcp-pfsense
Command-line interface (phpipam)
Alongside the MCP server, the package ships an agent-friendly CLI called
phpipam. It talks to the same phpIPAM API without any MCP machinery, which
makes it a reliable fallback when an MCP transport is awkward to wire up (for
example, when a host does not pass the server's environment through cleanly).
It is built for automation:
--jsonon every command for machine-readable output. In JSON mode, success prints{"ok": true, "data": ...}to stdout and any error prints{"ok": false, "error": {"kind": ..., "message": ...}}to stderr.Stable, documented exit codes so a script or agent can branch on the result without parsing text:
Code
Meaning
0
success
1
phpIPAM API / network error
2
usage error (bad arguments)
3
configuration error (missing credentials)
4
authentication rejected by phpIPAM
5
resource not found
6
refused: a write was requested without
--yesSafe by default. Read commands run immediately. Every write command (
create-subnet,reserve-ip,update-ip,delete-ip,update-subnet,delete-subnet) refuses to run unless--yesis passed, printing exactly what it would do first.
Credentials
The CLI resolves credentials from the same environment variables as the server, or from flags (flags win):
export PHPIPAM_URL="https://ipam.example.com/"
export PHPIPAM_APP_ID="my-app-id"
export PHPIPAM_APP_CODE="my-app-code-token"
# ...or pass --url / --app-id / --app-code on any command.Prefer the environment variables for the app code. A value passed via
--app-codeis visible in the host's process list.
Examples
# List sections (human-readable)
phpipam sections
# Same, as JSON for a script to parse
phpipam --json sections
# Subnets in section 3, capped at 5 rows
phpipam subnets 3 --limit 5
# Find an address
phpipam search-address 10.0.0.1
# A write is refused unless confirmed (exit code 6)
phpipam delete-subnet 42
# error (refused): refusing to run a write operation without confirmation.
# would: DELETE subnet 42 (this removes ALL IP addresses in the subnet)
# re-run with --yes to proceed.
# Confirmed write
phpipam create-subnet 3 192.168.50.0 24 --description "lab" --yesRun phpipam --help or phpipam <command> --help for the full list.
Usage
The server supports two transports, selected with the MCP_TRANSPORT environment
variable:
Transport |
| Use case |
Local (default) |
| Launched by the MCP client on the same machine |
Remote |
| Runs as an HTTP service behind a TLS reverse proxy |
Local (stdio)
The default transport. The MCP client starts the server as a subprocess, so no
MCP_TRANSPORT value is required. Add to your MCP client configuration:
{
"mcpServers": {
"phpipam": {
"command": "phpipam-mcp-server",
"env": {
"PHPIPAM_URL": "https://ipam.example.com/",
"PHPIPAM_APP_ID": "your_app_id",
"PHPIPAM_APP_CODE": "your_app_code_token"
}
}
}
}Remote (streaming HTTP)
Set MCP_TRANSPORT=streamable-http to run the server as a long-lived HTTP
service that any streamable-http capable MCP client can reach at a URL such as
https://phpipam.example.com/mcp. This mode is intended to run behind a reverse
proxy that terminates TLS (see DEPLOYMENT.md for a full
Docker + Caddy walkthrough).
Key differences from stdio mode:
The MCP endpoint is served at
MCP_PATH(default/mcp).A static bearer token (
MCP_BEARER_TOKEN) protects the endpoint. Clients must sendAuthorization: Bearer <token>.phpIPAM credentials can be supplied per client via
X-phpIPAM-*HTTP headers, falling back to the server-widePHPIPAM_*environment variables.An unauthenticated
/healthendpoint is exposed for liveness probes.
Configuration (environment variables):
Variable | Default | Description |
|
| Set to |
|
| Bind address (HTTP mode) |
|
| Bind port (HTTP mode) |
|
| Path for the MCP endpoint |
| — | Required token for |
| — | Server-wide phpIPAM URL (fallback) |
| — | Server-wide phpIPAM App ID (fallback) |
| — | Server-wide phpIPAM App Code (fallback) |
|
| Verify TLS to phpIPAM |
Run it locally:
export MCP_TRANSPORT=streamable-http
export MCP_BEARER_TOKEN="$(openssl rand -hex 32)"
export PHPIPAM_URL="https://ipam.example.com/"
export PHPIPAM_APP_ID="your_app_id"
export PHPIPAM_APP_CODE="your_app_code_token"
phpipam-mcp-serverGenerate a strong token with openssl rand -hex 32. Never expose the endpoint
over plain HTTP — always place it behind HTTPS.
MCP client configuration (remote):
{
"mcpServers": {
"phpipam": {
"type": "http",
"url": "https://phpipam.example.com/mcp",
"headers": {
"Authorization": "Bearer <MCP_BEARER_TOKEN>",
"X-phpIPAM-URL": "https://ipam.example.com/",
"X-phpIPAM-App-Id": "your_app_id",
"X-phpIPAM-App-Code": "your_app_code_token"
}
}
}
}If you configure shared phpIPAM credentials on the server (via PHPIPAM_*),
omit the X-phpIPAM-* headers and send only Authorization.
Quick test:
# Health check (no auth required)
curl https://phpipam.example.com/health
# -> {"status":"ok"}
# Without a token the MCP endpoint returns 401
curl -i https://phpipam.example.com/mcpAvailable Tools
list_sections(include_fields="")
List all IP sections from phpIPAM.
include_fields: Comma-separated fields or "all" for complete data
get_section_subnets(section_id, include_usage=True, include_fields="", limit=20)
Get subnets within a specific section.
section_id: Section ID to queryinclude_usage: Include usage statistics (default: True)include_fields: Field filtering optionslimit: Maximum results to return (default: 20, max: 1000)
search_addresses(ip_or_hostname, limit=10)
Search for IP addresses or hostnames.
ip_or_hostname: IP address or hostname to search forlimit: Maximum results to return (default: 10, max: 1000)
search_hostname(hostname, limit=10)
Search for IP addresses by exact or partial hostname. Supports * wildcards.
hostname: Hostname to search for (e.g.,server01orweb-*)limit: Maximum results to return (default: 10, max: 50)
get_subnet_details(subnet_id, include_addresses=False, address_limit=10)
Get detailed subnet information.
subnet_id: Subnet ID to queryinclude_addresses: Include IP addresses in subnet (default: False)address_limit: Maximum addresses to show (default: 10, max: 1000)
list_vlans(domain_id=None, limit=20)
List VLANs from phpIPAM.
domain_id: Optional domain ID filterlimit: Maximum results to return (default: 20, max: 1000)
list_vrfs(limit=20)
List VRF instances from phpIPAM.
limit: Maximum results to return (default: 20, max: 1000)
list_locations(limit=20)
List physical locations for network infrastructure.
limit: Maximum results to return (default: 20, max: 1000)
list_nameservers(limit=20)
List DNS nameservers with configuration details.
limit: Maximum results to return (default: 20, max: 1000)
search_subnets(query, limit=10)
Search subnets by CIDR, description, or other criteria.
query: Search term (CIDR, description, etc.)limit: Maximum results to return (default: 10, max: 1000)
Write Operations
create_subnet(section_id, subnet, mask, *, description="", vlan_id=None)
Create a new subnet in phpIPAM.
section_id: Section ID where subnet will be createdsubnet: Network address (e.g., "192.168.1.0")mask: Subnet mask (e.g., "24")description: Optional description for the subnetvlan_id: Optional VLAN ID
reserve_ip_address(subnet_id, ip=None, hostname="", description="", owner="")
Reserve an IP address in a subnet.
subnet_id: Subnet ID where IP will be reservedip: Specific IP address to reserve (optional - will find first available)hostname: Hostname for the IP addressdescription: Description for the IP addressowner: Owner of the IP address
update_ip_address(address_id, hostname=None, description=None, owner=None)
Update an existing IP address record.
address_id: ID of the IP address to updatehostname: New hostname (optional)description: New description (optional)owner: New owner (optional)
delete_ip_address(address_id)
Delete/release an IP address reservation.
address_id: ID of the IP address to delete
update_subnet(subnet_id, description=None, vlan_id=None, vrf_id=None)
Update an existing subnet.
subnet_id: ID of the subnet to updatedescription: New description (optional)vlan_id: New VLAN ID (optional)vrf_id: New VRF ID (optional)
delete_subnet(subnet_id)
Delete a subnet (WARNING: This will delete all IP addresses in the subnet).
subnet_id: ID of the subnet to delete
Configuration
phpIPAM Setup
Create an API application in phpIPAM admin interface
Set security to "SSL with App Code token"
Note the App ID and App Code
Set appropriate permissions for the application
Authentication
This server uses static app code token authentication:
No token expiration
Simple configuration
Secure over HTTPS
Development
Code Quality
# Run pylint
python -m pylint src/phpipam_mcp_server/
# Run tests (when available)
python -m pytest
# Format code
python -m black src/
python -m isort src/Project Structure
src/phpipam_mcp_server/
├── __init__.py # Package initialization
└── server.py # Main MCP server implementationAPI Documentation
See the docs/ directory for detailed API documentation:
api-overview.md- General API informationcontrollers.md- Available endpoints and data structuresexamples.md- Request/response examplesmcp-design.md- MCP server design and architecture
License
MIT License - see LICENSE file for details.
Contributing
Fork the repository
Create a feature branch
Make changes with tests
Run code quality checks
Submit a pull request
Support
GitHub Issues: https://github.com/InfraMCP/phpipam-mcp-server/issues
Documentation: https://github.com/InfraMCP/phpipam-mcp-server#readme
Available Tools
16 toolscreate_subnetA
Create a new subnet in phpIPAM.
Args: section_id: Section ID where subnet will be created subnet: Network address (e.g., "192.168.1.0") mask: Subnet mask (e.g., "24") description: Optional description for the subnet vlan_id: Optional VLAN ID
Inputs: mask (required), subnet (required), section_id (required), vlan_id, +1 more. Returns: result
delete_ip_addressB
Delete/release an IP address reservation.
Args: address_id: ID of the IP address to delete
Inputs: address_id (required). Returns: result
delete_subnetA
Delete a subnet (WARNING: This will delete all IP addresses in the subnet).
Args: subnet_id: ID of the subnet to delete
Inputs: subnet_id (required). Returns: result
get_section_subnetsA
Get subnets within a specific section.
CONTEXT OPTIMIZATION: Limited to 20 results by default. Use limit parameter to control output size.
Args: section_id: Section ID to get subnets from include_usage: Include usage statistics (default: True) include_fields: Comma-separated fields to include (default: essential only) limit: Maximum number of subnets to return (default: 20, max: 1000)
Inputs: section_id (required), limit, include_usage, include_fields. Returns: result
get_subnet_detailsA
Get detailed information about a specific subnet.
CONTEXT OPTIMIZATION: Address listing limited to 10 by default.
Args: subnet_id: Subnet ID to get details for include_addresses: Include IP addresses in the subnet (default: False) address_limit: Max addresses to show if include_addresses=True (default: 10)
Inputs: subnet_id (required), address_limit, include_addresses. Returns: result
list_locationsA
List physical locations from phpIPAM.
CONTEXT OPTIMIZATION: Limited to 20 results by default.
Args: limit: Maximum number of locations to return (default: 20, max: 1000)
Inputs: limit. Returns: result
list_nameserversA
List DNS nameservers from phpIPAM.
CONTEXT OPTIMIZATION: Limited to 20 results by default.
Args: limit: Maximum number of nameservers to return (default: 20, max: 1000)
Inputs: limit. Returns: result
list_sectionsA
List all IP sections from phpIPAM.
CONTEXT OPTIMIZATION: Returns essential fields only by default. Use include_fields="all" for complete data.
Args: include_fields: Comma-separated fields to include (default: essential only) Use "all" for complete data
Inputs: include_fields. Returns: result
list_vlansA
List VLANs from phpIPAM.
CONTEXT OPTIMIZATION: Limited to 20 results by default.
Args: domain_id: Optional domain ID to filter VLANs limit: Maximum number of VLANs to return (default: 20, max: 1000)
Inputs: limit, domain_id. Returns: result
list_vrfsA
List VRF instances from phpIPAM.
CONTEXT OPTIMIZATION: Limited to 20 results by default.
Args: limit: Maximum number of VRFs to return (default: 20, max: 1000)
Inputs: limit. Returns: result
reserve_ip_addressA
Reserve an IP address in a subnet.
Args: subnet_id: Subnet ID where IP will be reserved ip: Specific IP address to reserve (optional - will find first available) hostname: Hostname for the IP address description: Description for the IP address owner: Owner of the IP address
Inputs: subnet_id (required), ip, owner, hostname, +1 more. Returns: result
search_addressesB
Search for IP addresses or hostnames in phpIPAM.
CONTEXT OPTIMIZATION: Limited to 10 results by default.
Args: ip_or_hostname: IP address or hostname to search for limit: Maximum number of results to return (default: 10, max: 1000)
Inputs: ip_or_hostname (required), limit. Returns: result
search_hostnameA
Search for IP addresses by exact or partial hostname in phpIPAM.
CONTEXT OPTIMIZATION: Limited to 10 results by default.
Args: hostname: Hostname to search for limit: Maximum number of results to return (default: 10, max: 50)
Inputs: hostname (required), limit. Returns: result
search_subnetsB
Search subnets by CIDR, description, or other criteria.
CONTEXT OPTIMIZATION: Limited to 10 results by default.
Args: query: Search term (CIDR, description, etc.) limit: Maximum number of results to return (default: 10, max: 1000)
Inputs: query (required), limit. Returns: result
update_ip_addressC
Update an existing IP address record.
Args: address_id: ID of the IP address to update hostname: New hostname (optional) description: New description (optional) owner: New owner (optional)
Inputs: address_id (required), owner, hostname, description. Returns: result
update_subnetC
Update an existing subnet.
Args: subnet_id: ID of the subnet to update description: New description (optional) vlan_id: New VLAN ID (optional) vrf_id: New VRF ID (optional)
Inputs: subnet_id (required), vrf_id, vlan_id, description. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools are clearly distinct, targeting different resources and actions. The main overlap is between search_addresses and search_hostname, but their descriptions differentiate them (IP/hostname vs hostname only). Some potential confusion between search_subnets and get_section_subnets, but the former uses a query while the latter is section-based.
All tool names follow a consistent verb_noun pattern with snake_case (e.g., list_sections, create_subnet, delete_ip_address). The verbs (list, get, search, create, update, delete, reserve) are used predictably, making the set highly intuitive.
With 16 tools, the server is slightly above the typical well-scoped range of 3-15, but still manageable. Each tool serves a clear purpose in IP address management, and the count is not excessive or insufficient.
The tool set covers CRUD for subnets and IP addresses, plus listing for sections, nameservers, VLANs, VRFs, and locations. Minor gaps include no update/create/delete for VLANs, VRFs, or locations, and no explicit get-by-ID for IP addresses, but these are likely outside the primary scope and search tools compensate.
Maintenance
Related MCP Connectors
Open-source IP address and CIDR tools for network calculations and public IP lookup.
IP address utilities MCP.
IP intelligence, network diagnostics, and AI service availability tools for AI agents.
Official IPinfo MCP Server - IP intelligence tools for AI assistants
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables comprehensive interaction with NetBox infrastructure management through both read and write operations. Supports full CRUD operations for devices, IP addresses, sites, racks, and other NetBox objects through natural language commands.918Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI assistants to manage pfSense firewalls using 17 tools for system status, firewall rules, DHCP, DNS, monitoring, and service management via the pfSense REST API.2050 PyPI8MIT
- AlicenseAqualityDmaintenanceEnables LLMs to manage IP addresses, subnets, and network sections through natural language, with security features like read-only by default.13MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to interact with the Netdisco network management platform through its complete REST API, supporting device inspection, port queries, VLAN searches, and job management.MIT