dcert-mcp is a Model Context Protocol server that gives AI assistants the dcert certificate and TLS tools. The server is a prebuilt Rust executable (dcert-mcp), installed as a wheel script, so starting it runs no Python. The optional proxy extra adds a FastMCP proxy, typed async client and the dcert-mcp-proxy command. Tools added to the Rust server are discovered at runtime, so the Python layer never needs to change.
This package is separate from dcert, the command line tool. Installing dcert-mcp pulls in dcert at the same version and nothing else.
Requires Python 3.12 or later. Wheels exist for Linux x86_64 (glibc 2.34 or later: RHEL 9, Ubuntu 22.04, Debian 12 and later), macOS Intel, macOS Apple Silicon and Windows x86_64. Only these platform wheels are published, so an install from PyPI, a private mirror or a downloaded wheel never fetches anything from GitHub. On any other platform pip reports "no matching distribution"; build the binaries from source and point DCERT_MCP_BINARY at the server.
For a reproducible install of the extra, requirements/proxy.txt (and otel.txt for [proxy,otel]) in the repository pins every package with hashes for all platforms: pip install --require-hashes -r proxy.txt next to pip install dcert-mcp.
Without the extra, the Rust server works on its own (dcert-mcp speaks MCP over stdio, or HTTP with --mode http). The Python helpers below need the extra: importing one without it fails with a single line naming it, for example dcert_mcp needs the optional package 'fastmcp'. Install it with: pip install "dcert-mcp[proxy]".
from dcert_mcp import create_server create_server().run() # stdio transport As a client import asyncio from dcert_mcp import create_client async def main() -> None: async with create_client() as client: tools = await client.list_tools() result = await client.call_tool("analyze_certificate", {"target": "example.com"}) print(len(tools), result) asyncio.run(main()) Typed async tool functions The functional API opens a session (a subprocess plus its resilience stack) and passes it to plain async functions:
import asyncio from dcert_mcp import analyze_certificate, check_expiry, create_session, export_pem async def main() -> None: async with create_session(timeout=60.0) as session: cert = await analyze_certificate(target="example.com", session=session) expiry = await check_expiry(target="example.com", days=90, session=session) pem = await export_pem(target="example.com", output_path="chain.pem", session=session) raw = await session.call("tls_connection_info", {"target": "example.com"}) asyncio.run(main()) Leaving out session uses a shared default session that is created on first use and reused afterwards; close_default_session() shuts it down. The shared session belongs to the event loop that created it: a later asyncio.run() gets a fresh one, and calling close_default_session() before a loop ends releases the subprocess cleanly.
Every other tool has a wrapper generated from the server's tool schema (dcert_mcp.generated_tools, regenerated by scripts/gen_typed_tools.py and checked in CI): create_csr(), diagnose_endpoint(), explain_edge_term(), validate_certificate(), validate_csr(), vault_issue(), vault_list(), vault_renew(), vault_revoke(), vault_sign(), vault_store(), vault_validate(), verify_key_auto_discover(). Their keyword arguments are the tool's parameters; diagnose_endpoint(timeout_=...) is the tool's connection timeout, because timeout is the per call timeout of every wrapper.
The network facing functions accept the shared mTLS and connection options (client_cert, client_key, pkcs12, cert_password, ca_cert, connect_to, resolve, proxy, noproxy) as keyword arguments.
from dcert_mcp import ( DcertError, # base class DcertTimeoutError, # the call exceeded its timeout DcertConnectionError, # the subprocess died or the circuit breaker is open DcertToolError, # the tool returned an error result (has .tool) ) Only transport failures are retried, with exponential backoff and full jitter, and only for tools whose MCP annotations mark them read-only or idempotent (the typed client reads the backend's tool list once per session to decide). TypeError and ValueError surface immediately and cancellation is never swallowed. A call that times out closes the subprocess (it is reconnected on the next call) and counts against the circuit breaker; concurrent calls that fail together share one reconnect and count as one failure.
dcert-mcp-proxy # stdio (for MCP clients such as Claude Code) dcert-mcp-proxy --transport http --port 8080 # HTTP; needs DCERT_MCP_AUTH_TOKEN or OIDC dcert-mcp-proxy --binary /usr/local/bin/dcert-mcp # explicit binary dcert-mcp-proxy --rate-limit 20 --bulkhead-max 4 # resilience flags dcert-mcp-proxy --help # every option HTTP and SSE mode refuse to start without authentication: a static bearer token of at least 32 characters (--auth-token or, better, DCERT_MCP_AUTH_TOKEN, compared in constant time) or an OIDC configuration (--oidc-issuer, --oidc-audience, --oidc-jwks-uri or DCERT_MCP_OIDC_ISSUER, DCERT_MCP_OIDC_AUDIENCE, DCERT_MCP_OIDC_JWKS_URL, all https). Requests whose Host header is not a loopback name, the bind address or an entry from --allowed-hosts are answered 400, which defeats DNS rebinding from a browser.
The proxy forwards only the environment variables listed under subprocess.passthrough_env in config.yaml to dcert-mcp: proxy and CA settings, TMPDIR, XDG_CACHE_HOME, DCERT_PROXY, DCERT_NOPROXY, DCERT_KB_FILE, every DCERT_MCP_* policy variable and the VAULT_ADDR, VAULT_TOKEN, VAULT_CACERT, VAULT_CAPATH and VAULT_SKIP_VERIFY settings. An entry ending in * matches by prefix.
dcert-mcp and dcert are the Rust executables themselves, so no Python wrapper sits in front of them.
Defaults live in the packaged dcert_mcp/config.yaml: the environment variables forwarded to the subprocess, the server bind address, the transports and exporters offered by dcert-mcp-proxy, and every resilience value. dcert_mcp.load_config() returns them as an immutable record.
Resilience values can be overridden with DCERT_MCP_* environment variables (listed in dcert_mcp/resilience.py) and the dcert-mcp-proxy flags override those. A value outside its valid range (for example DCERT_MCP_CB_THRESHOLD=0 or DCERT_MCP_BULKHEAD_MAX=0) is rejected with a message naming the variable rather than crashing or hanging later. DCERT_MCP_NO_RETRY disables retries in both the proxy and the typed client, and DCERT_MCP_CONNECT_TIMEOUT bounds how long starting the subprocess and reading its tool list may take.
The proxy reads each tool's MCP annotations before applying caching or retries:
The proxy starts dcert-mcp with only these variables from its own environment (subprocess.passthrough_env in config.yaml); everything else is dropped. An entry ending in * forwards every variable with that prefix.
DCERT_MCP_* covers the server's own settings, for example DCERT_MCP_TIMEOUT, DCERT_MCP_CONNECTION_TIMEOUT, DCERT_MCP_READ_TIMEOUT and DCERT_MCP_ALLOWED_TARGETS.
The package has no build backend of its own: CI builds the wheels with scripts/build_wheels.py, so pip install -e does not apply. Tests run from the source tree (pythonpath = ["src"] in the pytest configuration) with the extras' requirements installed:
# From the repository root, build the server the integration tests start cargo build --release --bin dcert-mcp --features mcp export DCERT_MCP_BINARY="$PWD/target/release/dcert-mcp" cd python/dcert-mcp # The requirements of the proxy, otel and dev extras, hash pinned, exactly as CI installs them pip install --require-hashes -r requirements/dev.txt # or: uv venv && uv pip install -r requirements/dev.txt # The same checks as CI ruff check src tests ../../scripts ruff format --check src tests ../../scripts mypy pytest -q Without DCERT_MCP_BINARY (or a compiled dcert-mcp on PATH) the integration tests are skipped.
All 4 files in this release have provenance metadata.
tls certificate x509 mcp model-context-protocol fastmcp ai-tools security
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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 verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
All 4 files in this release have been uploaded with provenance metadata.
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.
Nov 21, 2026 4 release files Full provenance
Nov 20, 2026 4 release files Full provenance




