MCP server for TLS certificate analysis via the Model Context Protocol
Project description
dcert (Python)
A Python MCP wrapper for the dcert Rust server.
Uses FastMCP to create a transparent proxy around the dcert-mcp Rust binary, exposing all TLS certificate tools via the Model Context Protocol. New tools added to the Rust binary are automatically available without any Python code changes.
Requirements
- Python 3.12+
- The
dcert-mcpRust binary is bundled in platform-specific wheels (no network access needed at runtime)
Installation
pip install dcert
Platform-specific wheels are available for:
- Linux x86_64 (Ubuntu 22.04+, glibc 2.35+)
- macOS Intel (x86_64)
- macOS Apple Silicon (ARM64)
A universal fallback wheel auto-downloads the binary on first use if no platform wheel matches.
Quick Start
As a server
from dcert import create_server
server = create_server()
server.run() # stdio mode (default)
As a client
import asyncio
from dcert import create_client
async def main():
async with create_client() as client:
tools = await client.list_tools()
print(f"Available tools: {len(tools)}")
result = await client.call_tool(
"analyze_certificate", {"target": "example.com"}
)
print(result)
asyncio.run(main())
Typed async tool wrappers
For production use with type safety, timeouts, and automatic reconnection:
import asyncio
from dcert.tools import DcertClient
async def main():
async with DcertClient(timeout=60.0) as dcert:
# Analyze a certificate
result = await dcert.analyze_certificate(target="example.com")
# Check expiry with custom threshold
expiry = await dcert.check_expiry(target="example.com", days=90)
# Get TLS connection details
info = await dcert.tls_connection_info(target="example.com")
# Export PEM chain
pem = await dcert.export_pem(target="example.com", output_path="chain.pem")
asyncio.run(main())
All 11 tools are available as typed async methods:
| Method | Description |
|---|---|
analyze_certificate() |
Decode and analyze TLS certificates |
check_expiry() |
Check certificate expiry within N days |
check_revocation() |
Check OCSP revocation status |
compare_certificates() |
Compare certificates between two targets |
tls_connection_info() |
Get TLS connection details (cipher, protocol, latency) |
export_pem() |
Export certificate chain as PEM |
verify_key_match() |
Verify private key matches a certificate |
convert_pfx_to_pem() |
Convert PKCS12/PFX to PEM files |
convert_pem_to_pfx() |
Convert PEM cert+key to PKCS12/PFX |
create_keystore() |
Create PKCS12 keystore (Java-compatible) |
create_truststore() |
Create PKCS12 truststore from CA certs |
Error handling
from dcert.tools import (
DcertClient,
DcertError, # Base exception
DcertTimeoutError, # Tool call timed out
DcertConnectionError,# Subprocess died
DcertToolError, # MCP tool returned an error
)
async with DcertClient(timeout=30.0, max_reconnects=3) as dcert:
try:
result = await dcert.analyze_certificate(target="example.com")
except DcertTimeoutError:
print("Tool call timed out")
except DcertToolError as e:
print(f"Tool error: {e} (tool={e.tool})")
except DcertConnectionError:
print("Binary subprocess crashed")
CLI
# stdio mode (default, for MCP clients like Claude Code)
dcert-python
# HTTP mode
dcert-python --transport http --host 0.0.0.0 --port 8080
# Pre-download binary (universal wheel only)
dcert-python --setup
# Explicit binary path
dcert-python --binary /usr/local/bin/dcert-mcp
Binary Discovery
The package locates the dcert-mcp Rust binary in this order:
DCERT_MCP_BINARYenvironment variable- Bundled binary in the package
bin/directory dcert-mcponPATH(platform wheels install the binary here)- Auto-download from GitHub Releases (universal wheel fallback, with SHA256 verification)
Environment Variables
The proxy forwards these environment variables to the Rust binary:
| Category | Variables |
|---|---|
| Proxy | HTTP_PROXY, HTTPS_PROXY, NO_PROXY (and lowercase variants) |
| TLS | SSL_CERT_FILE, SSL_CERT_DIR |
| dcert | DCERT_PATH, DCERT_MCP_TIMEOUT, DCERT_MCP_CONNECTION_TIMEOUT, DCERT_MCP_READ_TIMEOUT |
Scalability
This package uses the MCP proxy pattern: the Python layer never needs to know about individual dcert tools. All tool discovery, input schemas, and invocations are forwarded to the Rust binary via the MCP protocol at runtime. When new capabilities are added to the Rust server, they are immediately available through the Python wrapper.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dcert-3.0.28-py3-none-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: dcert-3.0.28-py3-none-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 8.0 MB
- Tags: Python 3, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9dd111376c9cb68671c23d1a43a155a99ec7beefdbfe9bfebbde1bade9c85bb
|
|
| MD5 |
3467cf3330689385c321f14d12294235
|
|
| BLAKE2b-256 |
7101f8499326db21ab89a9bb6e7513980315f5d77185b706c975dbce4b21e844
|
Provenance
The following attestation bundles were made for dcert-3.0.28-py3-none-manylinux_2_35_x86_64.whl:
Publisher:
ci.yml on SCGIS-Wales/dcert
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dcert-3.0.28-py3-none-manylinux_2_35_x86_64.whl -
Subject digest:
d9dd111376c9cb68671c23d1a43a155a99ec7beefdbfe9bfebbde1bade9c85bb - Sigstore transparency entry: 1060354152
- Sigstore integration time:
-
Permalink:
SCGIS-Wales/dcert@bb214366c7653e28cd2c87ef99d164d52b4b8c00 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/SCGIS-Wales
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@bb214366c7653e28cd2c87ef99d164d52b4b8c00 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dcert-3.0.28-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: dcert-3.0.28-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 7.3 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d82e9d3ecf04fbbb7b03588dfeb794a09c146ee6c320c72e5f8f0b92eb8fc7ce
|
|
| MD5 |
20fe09e36a604b05666c30083587a715
|
|
| BLAKE2b-256 |
fcacb8bc7fc87a0d4219c8019dd501fbc61610950310be44f381c8e44a8a7c8b
|
Provenance
The following attestation bundles were made for dcert-3.0.28-py3-none-macosx_11_0_arm64.whl:
Publisher:
ci.yml on SCGIS-Wales/dcert
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dcert-3.0.28-py3-none-macosx_11_0_arm64.whl -
Subject digest:
d82e9d3ecf04fbbb7b03588dfeb794a09c146ee6c320c72e5f8f0b92eb8fc7ce - Sigstore transparency entry: 1060354078
- Sigstore integration time:
-
Permalink:
SCGIS-Wales/dcert@bb214366c7653e28cd2c87ef99d164d52b4b8c00 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/SCGIS-Wales
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@bb214366c7653e28cd2c87ef99d164d52b4b8c00 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dcert-3.0.28-py3-none-macosx_10_15_x86_64.whl.
File metadata
- Download URL: dcert-3.0.28-py3-none-macosx_10_15_x86_64.whl
- Upload date:
- Size: 7.7 MB
- Tags: Python 3, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f1bd0f2f35797e378a1f7ada76c065136b27defc798bac2833098f82f7d79b0
|
|
| MD5 |
5611f108770e3329061eef89afae596a
|
|
| BLAKE2b-256 |
234fbe62e3c31354cdb22552d0028fc5e31fbf4e206d20dbd5bc3f659cbdfae1
|
Provenance
The following attestation bundles were made for dcert-3.0.28-py3-none-macosx_10_15_x86_64.whl:
Publisher:
ci.yml on SCGIS-Wales/dcert
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dcert-3.0.28-py3-none-macosx_10_15_x86_64.whl -
Subject digest:
3f1bd0f2f35797e378a1f7ada76c065136b27defc798bac2833098f82f7d79b0 - Sigstore transparency entry: 1060354008
- Sigstore integration time:
-
Permalink:
SCGIS-Wales/dcert@bb214366c7653e28cd2c87ef99d164d52b4b8c00 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/SCGIS-Wales
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@bb214366c7653e28cd2c87ef99d164d52b4b8c00 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dcert-3.0.28-py3-none-any.whl.
File metadata
- Download URL: dcert-3.0.28-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebc7bd128e5eee818e882e420183133dd964ce173bbeb211a0260e84b9a14cc1
|
|
| MD5 |
858e63809a161129a2427d3e95e259f1
|
|
| BLAKE2b-256 |
87e193be3d1d277e478b01d3d00bd99a7118bc74cfa000cda2b9f601b6a7578b
|
Provenance
The following attestation bundles were made for dcert-3.0.28-py3-none-any.whl:
Publisher:
ci.yml on SCGIS-Wales/dcert
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dcert-3.0.28-py3-none-any.whl -
Subject digest:
ebc7bd128e5eee818e882e420183133dd964ce173bbeb211a0260e84b9a14cc1 - Sigstore transparency entry: 1060354219
- Sigstore integration time:
-
Permalink:
SCGIS-Wales/dcert@bb214366c7653e28cd2c87ef99d164d52b4b8c00 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/SCGIS-Wales
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@bb214366c7653e28cd2c87ef99d164d52b4b8c00 -
Trigger Event:
push
-
Statement type: