node804-mcp-toolkit
Shared utilities for building token-efficient, security-conscious MCP servers for IT operations. Provides the cross-cutting concerns every ops MCP needs — permission gating, audit logging, response shaping, TLS config — so each server in a suite implements them the same way.
Installation
pip install node804-mcp-toolkit
What's in here
| Module | Purpose |
|---|---|
rbac |
Hierarchical permission modes (read / standard / full / admin); a gate decorator that only registers tools with the MCP server when the active mode qualifies — ungated tools are invisible to the AI client, not just blocked |
audit |
JSON-lines audit logging of every tool call with timing, success/error state, sensitive-key redaction, and long-value truncation |
lean |
Pure response-shaping helpers: field whitelisting, internal-key stripping, pagination, server-side pattern filtering |
tls |
Verify-by-default TLS config from env vars, with custom CA bundle support for internal PKI |
params |
Shared Pydantic parameter types (VerboseFlag, FieldsList, Pagination, Pattern) so every tool uses the same names, defaults, and descriptions |
Quick start
Gate tools by permission mode, with audit logging composed in:
from mcp.server.fastmcp import FastMCP
from node804_mcp_toolkit import Mode, ModeGate, open_sink
mcp = FastMCP("panos-mcp")
# Audit sink: writes JSONL when PANOS_AUDIT_LOG is set, no-op otherwise.
sink = open_sink(env_var="PANOS_AUDIT_LOG")
# Mode comes from env. Missing or invalid values fail safe to read-only.
gate = ModeGate.from_env(env_var="PANOS_MODE", audit_sink=sink)
@gate.tool(mcp, required=Mode.READ)
async def get_security_rules(...): ...
@gate.tool(mcp, required=Mode.ADMIN)
async def commit(...): ... # not registered at all unless PANOS_MODE=admin
Shape responses for token efficiency:
from node804_mcp_toolkit import filter_by_pattern, paginate, strip_keys, whitelist
rules = strip_keys(raw_rules, ["@uuid", "@loc"]) # drop SDK internals
rules = filter_by_pattern(rules, pattern, name_field="name")
rules = paginate(rules, limit=100, offset=0)
rules = whitelist(rules, ["name", "action", "source", "destination"])
Resolve TLS settings from environment (verify-by-default):
from node804_mcp_toolkit import resolve_tls_config
import httpx, os
tls = resolve_tls_config(dict(os.environ), prefix="PRTG")
# PRTG_TLS_VERIFY=false → verify off, with a loud stderr warning
# PRTG_TLS_CA=/path.pem → custom CA bundle for internal PKI
client = httpx.Client(verify=str(tls.ca_path) if tls.ca_bundle else tls.verify)
Design philosophy
- One toolkit, one set of patterns. A user who learns the parameter conventions in any one MCP —
verbose,fields,limit,offset,pattern— gets the same conventions in all of them. - Default deny. Unset or misconfigured mode env vars fall back to read-only. Tools above the active mode are never registered, so the AI client can't even see them.
- Token-lean by default. Responses expose the fields the AI actually reasons over;
verbose=trueopts into the full payload. - Best-effort observability. Audit logging never breaks a tool call — sink failures warn once to stderr and move on.
Used by
node804-panos-mcp— Palo Alto firewall managementnode804-freshservice-mcp— Freshservice ticketing- Planned: PRTG and Veeam MCPs
Development
pip install -e ".[dev]"
pytest
ruff check .
mypy src
Requires Python 3.11+. Fully typed (py.typed included), mypy --strict clean.
License
Metadata
Release files for node804-mcp-toolkit 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| node804_mcp_toolkit-0.1.0.tar.gz | 21.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| node804_mcp_toolkit-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.3 kB
Release files / node804_mcp_toolkit-0.1.0.tar.gz
| Download URL | node804_mcp_toolkit-0.1.0.tar.gz |
|---|---|
| Size | 21.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
250b26bb6a434ea906641c9a17cecc84c804a6237fd151c2f3effecfab7a7e44
|
|
BLAKE2b-256 checksum How to use checksums |
bcb45def9338b8978a403ed68decce10ad0387905287f969238b438adf20b92c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.
Transparency logRelease files / node804_mcp_toolkit-0.1.0-py3-none-any.whl
| Download URL | node804_mcp_toolkit-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ac47ea1e4a3b43b130dec6834bb7dc6d79563500a7ae2c2448d01b5ec73b4de
|
|
BLAKE2b-256 checksum How to use checksums |
8307ceb3648b9798bff9ddcac50a7b6f1a8600de56273a802f4aa8286beae6fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.
Transparency logSecurity for node804-mcp-toolkit 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for node804_mcp_toolkit-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.