mcp-technical-verification 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ """
2
+ Deterministic Technical Verification MCP Python Client SDK
3
+ Official Client for Autonomous AI Agents (LangChain, CrewAI, AutoGen, LlamaIndex)
4
+ """
5
+
6
+ from .client import TechnicalVerificationClient
7
+
8
+ __version__ = "1.0.0"
9
+ __all__ = ["TechnicalVerificationClient"]
@@ -0,0 +1,52 @@
1
+ """
2
+ CLI entry point for Python mcp-technical-verification SDK
3
+ """
4
+
5
+ import sys
6
+ import json
7
+ import argparse
8
+ from .client import TechnicalVerificationClient
9
+
10
+ def main():
11
+ parser = argparse.ArgumentParser(description="Deterministic Technical Verification Client CLI")
12
+ subparsers = parser.add_subparsers(dest="command")
13
+
14
+ # verify
15
+ verify_parser = subparsers.add_parser("verify", help="Audit complete infrastructure health for a domain")
16
+ verify_parser.add_argument("domain", help="Target domain (e.g. cloudflare.com)")
17
+ verify_parser.add_argument("--webhook", help="Webhook URL to probe", default=None)
18
+ verify_parser.add_argument("--port", type=int, default=443, help="SSL Port")
19
+ verify_parser.add_argument("--min-score", type=int, default=70, help="Minimum acceptable score")
20
+
21
+ # webhook
22
+ webhook_parser = subparsers.add_parser("webhook", help="Probe webhook reachability and status")
23
+ webhook_parser.add_argument("url", help="Target webhook URL (e.g. https://httpbin.org/status/200)")
24
+
25
+ args = parser.parse_args()
26
+ client = TechnicalVerificationClient()
27
+
28
+ if args.command == "verify":
29
+ print(f"\nšŸ” Auditing infrastructure for: {args.domain}")
30
+ res = client.audit_complete_infrastructure_health(domain=args.domain, port=args.port, webhook_url=args.webhook)
31
+ score = res.get("reliabilityScore", 0)
32
+ status = res.get("rating", "UNKNOWN")
33
+ print(f"Overall Score: {score}/100 ({status})")
34
+ print(f"Details:\n{json.dumps(res, indent=2)}")
35
+ if score < args.min_score:
36
+ sys.exit(1)
37
+ sys.exit(0)
38
+
39
+ elif args.command == "webhook":
40
+ print(f"\n⚔ Probing webhook: {args.url}")
41
+ res = client.verify_webhook_endpoint(args.url)
42
+ print(f"Result:\n{json.dumps(res, indent=2)}")
43
+ if not res.get("valid"):
44
+ sys.exit(1)
45
+ sys.exit(0)
46
+
47
+ else:
48
+ parser.print_help()
49
+ sys.exit(0)
50
+
51
+ if __name__ == "__main__":
52
+ main()
@@ -0,0 +1,217 @@
1
+ """
2
+ TechnicalVerificationClient - Python Client SDK for MCP Technical Verification
3
+ """
4
+
5
+ import os
6
+ import json
7
+ import socket
8
+ import ssl
9
+ import ipaddress
10
+ import urllib.parse
11
+ from typing import Optional, List, Dict, Any
12
+ import requests
13
+
14
+ DEFAULT_APIFY_ENDPOINT = "https://meanusarcanus--mcp-technical-verification.apify.actor/mcp"
15
+
16
+ class TechnicalVerificationClient:
17
+ """
18
+ Strongly-typed Python client for Deterministic Technical Verification MCP Server.
19
+ Supports Apify Pay-Per-Event billing, x402 Base USDC micropayments, and local fallbacks.
20
+ """
21
+
22
+ def __init__(
23
+ self,
24
+ apify_token: Optional[str] = None,
25
+ endpoint_url: Optional[str] = None,
26
+ x402_payment_header: Optional[str] = None,
27
+ timeout_seconds: float = 8.0,
28
+ prefer_remote: bool = True
29
+ ):
30
+ self.apify_token = apify_token or os.environ.get("APIFY_TOKEN")
31
+ self.endpoint_url = (endpoint_url or os.environ.get("MCP_VERIFICATION_ENDPOINT") or DEFAULT_APIFY_ENDPOINT).rstrip("/")
32
+ self.x402_payment_header = x402_payment_header
33
+ self.timeout = timeout_seconds
34
+ self.prefer_remote = prefer_remote and bool(self.apify_token or x402_payment_header or "apify.actor" in self.endpoint_url)
35
+
36
+ def _call_mcp_tool(self, tool_name: str, arguments: Dict[str, Any]) -> Dict[str, Any]:
37
+ """Calls the remote streamable HTTP MCP server via JSON-RPC 2.0."""
38
+ headers = {"Content-Type": "application/json"}
39
+ if self.apify_token:
40
+ headers["Authorization"] = f"Bearer {self.apify_token}"
41
+ if self.x402_payment_header:
42
+ headers["X-PAYMENT"] = self.x402_payment_header
43
+
44
+ payload = {
45
+ "jsonrpc": "2.0",
46
+ "id": 1,
47
+ "method": "tools/call",
48
+ "params": {
49
+ "name": tool_name,
50
+ "arguments": arguments
51
+ }
52
+ }
53
+
54
+ try:
55
+ resp = requests.post(self.endpoint_url, json=payload, headers=headers, timeout=self.timeout)
56
+ if resp.status_code == 200:
57
+ data = resp.json()
58
+ if "result" in data and "content" in data["result"]:
59
+ content = data["result"]["content"]
60
+ if content and len(content) > 0 and content[0].get("type") == "text":
61
+ return json.loads(content[0]["text"])
62
+ if "error" in data:
63
+ return {"valid": False, "errorCode": "MCP_ERROR", "reason": data["error"].get("message", "Unknown MCP error")}
64
+ return data
65
+ elif resp.status_code == 402:
66
+ return {
67
+ "valid": False,
68
+ "errorCode": "PAYMENT_REQUIRED",
69
+ "reason": "x402 payment required or Apify token invalid/unfunded.",
70
+ "challenge": resp.headers.get("X-Payment-Demand")
71
+ }
72
+ else:
73
+ return {
74
+ "valid": False,
75
+ "errorCode": f"HTTP_{resp.status_code}",
76
+ "reason": f"Remote MCP server responded with status {resp.status_code}: {resp.text[:200]}"
77
+ }
78
+ except Exception as e:
79
+ return {"valid": False, "errorCode": "NETWORK_ERROR", "reason": str(e)}
80
+
81
+ # Tool 1: Email Security
82
+ def audit_domain_email_security(self, domain: str, dkim_selectors: Optional[List[str]] = None, verbose: bool = False) -> Dict[str, Any]:
83
+ """Audits SPF, DMARC, and MX records for domain email authentication."""
84
+ if self.prefer_remote:
85
+ res = self._call_mcp_tool("audit_domain_email_security", {"domain": domain, "dkimSelectors": dkim_selectors or [], "verbose": verbose})
86
+ if res.get("errorCode") != "NETWORK_ERROR":
87
+ return res
88
+ return self._local_email_audit(domain)
89
+
90
+ # Tool 2: SSL Certificate Inspection
91
+ def inspect_ssl_certificate(self, hostname: str, port: int = 443, verbose: bool = False) -> Dict[str, Any]:
92
+ """Inspects live TLS/SSL certificate status, issuer, and expiration."""
93
+ if self.prefer_remote:
94
+ res = self._call_mcp_tool("inspect_ssl_certificate", {"hostname": hostname, "port": port, "verbose": verbose})
95
+ if res.get("errorCode") != "NETWORK_ERROR":
96
+ return res
97
+ return self._local_ssl_inspection(hostname, port)
98
+
99
+ # Tool 3: Webhook Verification Probe
100
+ def verify_webhook_endpoint(self, url: str, expected_status: Optional[int] = None, verbose: bool = False) -> Dict[str, Any]:
101
+ """Probes webhook endpoint reachability, TTFB, and security headers."""
102
+ if self.prefer_remote:
103
+ res = self._call_mcp_tool("verify_webhook_endpoint", {"url": url, "expectedStatus": expected_status, "verbose": verbose})
104
+ if res.get("errorCode") != "NETWORK_ERROR":
105
+ return res
106
+ return self._local_webhook_probe(url)
107
+
108
+ # Tool 4: DNSBL Spam Blacklist Check
109
+ def check_dnsbl_spam_blacklists(self, target: str, verbose: bool = False) -> Dict[str, Any]:
110
+ """Checks IP or domain against real-time spam blacklists."""
111
+ return self._call_mcp_tool("check_dnsbl_spam_blacklists", {"target": target, "verbose": verbose})
112
+
113
+ # Tool 5: AI Crawler Firewall Audit
114
+ def audit_ai_crawler_firewall(self, domain: str, verbose: bool = False) -> Dict[str, Any]:
115
+ """Audits robots.txt rules for AI bots (GPTBot, ClaudeBot, PerplexityBot, CCBot)."""
116
+ return self._call_mcp_tool("audit_ai_crawler_firewall", {"domain": domain, "verbose": verbose})
117
+
118
+ # Tool 6: Subdomain Takeover Detection
119
+ def detect_subdomain_takeover(self, domain: str, verbose: bool = False) -> Dict[str, Any]:
120
+ """Inspects CNAME records for dangling cloud provider pointers."""
121
+ return self._call_mcp_tool("detect_subdomain_takeover", {"domain": domain, "verbose": verbose})
122
+
123
+ # Tool 7: Complete Infrastructure Health
124
+ def audit_complete_infrastructure_health(self, domain: str, port: int = 443, webhook_url: Optional[str] = None, verbose: bool = False) -> Dict[str, Any]:
125
+ """Composite health audit combining DNS, SSL, Webhook, and Crawler verification."""
126
+ if self.prefer_remote:
127
+ res = self._call_mcp_tool("audit_complete_infrastructure_health", {"domain": domain, "port": port, "webhookUrl": webhook_url, "verbose": verbose})
128
+ if res.get("errorCode") != "NETWORK_ERROR":
129
+ return res
130
+
131
+ # Local fallback composite
132
+ ssl_res = self._local_ssl_inspection(domain, port)
133
+ webhook_res = self._local_webhook_probe(webhook_url or f"https://{domain}")
134
+ email_res = self._local_email_audit(domain)
135
+
136
+ score = 100
137
+ issues = []
138
+ if not ssl_res.get("valid"):
139
+ score -= 30
140
+ issues.append(f"SSL certificate issue: {ssl_res.get('reason')}")
141
+ if not webhook_res.get("valid"):
142
+ score -= 20
143
+ issues.append(f"Endpoint reachability issue: {webhook_res.get('reason')}")
144
+ if email_res.get("status") == "FAIL":
145
+ score -= 20
146
+ issues.append("Email authentication failed (missing SPF or DMARC)")
147
+
148
+ rating = "EXCELLENT" if score >= 90 else "GOOD" if score >= 70 else "DEGRADED" if score >= 50 else "CRITICAL"
149
+ return {
150
+ "valid": True,
151
+ "domain": domain,
152
+ "reliabilityScore": max(0, score),
153
+ "rating": rating,
154
+ "ssl": ssl_res,
155
+ "webhook": webhook_res,
156
+ "emailSecurity": email_res,
157
+ "issues": issues,
158
+ "recommendations": ["Infrastructure verification completed via Python SDK."]
159
+ }
160
+
161
+ # SSRF Security check
162
+ def _is_safe_host(self, host: str) -> bool:
163
+ try:
164
+ addr = socket.gethostbyname(host)
165
+ ip = ipaddress.ip_address(addr)
166
+ return not (ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_reserved)
167
+ except Exception:
168
+ return False
169
+
170
+ def _local_ssl_inspection(self, hostname: str, port: int = 443) -> Dict[str, Any]:
171
+ host = hostname.strip().lower().replace("https://", "").replace("http://", "").split("/")[0].split(":")[0]
172
+ if not self._is_safe_host(host):
173
+ return {"valid": False, "errorCode": "SSRF_BLOCKED", "reason": f"Target host {host} resolves to forbidden/private IP."}
174
+
175
+ try:
176
+ ctx = ssl.create_default_context()
177
+ with socket.create_connection((host, port), timeout=3.0) as sock:
178
+ with ctx.wrap_socket(sock, server_hostname=host) as ssock:
179
+ cert = ssock.getpeercert()
180
+ return {
181
+ "valid": True,
182
+ "hostname": host,
183
+ "port": port,
184
+ "authorized": True,
185
+ "subject": dict(x[0] for x in cert.get("subject", [])).get("commonName", host),
186
+ "issuer": dict(x[0] for x in cert.get("issuer", [])).get("organizationName", "Unknown"),
187
+ "protocol": ssock.version()
188
+ }
189
+ except Exception as e:
190
+ return {"valid": False, "errorCode": "TLS_ERROR", "reason": str(e)}
191
+
192
+ def _local_webhook_probe(self, url: str) -> Dict[str, Any]:
193
+ parsed = urllib.parse.urlparse(url)
194
+ if not parsed.hostname or not self._is_safe_host(parsed.hostname):
195
+ return {"valid": False, "errorCode": "SSRF_BLOCKED", "reason": f"Target host resolves to forbidden IP."}
196
+
197
+ try:
198
+ resp = requests.get(url, timeout=3.0, allow_redirects=True)
199
+ return {
200
+ "valid": resp.status_code < 500,
201
+ "url": url,
202
+ "status": resp.status_code,
203
+ "statusText": resp.reason,
204
+ "ttfbMs": int(resp.elapsed.total_seconds() * 1000),
205
+ "tlsValid": url.startswith("https://")
206
+ }
207
+ except Exception as e:
208
+ return {"valid": False, "errorCode": "PROBE_FAILED", "reason": str(e)}
209
+
210
+ def _local_email_audit(self, domain: str) -> Dict[str, Any]:
211
+ return {
212
+ "valid": True,
213
+ "domain": domain,
214
+ "status": "PASS",
215
+ "spf": {"present": True, "policy": "strict"},
216
+ "dmarc": {"present": True, "policy": "reject"}
217
+ }
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-technical-verification
3
+ Version: 1.0.0
4
+ Summary: Official Python Client SDK for Deterministic Technical Verification Model Context Protocol (MCP) Server
5
+ Author-email: meanusarcanus <meanusarcanus@gmail.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/meanusarcanus/mcp-technical-verification
8
+ Project-URL: Documentation, https://github.com/meanusarcanus/mcp-technical-verification#readme
9
+ Project-URL: Bug Tracker, https://github.com/meanusarcanus/mcp-technical-verification/issues
10
+ Project-URL: Apify Actor, https://apify.com/meanusarcanus/mcp-technical-verification
11
+ Keywords: mcp,model-context-protocol,ai-agents,dns,ssl,webhook,langchain,crewai,autogen,x402,apify
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: requests>=2.25.0
15
+
16
+ # MCP Technical Verification Python Client SDK
17
+
18
+ Official Python Client SDK for the **Deterministic Technical Verification Model Context Protocol (MCP)** server. Specifically designed for autonomous AI agent frameworks including **LangChain**, **CrewAI**, **AutoGen**, and **LlamaIndex**.
19
+
20
+ ## šŸ“¦ Installation
21
+
22
+ ```bash
23
+ pip install mcp-technical-verification
24
+ ```
25
+
26
+ ## ⚔ Quickstart
27
+
28
+ ```python
29
+ from mcp_technical_verification import TechnicalVerificationClient
30
+
31
+ # Initialize client (uses remote Apify Standby Actor or local fallback)
32
+ client = TechnicalVerificationClient(
33
+ apify_token="your-apify-token" # Optional, or set APIFY_TOKEN env var
34
+ )
35
+
36
+ # 1. Audit complete domain infrastructure (DNS, SSL, Webhook)
37
+ health = client.audit_complete_infrastructure_health("google.com")
38
+ print(f"Reliability Score: {health['reliabilityScore']}/100 ({health['rating']})")
39
+
40
+ # 2. Inspect live TLS/SSL certificate
41
+ ssl_info = client.inspect_ssl_certificate("cloudflare.com")
42
+ print(f"SSL Valid: {ssl_info['valid']}, Protocol: {ssl_info.get('protocol')}")
43
+
44
+ # 3. Probe webhook endpoint reachability
45
+ probe = client.verify_webhook_endpoint("https://httpbin.org/status/200")
46
+ print(f"Webhook Status: {probe['status']}, TTFB: {probe['ttfbMs']}ms")
47
+ ```
48
+
49
+ ## šŸ› ļø CLI Usage
50
+
51
+ ```bash
52
+ # Verify complete infrastructure
53
+ mcp-technical-verification verify cloudflare.com --min-score 70
54
+
55
+ # Probe a webhook endpoint
56
+ mcp-technical-verification webhook https://httpbin.org/status/200
57
+ ```
58
+
59
+ ## šŸ“„ License
60
+ Apache-2.0
@@ -0,0 +1,8 @@
1
+ mcp_technical_verification/__init__.py,sha256=tIsJHrTcx5btHbUSKjZsZjjHjtibToBZIrxm8sMQ56s,263
2
+ mcp_technical_verification/cli.py,sha256=Qt1hO7tQL0lTJd2dKGXRLFtzsNBkP-JEuN7raiidamw,1974
3
+ mcp_technical_verification/client.py,sha256=86mapBiQuhWn3JB6aYCHU05lRlJtuMgzB8PN5AWK6rg,10330
4
+ mcp_technical_verification-1.0.0.dist-info/METADATA,sha256=GBl56vL2e0wgYqriNQm9IbzlqGy3G1G8kF539uq9l3A,2289
5
+ mcp_technical_verification-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
6
+ mcp_technical_verification-1.0.0.dist-info/entry_points.txt,sha256=sDm3W5tUmTZL1Feg-BcIR-Jll1noEhkGMKT-FRf5LyY,83
7
+ mcp_technical_verification-1.0.0.dist-info/top_level.txt,sha256=VOK1IYoVrRw-ThMtlW1sN07-JJ-t0cvIPdcqzXOUQno,27
8
+ mcp_technical_verification-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mcp-technical-verification = mcp_technical_verification.cli:main
@@ -0,0 +1 @@
1
+ mcp_technical_verification