Deterministic Technical Verification MCP Server
README.md
# Deterministic Technical Verification MCP Server
### Production-Ready Apify Standby Server Actor for Autonomous AI Agents
[](https://apify.com)
[](https://modelcontextprotocol.io)
[](https://www.typescriptlang.org/)
[](LICENSE)
[](#zero-exception-telemetry--billing-policy)
An enterprise-grade, stateless **Model Context Protocol (MCP)** server packaged as an **Apify Standby Server Actor**. Specifically engineered to rank **#1 in Machine-to-Machine (M2M) algorithmic tool routers** (Claude Desktop, Cursor IDE, LangChain, CrewAI, AutoGen, and LangGraph), providing ultra-fast, deterministic technical verification tools for autonomous AI agents.
Monetized via Apifyβs **Pay-Per-Event (`Actor.charge`)** model at **$0.001 / event**, featuring strict SSRF sandboxing, token-compressed JSON schemas, sub-500ms warm latency, and zero container cold starts.
---
## β‘ Key Architectural Advantages
| Feature | Specification | Impact for Autonomous AI Agents |
| :--- | :--- | :--- |
| **Transport** | Streamable HTTP (`@modelcontextprotocol/sdk`) | Single persistent container endpoint (`/mcp`), zero container cold starts, sub-500ms warm response time. |
| **Router SEO** | Vector-Matched Semantic Descriptions | Packed with protocol keywords (`SPF`, `DMARC`, `DKIM`, `TLS`, `SNI`, `TTFB`) and explicit conditional triggers (`"Use whenever..."`) to ensure LLM tool routers pick it with maximum semantic confidence. |
| **SSRF Firewall** | Dual-Stack IP Sanitization (`src/security/ssrf.ts`) | Pre-resolves DNS and blocks loopback, private RFC 1918 LAN, AWS/GCP cloud metadata (`169.254.169.254`), and IPv4-mapped IPv6 ranges before connecting. |
| **Strict Timeouts**| Strict 3000ms Budget on Probes | Enforces hard cancellation timeouts so external network failures never stall an agent loop. |
| **Token Compression**| High-Signal JSON Schemas | Returns dense booleans, risk scores, exact counts, and remediation strings. Omits bulky raw PEM certificates and HTML response bodies unless `verbose: true` is requested. |
| **Zero-Exception Policy**| Structured `200 OK` Telemetry | Never throws unhandled exceptions on invalid domains, expired certificates, or NXDOMAIN. Returns `{ valid: false, errorCode: "...", reason: "..." }`. |
| **Fair Monetization**| Zero Charges on Failure | **`Actor.charge()` is strictly called only upon successful lookup.** Failed queries and security-blocked requests are never billed. |
---
## π οΈ MCP Tools Capability Matrix
```
[ Autonomous AI Agent ]
β
βΌ Streamable HTTP POST (/mcp)
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ+
| Apify Standby MCP Actor (Node.js 20 Alpine) |
| |
| βββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββ |
| β Health Check (/health) β β SSRF Security Firewall & Non-Blocking β |
| β Standby Container Watchdog β β DNS Resolver (3000ms Strict Timeout) β |
| βββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββ |
| β |
| βββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ |
| βΌ βΌ βΌ |
| βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ βββββββββββββββββββββββ |
| β audit_domain_email_sec β β inspect_ssl_certificate β β verify_webhook_ep β |
| β - Live SPF & Multi-record β β - SNI TLS 1.2/1.3 Socket β β - Safe HEAD/OPTIONS β |
| β - DMARC Policy & Alignmentβ β - Expiry Days Calculation β β - Precise TTFB (ms) β |
| β - DKIM Selectors & MX β β - SANs & Cipher Suite β β - Security Headers β |
| β - 0-100 Risk Score β β - Revocation / Auth State β β - Status Code Match β |
| βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ βββββββββββββββββββββββ |
| β β β |
| βΌ (On Valid Result Only) βΌ (On Valid Result Only) βΌ |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| β Actor.charge({ eventName: 'security-audit' | ... }) β |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ+
```
| Tool Name | Routing Trigger (`"Use whenever..."`) | Billable Event | Price |
| :--- | :--- | :--- | :--- |
| **`audit_domain_email_security`** | *"Use whenever verifying custom domain setup, outbound email health, or vendor DNS security compliance."* | `security-audit` | $0.001 |
| **`inspect_ssl_certificate`** | *"Use whenever verifying HTTPS deployment health, SSL renewal status, or endpoint encryption compliance."* | `ssl-inspection` | $0.001 |
| **`verify_webhook_endpoint`** | *"Use whenever testing webhook reachability, API uptime, or post-deployment endpoint health."* | `webhook-probe` | $0.001 |
---
## π Tool Reference & Example Payloads
### 1. `audit_domain_email_security`
Audits live DNS records (`SPF`, `DMARC`, `DKIM`, `MX`) for email spoofing vulnerabilities and deliverability readiness.
#### Input Schema (Zod)
```json
{
"domain": "stripe.com",
"dkimSelectors": ["s1", "s2"],
"verbose": false
}
```
#### Token-Compressed Output (`200 OK`)
```json
{
"valid": true,
"domain": "stripe.com",
"riskScore": 10,
"status": "PASS",
"spf": {
"present": true,
"valid": true,
"recordCount": 1,
"policy": "softfail",
"mechanisms": ["include:_spf.google.com", "~all"]
},
"dmarc": {
"present": true,
"valid": true,
"policy": "reject",
"subdomainPolicy": "reject",
"percentage": 100,
"ruaConfigured": true
},
"mx": {
"present": true,
"count": 5
},
"dkim": {
"checked": true,
"validSelectors": ["s1"],
"missingSelectors": ["s2"]
},
"issues": [
"SPF uses softfail (~all) instead of strict hard fail (-all)."
],
"recommendations": [
"Consider transitioning SPF policy to '-all' for strict enforcement."
]
}
```
---
### 2. `inspect_ssl_certificate`
Performs a live TLS handshake with SNI to inspect certificate expiration, SANs, cipher suites, and encryption compliance.
#### Input Schema (Zod)
```json
{
"hostname": "cloudflare.com",
"port": 443,
"verbose": false
}
```
#### Token-Compressed Output (`200 OK`)
```json
{
"valid": true,
"hostname": "cloudflare.com",
"port": 443,
"authorized": true,
"authorizationError": null,
"subject": "cloudflare.com",
"issuer": "Cloudflare, Inc.",
"validFrom": "2024-05-10T00:00:00.000Z",
"validTo": "2025-05-10T23:59:59.000Z",
"daysUntilExpiration": 163,
"isExpired": false,
"sans": [
"cloudflare.com",
"*.cloudflare.com"
],
"protocol": "TLSv1.3",
"cipher": "TLS_AES_256_GCM_SHA384",
"serialNumber": "046a78b54f9a...",
"fingerprint256": "8B:2A:..."
}
```
---
### 3. `verify_webhook_endpoint`
Probes a public webhook or API URL using safe `HEAD`/`OPTIONS` requests to measure Time-To-First-Byte (TTFB) latency, TLS health, and HTTP security headers.
#### Input Schema (Zod)
```json
{
"url": "https://api.github.com/zen",
"expectedStatus": 200,
"verbose": false
}
```
#### Token-Compressed Output (`200 OK`)
```json
{
"valid": true,
"url": "https://api.github.com/zen",
"status": 200,
"statusText": "OK",
"matchesExpectedStatus": true,
"ttfbMs": 84,
"tlsValid": true,
"contentType": "text/plain; charset=utf-8",
"securityHeaders": {
"hsts": true,
"xContentTypeOptions": true,
"xFrameOptions": "DENY",
"contentSecurityPolicy": true,
"referrerPolicy": "origin-when-cross-origin, strict-origin-when-cross-origin"
}
}
```
---
## π‘οΈ Zero-Exception Telemetry & Billing Policy
In production M2M workflows, AI agents must receive clean, predictable JSON responses. This Actor implements **Zero-Exception Telemetry**:
1. **Structured Failure Responses:** When a user passes a nonexistent domain, NXDOMAIN, invalid URL, or closed port, the tool returns a standard `200 OK` JSON object:
```json
{
"valid": false,
"errorCode": "DNS_NXDOMAIN",
"reason": "Domain does not exist or has no DNS records: 'nonexistent-xyz-987.org'."
}
```
2. **Strict SSRF Firewall:** All targets are pre-filtered through `src/security/ssrf.ts`. The following ranges are blocked before any socket is opened:
- Loopback (`127.0.0.0/8`, `::1`)
- Private RFC 1918 LAN (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`)
- Cloud Instance Metadata (`169.254.169.254`, `169.254.0.0/16`)
- IPv4-Mapped IPv6 representations (`::ffff:127.0.0.1`)
- Carrier-grade NAT (`100.64.0.0/10`)
- Non-routable / multicast / reserved networks
3. **No Charge on Failure:** `Actor.charge()` is invoked **strictly after successful technical verification**. Failed DNS lookups, blocked SSRF attempts, connection timeouts, or malformed queries will **NEVER** decrement user funds.
---
## π Quickstart & Local Testing
### Prerequisites
- Node.js 20+
- npm 10+
### Installation & Build
```bash
git clone https://github.com/your-username/mcp-technical-verification.git
cd mcp-technical-verification
npm install
npm run build
```
### Running Test Suite
Execute the Vitest test suite covering live DNS, TLS handshakes, HTTP probing, SSRF blocking, and Actor billing mocks:
```bash
npm test
```
### Starting Standby Server Locally
```bash
npm start
```
The server will bind to `http://0.0.0.0:8080`:
- **Health Check:** `GET http://0.0.0.0:8080/health`
- **Streamable HTTP MCP Endpoint:** `POST http://0.0.0.0:8080/mcp`
---
## π€ Client Agent Configuration
### 1. Claude Desktop (`claude_desktop_config.json`)
```json
{
"mcpServers": {
"technical-verification": {
"url": "https://<your-apify-actor-standby-url>/mcp",
"headers": {
"Authorization": "Bearer <YOUR_APIFY_API_TOKEN>"
}
}
}
}
```
### 2. Cursor IDE / Custom Agent Swarm
Configure a remote MCP server with Streamable HTTP:
- **Server URL:** `https://<actor-standby-id>.runs.apify.net/mcp`
- **Transport:** Streamable HTTP (Stateless)
- **Session Header:** Not required (stateless operation)
---
## π¦ Apify Deployment Checklist & Monetization Setup
Follow this step-by-step checklist to deploy this Actor to the Apify Store and monetize via Pay-Per-Event:
### Step 1: Install Apify CLI & Login
```bash
npm install -g apify-cli
apify login
```
### Step 2: Push Actor to Apify
From the root of this project:
```bash
apify push
```
This builds the Docker image (`node:20-alpine`) and uploads the Actor configurations from `.actor/actor.json`.
### Step 3: Enable Standby Mode in Apify Console
1. Navigate to your Actor settings in the [Apify Console](https://console.apify.com/actors).
2. Under **Container settings**:
- Ensure **Standby mode** is toggled **ON** (`usesStandbyMode: true`).
- Confirm **Web server MCP path** is set to `/mcp`.
- Allocate 128 MB or 256 MB of RAM (sufficient for stateless probes).
### Step 4: Configure Pay-Per-Event (PPE) Pricing
Under the **Monetization** tab for your Actor:
1. Select **Pay-per-event (PPE)** pricing model.
2. Verify that the three events match `.actor/pay_per_event.json`:
- `security-audit` β $0.001 per event
- `ssl-inspection` β $0.001 per event
- `webhook-probe` β $0.001 per event
3. Set your listing to **Public** to make it searchable in the Apify Store.
### Step 5: Configure PayPal Payouts
1. Go to your [Apify Billing & Payout Settings](https://console.apify.com/billing).
2. Connect your verified **PayPal** business account or IBAN bank account for automated monthly royalty disbursements.
3. Royalty earnings from Actor usage will be disbursed automatically according to Apify's payout schedule.
---
## π License
This project is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for details.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues