Security-hardened prompt engineering framework — MCP server on Cloudflare Workers
Mixed quality across 13 tools. The 10 promptcraft_* tools (TypeScript, HTTP) have well-structured schemas with descriptions and proper parameter typing. However, 3 tools (nmap_scan, curl_head, whois_lookup) are defined in Python server.py with minimal descriptions and no visible schemas, these are inferred and capped at 50. Naming is consistent (verb_noun pattern). Descriptions for promptcraft tools are detailed (100-300 chars) but some lack actionable error guidance. Output schemas are documented in code but not always visible in the provided source. Security-focused design (HMAC, audit logging, guardrails) is evident but not reflected in tool descriptions.
Run HTTP header inspection with fixed pattern: curl -I <target>
Run fast port discovery with fixed pattern: nmap -F <target>
Create a new four-layer prompt template with HMAC-signed content integrity. Layers: - objective: Clear task definition and success criteria - role: Persona, domain expertise, situational context - constraints: Boundaries, forbidden actions, rules - outputShape: Expected format, schema, examples Set requiresHITL: true to require human approval before every execution. The template is signed with HMAC-SHA256 to prevent tampering in storage. Returns the template ID, version, and content hash.
Soft-delete a prompt template by removing the primary KV key. Versioned copies (template:{id}:v{n}) are retained indefinitely for audit compliance. The deletion is recorded in the template_changes audit table in D1 with the acting user ID. Returns an error if the template does not exist (idempotent deletes are intentionally rejected to prevent silent double-delete from masking replay attacks).
Execute a prompt template with the full security pipeline: 1. Load template from KV with HMAC verification 2. Sanitize user input (NFKC, injection detection, length) 3. Compile four-layer prompt with structured separation + sandwich defense 4. Run inference via Workers AI 5. Validate output (schema, PII, leakage, canary token) 6. Log audit trail to D1 Returns the model output, guardrail results, and usage metrics. Fail-closed: if any guardrail fails, the output is NOT returned.
Three tools (nmap_scan, curl_head, whois_lookup) have no visible input schemas in source and minimal descriptions (under 50 chars). No parameter type information visible.
HITL tools (promptcraft_resolve_hitl, promptcraft_get_hitl_status, promptcraft_list_pending_hitl) lack error recovery guidance. Descriptions do not explain what to do if an approval times out, is already resolved, or the approvalId is invalid.
promptcraft_execute_prompt description does not mention what happens if guardrails fail (fail-closed behavior is stated but not actionable for LLM). No guidance on retryability or user-fixable errors.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 66 | 2025-06-18+ | v2 |
Get the status of a pending Human-In-The-Loop (HITL) approval request. Returns approval details, timeout status, and decision if resolved.
Retrieve a prompt template by ID with HMAC integrity verification. Optionally specify a version number to fetch a historical version. Returns the full template including all four layers and metadata.
List all pending Human-In-The-Loop (HITL) approval requests. Returns paginated list of templates awaiting human review with timeout status.
List available prompt templates with optional tag filtering and pagination.
Query audit logs with optional filtering by user, template, status, and time range. Returns paginated results with full audit trail including guardrail events.
Resolve a pending Human-In-The-Loop (HITL) approval request. Approves or rejects a template execution that was blocked pending human review. Used to unblock requiresHITL templates.
Validate a prompt template and user input without executing inference. Runs the full guardrail pipeline (input sanitization, schema validation) and returns detailed validation results.
Run domain lookup with fixed pattern: whois <target>
Three network tools (nmap_scan, curl_head, whois_lookup) appear to be security/reconnaissance utilities mixed into a prompt engineering framework. This violates single-responsibility principle and creates security/compliance risk if exposed to untrusted agents.
promptcraft_list_templates and promptcraft_query_audit accept 'cursor' and 'offset' parameters respectively, but descriptions do not explain pagination semantics or what happens when cursor/offset is invalid or out of range.