Skip to content

Configuration

pcp_mcp.config

Configuration for the PCP MCP server.

PCPMCPSettings

Bases: BaseSettings

Configuration for the PCP MCP server.

Attributes:

Name Type Description
host str

pmproxy host.

port int

pmproxy port.

use_tls bool

Use HTTPS for pmproxy connection.

timeout float

Request timeout in seconds.

target_host str

Target pmcd host to monitor (can be remote hostname).

username str | None

HTTP basic auth user.

password str | None

HTTP basic auth password.

auth property

auth: tuple[str, str] | None

Auth tuple for httpx, or None if no auth configured.

base_url property

base_url: str

URL for connecting to pmproxy.

verify property

verify: bool | str

TLS verification setting for httpx.

Returns:

Type Description
bool | str

False if verification disabled, path to CA bundle if specified,

bool | str

or True for default system verification.

is_host_allowed

is_host_allowed(host: str) -> bool

Check if a host is allowed by the allowlist.

Parameters:

Name Type Description Default
host str

The hostspec to validate.

required

Returns:

Type Description
bool

True if the host is allowed, False otherwise.

Source code in src/pcp_mcp/config.py
def is_host_allowed(self, host: str) -> bool:
    """Check if a host is allowed by the allowlist.

    Args:
        host: The hostspec to validate.

    Returns:
        True if the host is allowed, False otherwise.
    """
    # Always allow the configured target_host
    if host == self.target_host:
        return True

    # If no allowlist configured, only target_host is allowed
    if self.allowed_hosts is None:
        return False

    # Wildcard allows everything
    if "*" in self.allowed_hosts:
        return True

    # Check exact match in allowlist
    return host in self.allowed_hosts