server
MCP server exposing evaluate_policy tool for AI agents
Installation
npx @guardrail-sim/mcp-serverAsk AI about server
Powered by Claude Β· Grounded in docs
I know everything about server. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Guardrail-Sim
Test your AI pricing policies before they cost you millions.
Everyone's building the gas pedalβAI agents that negotiate, discount, and close deals. But what happens when your LLM gives away margin at scale? Guardrail-Sim is the brakes and steering.
The Problem
You're deploying an AI sales agent. It can negotiate discounts. But:
- Will it honor your margin floors? Or give 40% off to anyone who asks nicely?
- How does it behave at scale? One bad discount is a rounding error. 10,000 is a crisis.
- Can you prove compliance? When finance asks, "what are the rules?", show themβdon't guess.
The Solution
Guardrail-Sim lets you simulate thousands of adversarial buyer interactions against your pricing policies before going live. Define rules. Spawn buyer personas that try to game them. See what breaks.
Define Policy β Simulate Attacks β Fix Gaps β Deploy with Confidence
Try It Now
git clone https://github.com/jeffgreendesign/guardrail-sim.git
cd guardrail-sim && pnpm install && pnpm build
Run a simulation with 5 adversarial buyer personas:
pnpm demo
Expected output:
===============================================
GUARDRAIL-SIM Β· Simulation Report
===============================================
Sessions: 50 | Seed: 42
Approval Rate Β·Β·Β·Β·Β· 46.0%
Avg Discount Β·Β·Β·Β·Β·Β· 9.0%
Avg Margin Β·Β·Β·Β·Β·Β·Β·Β· 28.4%
PERSONA OUTCOMES
budget-buyerΒ·Β·Β·Β·Β·Β·Β·Β· 10/10 approved
strategic-buyerΒ·Β·Β·Β·Β· 9/10 approved
margin-hunterΒ·Β·Β·Β·Β·Β·Β· 0/10 approved
volume-gamerΒ·Β·Β·Β·Β·Β·Β·Β· 4/10 approved
code-stackerΒ·Β·Β·Β·Β·Β·Β·Β· 0/10 approved
Or test a single policy evaluation:
import { PolicyEngine, defaultPolicy } from '@guardrail-sim/policy-engine';
const engine = new PolicyEngine(defaultPolicy);
const result = await engine.evaluate(
{ order_value: 5000, quantity: 100, product_margin: 0.4 },
0.12
);
console.log(result.approved); // true
console.log(result.violations); // []
Project Status
| Component | Status | Description |
|---|---|---|
| Policy Engine | Complete | Deterministic rule evaluation with json-rules-engine |
| MCP Server | Complete | 7 MCP tools including simulation and UCP-aligned |
| UCP Types | Complete | Universal Commerce Protocol type definitions |
| Insights | Complete | Policy health checks and recommendations |
| Simulation | Complete | Adversarial buyer personas and negotiation loops |
Default Policy Rules
- Margin floor: 15% minimum margin
- Max discount: 25% cap
- Volume tiers: 10% base, 15% for qty >= 100
Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Simulation Engine β
β 5 Buyer Personas Β· Adversarial Negotiation Loops β
β Deterministic (seeded PRNG) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Policy Engine β
β json-rules-engine Β· Deterministic Evaluation β
β Exposed via MCP Server (7 tools) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Project Structure
packages/
βββ policy-engine/ β
Deterministic rule evaluation (json-rules-engine)
βββ simulation/ β
Adversarial buyer personas + negotiation loops
βββ mcp-server/ β
MCP server with 7 tools (policy + simulation + UCP)
βββ ucp-types/ β
UCP type definitions and converters
βββ insights/ β
Policy health checks and recommendations
apps/
βββ website/ β
Fumadocs documentation site + interactive playground
examples/
βββ ucp-integration-demo/ UCP discount validation scenarios
βββ simulation-demo/ Run simulation and see results
Commands
pnpm install # Install dependencies
pnpm build # Build all packages
pnpm test # Run tests (109 passing)
pnpm demo # Run simulation demo
pnpm lint # Run ESLint
pnpm format # Format with Prettier
Per-package:
pnpm --filter @guardrail-sim/policy-engine build # Build single package
pnpm --filter @guardrail-sim/policy-engine test # Test single package
MCP server:
npx @guardrail-sim/mcp-server # Run MCP server
Documentation
- Getting Started β Quick start guide and setup
- Architecture β Technical decisions with rationale
- MCP Tools β MCP implementation reference
- Policy Concepts β Policy structure and evaluation
Contributing
We welcome contributions! Please see CONTRIBUTING.md for:
- Development setup instructions
- How to run tests locally
- Pull request guidelines
License
MIT
