PD

PDMT MCP Server: Deterministic Templating and Todo Validation

Enable reproducible outputs with PDMT MCP server: deterministic templating, todo validation, quality enforcement and 0.0-temperature generation.

Overview

PDMT MCP Server provides a lightweight server implementing the Model Context Protocol (MCP) to produce reproducible, verifiable outputs from language models. It focuses on deterministic templating and post-generation checks so outputs can be relied on in pipelines and automated workflows. Key behaviors include 0.0-temperature generation, explicit TODO detection/validation, and configurable quality enforcement to ensure responses meet pre-defined constraints.

The server sits between your application and an LLM or LLM provider. Instead of treating the model as an opaque generator, PDMT applies templates and validation rules, runs the model deterministically, and returns structured results. This helps teams achieve reproducible content, reduce hallucinations, and enforce quality gates before downstream consumption.

Features

  • Deterministic generation (temperature = 0.0) to produce reproducible outputs
  • Template-driven generation: stable prompts and output structure for predictable responses
  • TODO detection and validation to surface unresolved placeholders and fail builds early
  • Quality enforcement with configurable thresholds (e.g., confidence, token checks)
  • MCP-compatible API for integration with existing MCP clients and tooling
  • Extensible plugin points for custom validators, templates, and LLM backends
  • Logging and structured error reporting for automated CI/CD use

Installation / Configuration

Basic steps to get the server running locally. Adjust commands for your environment.

Clone and run (generic example):

git clone https://github.com/paiml/pdmt.git
cd pdmt
# Build & run (example using Docker Compose if provided)
docker-compose up --build -d

Run from source (Python/Node placeholder — replace with actual stack commands if applicable):

# Python example
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
./pdmt-server --config config.yaml

Configuration example (YAML):

server:
  host: 0.0.0.0
  port: 8080

model:
  provider: openai
  model_name: gpt-4o
  temperature: 0.0       # enforce deterministic generation
  max_tokens: 512

validation:
  todo_validation: true
  fail_on_todos: true
  quality_threshold: 0.85

templates_dir: ./templates

Command-line flags (common):

# Start server with explicit config
pdmt-server --config ./config.yaml

# Run in a single-shot mode to render a template
pdmt render --template greeting.tpl --input inputs.json

Available Tools / Resources

  • Template Engine: deterministic template rendering with placeholders and typed fields
  • Todo Validator: scans generated text for markers like TODO, FIXME, or custom tags and returns structured diagnostics
  • Quality Enforcer: runs heuristics and optional model-backed checks (e.g., semantic similarity) against expected outputs and scores results
  • MCP Schema: supports MCP request/response envelopes so clients can integrate without custom adapters
  • Example Templates: a library of sample templates for emails, API docs, changelogs, and commit messages

Example MCP request envelope (JSON):

{
  "mcp_version": "1.0",
  "id": "req-123",
  "method": "generate",
  "params": {
    "template": "release_notes.tpl",
    "inputs": { "version": "1.2.0", "changes": ["fix bug", "add feature"] },
    "options": {
      "temperature": 0.0,
      "validate": true
    }
  }
}

Typical response with validation:

{
  "id": "req-123",
  "result": {
    "text": "Release 1.2.0\n- fix bug\n- add feature\n",
    "todos": [],
    "quality": 0.92
  }
}

If TODOs are present and fail_on_todos is enabled:

{
  "id": "req-456",
  "error": {
    "code": "VALIDATION_TODO_FOUND",
    "message": "Template produced unresolved TODOs",
    "details": ["TODO: add author name at line 3"]
  }
}

Use Cases

  • CI/CD content generation: Produce changelogs or release notes deterministically in a build pipeline. The server ensures identical outputs for the same inputs and fails builds when TODOs remain.

    • Example: generate release_notes.tpl with version and changes; abort deployment if any TODOs detected.
  • Documentation and API scaffolding: Use templates to render API docs with guaranteed structure. Use quality enforcement to require a minimum semantic similarity to example docs before merging.

    • Example: render api_doc.tpl then run the quality enforcer to ensure coverage > 0.9.
  • Automated email or message generation: Create templated notifications with placeholders validated. The server prevents sending messages with unresolved placeholders like TODO or FIXME.

    • Example: generate welcome email via greeting.tpl; todo_validation ensures personalization fields are filled.
  • Regression testing for model output: Lock templates and inputs into tests to assert that outputs remain unchanged across model/provider upgrades. Deterministic generation gives repeatable baselines.

    • Example: store golden files for template outputs and compare each CI run.

Configuration options (summary)

KeyTypeDescriptionDefault
model.temperaturefloatSampling temperature; 0.0 enforces determinism0.0
validation.todo_validationboolEnable scanning for TODO markerstrue
validation.fail_on_todosboolFail request if TODOs are foundtrue
validation.quality_thresholdnumberMinimum acceptable quality score (0-1)0.8
templates_dirstringFilesystem path with template definitions./templates

Getting Help and Contributing

  • Repository: https://github.com/paiml/pdmt
  • For issues, feature requests, and contributions, open an issue or pull request on GitHub.
  • Extend validators or templates by adding modules under the respective directories; follow the included examples for ABI-compatible plugins.

This server is designed to be a practical layer for deterministic, verifiable LLM outputs. Integrate it where repeatability, automation, and quality gates are important parts of your developer workflow.