kindly-guard-server

Crates.iokindly-guard-server
lib.rskindly-guard-server
version0.11.14
created_at2025-07-04 12:09:33.970262+00
updated_at2025-07-06 20:04:57.373957+00
descriptionKindlyGuard MCP server - Enterprise-grade security for AI model interactions
homepagehttps://github.com/kindly-software-inc/kindly-guard
repositoryhttps://github.com/samduchaine/kindly-guard
max_upload_size
id1737929
size8,056,223
SamDuchaine (SamDuchaine)

documentation

https://docs.rs/kindly-guard

README

KindlyGuard Server

A production-ready, security-focused MCP (Model Context Protocol) server that provides enterprise-grade protection for AI model interactions against Unicode attacks, injection attempts, and other security threats.

🎯 Production Status

Version 0.9.5 - Ready for Production Deployment

  • ✅ 100% security test coverage - all vulnerabilities fixed
  • ✅ Cross-platform support (Windows, Linux, macOS)
  • ✅ Enterprise features fully implemented
  • ✅ Performance optimized for high-throughput workloads
  • ✅ Battle-tested with 200+ comprehensive tests

Features

  • 🛡️ Comprehensive Threat Detection

    • Unicode exploit detection (invisible characters, BiDi attacks, homographs)
    • Injection prevention (SQL, command, path traversal, prompt injection)
    • XSS protection with context-aware sanitization
    • DoS protection with resource limits and circuit breakers
    • Real-time threat scanning with visual shield indicator
  • 🔐 Enterprise Security

    • OAuth 2.0 with Resource Indicators (RFC 8707)
    • Ed25519 message signing and verification
    • Fine-grained tool-level permissions
    • Configurable rate limiting with circuit breakers
    • Comprehensive audit logging
    • Constant-time cryptographic operations
  • ⚡ High Performance

    • 150+ MB/s Unicode scanning throughput
    • 200+ MB/s injection detection throughput
    • Sub-millisecond request latency
    • Lock-free statistics collection
    • SIMD-optimized pattern matching
    • Memory-efficient design (<50MB baseline)
  • 🎯 MCP Protocol Compliance

    • Full JSON-RPC 2.0 implementation
    • Standard MCP tools and resources
    • Compatible with all MCP clients
    • Extensive protocol test coverage

Installation

From crates.io

cargo install kindly-guard-server

From source

git clone https://github.com/kindlyguard/kindly-guard
cd kindly-guard
cargo build --release

Quick Start

  1. Create a configuration file:
# kindly-guard.yaml
scanner:
  unicode_detection: true
  injection_detection: true

auth:
  enabled: true
  allowed_clients:
    - client_id: "my-app"
      secret: "change-me"
      allowed_scopes: ["tools:execute"]
  1. Start the server:
kindly-guard --stdio
  1. Connect with any MCP client!

Usage

Stdio Mode (Recommended for MCP)

kindly-guard --stdio

With Configuration

kindly-guard --config /path/to/config.yaml --stdio

Systemd Service

# Install service
sudo ./systemd/install.sh

# Start service
sudo systemctl start kindly-guard

Configuration

See CONFIGURATION.md for detailed configuration options.

Minimal Configuration

scanner:
  unicode_detection: true
  injection_detection: true

auth:
  enabled: false  # Only for testing!

Production Configuration

scanner:
  unicode_detection: true
  injection_detection: true
  max_scan_depth: 10

auth:
  enabled: true
  require_resource_indicators: true
  allowed_clients:
    - client_id: "production-app"
      secret: "$2b$10$..."  # bcrypt hash
      allowed_scopes: ["tools:execute", "resources:read"]

rate_limit:
  enabled: true
  default_rpm: 60
  threat_penalty_multiplier: 2.0

signing:
  enabled: true
  private_key_path: "/etc/kindly-guard/keys/private.pem"

Tools

scan_text

Scan text for security threats:

{
  "name": "scan_text",
  "arguments": {
    "text": "Check this content",
    "context": "user_input"
  }
}

verify_signature

Verify message signatures:

{
  "name": "verify_signature",
  "arguments": {
    "message": "Important data",
    "signature": "base64-signature"
  }
}

get_security_info

Get security information:

{
  "name": "get_security_info",
  "arguments": {
    "topic": "unicode"
  }
}

Security Features

Shield Status Indicators

  • 🟢 Green Shield - Active protection
  • 🔴 Red Shield - Threat detected
  • Gray Shield - Inactive

Threat Categories

  • Unicode Exploits - Zero-width spaces, BiDi overrides, homographs
  • Injection Attacks - SQL, command, path traversal, prompt injection
  • Authentication - OAuth 2.0 with secure token management
  • Rate Limiting - Configurable limits with automatic penalties

API Documentation

See API.md for complete API documentation.

Development

Building

cargo build --release

Testing Excellence

KindlyGuard implements a comprehensive testing strategy with 100% security coverage:

# Run all tests (235+ tests)
cargo test --all-features

# Run security-specific tests (58 tests, 100% passing)
cargo test --test security_tests

# Run cross-platform tests
cargo test --test cross_platform_security

# Run performance benchmarks
cargo bench

# Run with coverage report
cargo tarpaulin --out Html

# Run complete test suite
./run-all-tests.sh

Test Coverage Highlights

  • Security Tests: 100% coverage, all vulnerabilities fixed
  • Unicode Detection: Complete coverage of all Unicode threats
  • Injection Prevention: Cross-platform detection (Windows/Linux/macOS)
  • DoS Protection: Resource exhaustion prevention validated
  • Authentication: Constant-time operations verified
  • Performance: No regressions, 15% improvement over v0.9.0

Benchmarks

# Run all benchmarks
cargo bench

# Run comparative benchmarks (Standard vs Enhanced)
cargo bench --bench comparative_benchmarks

# Save baseline for comparison
cargo bench -- --save-baseline main

# Compare against baseline
cargo bench -- --baseline main

Comprehensive Testing

# Run complete test suite
./run-all-tests.sh

# Run with CI configuration
./run-all-tests.sh --ci

# Run with coverage
./run-all-tests.sh --coverage

Our testing infrastructure ensures:

  • Security Parity: Both standard and enhanced implementations detect identical threats
  • Performance Tracking: Continuous monitoring of performance metrics
  • Fault Tolerance: Chaos engineering validates resilience
  • Real-world Scenarios: Integration tests cover production use cases

Recent Improvements (v0.9.5)

Security Enhancements

  • ✅ Fixed all timing attack vulnerabilities
  • ✅ Enhanced path traversal detection
  • ✅ Added DoS protection mechanisms
  • ✅ Implemented compression bomb detection
  • ✅ Cross-platform command injection patterns

Performance Optimizations

  • ✅ 15% throughput improvement in Unicode scanning
  • ✅ SIMD acceleration for pattern matching
  • ✅ Lock-free metrics collection
  • ✅ Optimized memory allocation patterns

Architecture Improvements

  • ✅ Full trait-based architecture
  • ✅ Runtime implementation selection
  • ✅ Enhanced resilience components
  • ✅ Improved error handling throughout

License

Licensed under either of:

at your option.

Contributing

Contributions are welcome! Please read our Contributing Guide for details.

Security

For security issues, please email security@kindlyguard.dev instead of using the issue tracker.

Commit count: 0

cargo fmt