Install
$ agentstack add mcp-nshkrdotcom-guardrail ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
[](https://mseep.ai/app/nshkrdotcom-guardrail)
GUARDRAIL: Security Framework for Large Language Model Applications
Application Security Onion
Overview
The Application Security Onion diagram visualizes the layered security concerns that modern applications face, with a particular focus on how newer LLM (Large Language Model) and Agent-based systems build upon traditional security foundations.
Understanding the Layers
Like an onion, application security consists of multiple layers that must all be addressed for comprehensive protection:
Layer 1: Traditional Web Security (Outer Layer)
The foundation of all application security, covering fundamental concerns like authentication, authorization, input validation, and transport security. These are well-established practices that remain essential regardless of application type.
Layer 2: Data & Infrastructure Security
Building on basic web security, this layer addresses how data is stored, processed, and transported across infrastructure components. This includes database security, container protection, network segmentation, and dependency management.
Layer 3: LLM Application Security
Specific security concerns for applications that leverage large language models. This newer domain includes protections against prompt injection, jailbreaking attempts, output sanitization, and preventing data leakage through model interactions.
Layer 4: Agent & MCP Security (Core)
At the center are emerging security concerns specific to autonomous agents and the Model Context Protocol (MCP). This includes message classification, context verification, trust scoring, and flow control between agent components.
Applications
The Application Security Onion can be used to:
- Assess security coverage across different domains
- Identify gaps in security planning
- Prioritize security initiatives based on foundational requirements
- Educate teams on the relationship between traditional and emerging security concerns
- Create security checklists that ensure all layers are addressed
Implementation Guidance
When approaching application security, work from the outside in:
- Ensure traditional web security controls are robust and well-implemented
- Address data and infrastructure security concerns
- Implement LLM-specific protections as needed
- Apply agent and MCP-specific security controls at the core
Remember that inner layers depend on outer layers - LLM application security measures will be undermined if traditional web security elements like authentication are weak.
Contributing
This model is evolving as security practices for LLM applications and agents mature. Contributions and suggestions for improving the Application Security Onion are welcome.
The Application Security Onion diagram is licensed under CC BY 4.0. Feel free to share and adapt with attribution._
Practical Security vs. Framework Complexity: The GUARDRAIL Reality Check
1. Isolation vs. Framework Complexity
Simple containerization or VM isolation often provides more immediate security benefits than complex frameworks. While GUARDRAIL offers sophisticated protocol-level security, basic isolation through Docker or VMs:
- Creates clear security boundaries
- Limits potential damage from compromises
- Requires minimal specialized knowledge to implement
- Provides proven protection with lower implementation risk
Reality check: For many teams, proper containerization with resource limits and minimal attack surface would deliver more immediate security value than implementing GUARDRAIL's multi-layered architecture.
2. The Credential Security Gap
The absence of clear credential security patterns in GUARDRAIL is a significant oversight. Basic credential security practices like:
- Secrets management (using tools like HashiCorp Vault or cloud key management)
- Environment variable segregation
- Credential rotation
- Least-privilege access patterns
...aren't explicitly addressed in the framework, despite being fundamental to application security.
Reality check: Storing API keys securely is more immediately valuable than implementing sophisticated protocol-level security annotations.
3. HTTP/SSE Implementation Mismatch
GUARDRAIL's protocol-agnostic approach might seem attractive, but it creates a disconnect from the specific security concerns of HTTP and SSE implementations, including:
- CORS policies
- Content Security Policy
- HTTP header security
- Cross-site scripting protection
- HTTP-specific authentication patterns
Reality check: Framework abstractions that don't connect to your actual transport mechanism (HTTP/SSE) create implementation gaps.
4. The Authentication Blind Spot
Authentication is curiously underdeveloped in GUARDRAIL, which focuses more on attestation between services than user authentication. It lacks:
- Integration patterns with identity providers
- Token validation and management
- Session security
- Authorization frameworks
Reality check: Without solid authentication fundamentals, other security layers become much less effective.
5. The Developer Knowledge Problem
GUARDRAIL doesn't solve the problem of "young devs with no background in app level security." Complex frameworks can actually exacerbate this problem by:
- Creating a false sense of security ("we implemented GUARDRAIL so we're secure")
- Adding complexity that obscures basic security principles
- Requiring specialized knowledge to implement correctly
- Potentially introducing new security gaps through misconfiguration
Reality check: Developer security education and simple, consistent security patterns often yield better outcomes than complex frameworks.
Practical Recommendations
Instead of full GUARDRAIL implementation, consider:
- Start with basics: Proper isolation, credential management, input validation, and output sanitization
- Implement LLM-specific controls: Add targeted protections against prompt injection, jailbreaking, and data leakage
- Use established auth patterns: Leverage battle-tested authentication libraries and frameworks rather than building custom solutions
- Security education: Invest in developer security awareness specific to LLM applications
- Selective adoption: If some GUARDRAIL concepts seem valuable (like the Information Gateway Layer), implement them pragmatically without the full framework complexity
Conclusion
GUARDRAIL offers an academically interesting approach to LLM security but may overcomplicate what are often straightforward security challenges. Sometimes basic isolation, handling credentials properly, and following established HTTP security practices will deliver more real security value than implementing complex architectural frameworks.
The gap between security theory and practice remains wide, and addressing fundamental developer security knowledge will likely yield better outcomes than adding architectural complexity through comprehensive frameworks like GUARDRAIL.
Original README:
Executive Summary
GUARDRAIL is a comprehensive security framework designed to protect Large Language Model (LLM) application ecosystems, particularly those built using the Model Context Protocol (MCP). It addresses critical security vulnerabilities inherent in LLM applications, focusing on preventing data exfiltration, data infiltration, unauthorized access, and resource abuse. GUARDRAIL provides a modular, layered, and extensible architecture, offering robust protection without sacrificing performance or usability. It prioritizes practical, incremental adoption, allowing developers to enhance security progressively.
Project Status
GUARDRAIL is currently in active development. This repository contains the architectural design, technical specifications, and implementation documentation. Production-ready code components and reference implementations will be released incrementally. This README serves as the central hub for understanding the project.
Table of Contents
- [GUARDRAIL: Security Framework for Large Language Model Applications](#guardrail-security-framework-for-large-language-model-applications)
- [Application Security Onion](#application-security-onion)
- [Overview](#overview)
- [Understanding the Layers](#understanding-the-layers)
- [Layer 1: Traditional Web Security (Outer Layer)](#layer-1-traditional-web-security-outer-layer)
- [Layer 2: Data \& Infrastructure Security](#layer-2-data--infrastructure-security)
- [Layer 3: LLM Application Security](#layer-3-llm-application-security)
- [Layer 4: Agent \& MCP Security (Core)](#layer-4-agent--mcp-security-core)
- [Applications](#applications)
- [Implementation Guidance](#implementation-guidance)
- [Contributing](#contributing)
- [Practical Security vs. Framework Complexity: The GUARDRAIL Reality Check](#practical-security-vs-framework-complexity-the-guardrail-reality-check)
- [1. Isolation vs. Framework Complexity](#1-isolation-vs-framework-complexity)
- [2. The Credential Security Gap](#2-the-credential-security-gap)
- [3. HTTP/SSE Implementation Mismatch](#3-httpsse-implementation-mismatch)
- [4. The Authentication Blind Spot](#4-the-authentication-blind-spot)
- [5. The Developer Knowledge Problem](#5-the-developer-knowledge-problem)
- [Practical Recommendations](#practical-recommendations)
- [Conclusion](#conclusion)
- [Original README:](#original-readme)
- [Executive Summary](#executive-summary)
- [Project Status](#project-status)
- [Table of Contents](#table-of-contents)
- [1. Introduction ](#1-introduction-)
- [2. Core Principles ](#2-core-principles-)
- [3. Architecture Overview ](#3-architecture-overview-)
- [3.1 Security Layers ](#31-security-layers-)
- [3.2 Deployment Models ](#32-deployment-models-)
- [4. Key Benefits ](#4-key-benefits-)
- [5. Integration with MCP ](#5-integration-with-mcp-)
- [6. Practical Security Innovations ](#6-practical-security-innovations-)
- [6.1 Extensible Security Middleware (ESM) ](#61-extensible-security-middleware-esm-)
- [6.2 Dynamic Security Context (DSC) ](#62-dynamic-security-context-dsc-)
- [6.3 Protocol-Level Security Annotations ](#63-protocol-level-security-annotations-)
- [6.4 Lightweight Attestation Protocol (LAP) ](#64-lightweight-attestation-protocol-lap-)
- [6.5 Adaptive Resource Quotas (ARQ) ](#65-adaptive-resource-quotas-arq-)
- [6.6 Security Event Correlation and Reporting (SECR) ](#66-security-event-correlation-and-reporting-secr-)
- [7. Visualizations and Diagrams ](#7-visualizations-and-diagrams-)
- [8. Detailed Documentation ](#8-detailed-documentation-)
- [9. Emergency Response Framework ](#9-emergency-response-framework-)
- [10. License ](#10-license-)
- [11. Phase 1 Implementation: Foundation (0-3 Months) ](#11-phase-1-implementation-foundation-0-3-months--)
- [11.1 Executive Summary ](#111-executive-summary-)
- [11.2 Objectives ](#112-objectives-)
- [11.3 Protocol-Level Security Annotations (Implementation Details) ](#113-protocol-level-security-annotations-implementation-details-)
- [11.3.1 JSON Schema ](#1131-json-schema-)
- [11.3.2 Code Examples (TypeScript/Python) ](#1132-code-examples-typescriptpython-)
- [11.3.3 Classification Levels ](#1133-classification-levels-)
- [11.3.4 Integrity Verification ](#1134-integrity-verification-)
- [11.4 Dynamic Security Context (DSC) - Initial Implementation ](#114-dynamic-security-context-dsc---initial-implementation-)
- [11.4.1 DSC Class Definition (TypeScript/Python) ](#1141-dsc-class-definition-typescriptpython-)
- [11.4.2 Trust Score Algorithm ](#1142-trust-score-algorithm-)
- [11.4.3 Secure Initialization ](#1143-secure-initialization-)
- [11.4.4 Code Examples (TypeScript/Python) ](#1144-code-examples-typescriptpython-)
- [11.5 Extensible Security Middleware (ESM) - Core Modules ](#115-extensible-security-middleware-esm---core-modules-)
- [11.5.1 ESM Module Interface ](#1151-esm-module-interface-)
- [11.5.2 Core Module Implementations ](#1152-core-module-implementations-)
- [11.5.3 ESM Configuration ](#1153-esm-configuration-)
- [11.5.4 Integration with MCP Client/Server ](#1154-integration-with-mcp-clientserver-)
- [11.6 Timeline and Deliverables ](#116-timeline-and-deliverables-)
- [11.7 Testing Strategy ](#117-testing-strategy-)
- [11.8 Resource Requirements ](#118-resource-requirements-)
- [11.9 Risk Mitigation ](#119-risk-mitigation-)
- [12. Future Enhancements and Roadmap ](#12-future-enhancements-and-roadmap--)
- [12.1 Short-Term (Phase 2 - 3-6 Months) ](#121-short-term-phase-2---3-6-months-)
- [12.2 Medium-Term (Phase 3 - 6-12 Months) ](#122-medium-term-phase-3---6-12-months-)
- [12.3 Long-Term (Phase 4 - 12+ Months) ](#123-long-term-phase-4---12-months-)
- [13. Community and Governance ](#13-community-and-governance--)
- [13.1 Guiding Principles ](#131-guiding-principles-)
- [13.2 Governance Structure ](#132-governance-structure-)
- [13.3 Contribution Process ](#133-contribution-process-)
- [13.4 Communication Channels ](#134-communication-channels-)
- [13.5 Code of Conduct ](#135-code-of-conduct-)
1. Introduction
Large Language Models (LLMs) are rapidly transforming various industries, but their power and complexity introduce significant security risks. The Model Context Protocol (MCP) aims to standardize communication between LLM applications and services. GUARDRAIL addresses the inherent security challenges by providing a comprehensive and incrementally adoptable security framework specifically tailored for MCP and other LLM application ecosystems. It is designed to be practical and easy to integrate, starting with simple enhancements and progressing to more advanced security measures.
2. Core Principles
GUARDRAIL is built on the following core principles:
- Information Flow Control: Strict policies govern the movement of information, preventing unauthorized data exfiltration and infiltration. This includes data classification and fine-grained control over data access.
- Contextual Security: Security decisions are made based on the dynamic execution context, including continuous trust assessment.
- Transport-Agnostic Protection: Security guarantees are provided regardless of the underlying transport mechanism.
- Least-Privilege Execution: All components operate with the minimum necessary permissions, granted just-in-time and revoked when no longer needed.
- Zero Trust: No component or user is inherently trusted. Continuous verification is required.
3. Architecture Overview
3.1 Security Layers
GUARDRAIL implements a multi-layered architecture, with each layer providing distinct security controls. These layers can be implemented incrementally, starting with the most critical.
flowchart TB
subgraph "MCP Client Environment"
MC[MCP Client]
end
subgraph "GUARDRAIL"
direction TB
IGL[Information Gateway Layer]
CVL[Context Verification Layer]
RCL[Request Control Layer]
ECL[Execution Containment Layer]
AML[Audit & Monitoring Layer]
IGL --> CVL
CVL --> RCL
RCL --> ECL
ECL --> AML
end
subgraph "MCP Server Environment"
MS[MCP Server]
end
MC -- "MCP Protocol" --> IGL
ECL -- "Contained Execution" --> MS
- Information Gateway Layer (IGL): Manages information flows, content classification, flow policy enforcement, and transport security. This is a primary focus for initial implementations.
- Context Verification Layer (CVL): Establishes trust through attestation and client/server verification. Can be added after the IGL is established.
- **Request Control Layer
…
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: nshkrdotcom
- Source: nshkrdotcom/GUARDRAIL
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.