Skip to main content
Glama
Brand Safety MCP

Brand Safety MCP

by sapochat

Brand Safety MCP

License: MIT TypeScript MCP Architecture

A Model Context Protocol (MCP) server that actually checks if your AI-generated content sounds like your brand and won't get you cancelled. Built with clean architecture so you can extend it without wanting to rewrite everything.

πŸš€ What's New in v2.0

Actually Useful Features

  • 🎯 Batch Processing - Process multiple pieces of content at once (up to 100 items concurrently). No more one-at-a-time validation.

  • πŸ”Œ Plugin System - Add your own custom validators without touching the core code. Three types: evaluation plugins, enrichers, and formatters. Drop in a JavaScript file and you're good.

  • πŸ› οΈ Real CLI Tools - brand-mcp validate, brand-mcp test, brand-mcp batch - actual command line tools instead of just running the server.

  • πŸ“Š Smarter Analysis - Goes beyond basic checks. Now includes semantic analysis, context-aware validation (what works on LinkedIn might not on TikTok), pattern recognition, and confidence scoring.

  • 🌍 Multi-language Support - Built-in language detection and analysis for 15+ languages. Because not everyone speaks English.

  • πŸ’‘ Recommendation Engine - Doesn't just flag issues, actually suggests fixes prioritized by impact.

Clean Architecture That Makes Sense

  • πŸ—οΈ Hexagonal Architecture - Business logic separated from MCP protocol stuff. Swap implementations without breaking everything.

  • πŸ’‰ Dependency Injection - Services composed at runtime, not hardcoded. Makes testing actually possible.

  • 🎭 Advanced Tone Analysis - Multi-dimensional tone detection that understands context and emotion.

Related MCP server: ChuangSi AI Model Content Protection

Table of Contents

Overview

Brand Safety MCP keeps your AI from saying dumb stuff that doesn't sound like you:

  • πŸ›‘οΈ Safety Checks: 12+ categories so you don't accidentally generate something terrible

  • βœ… Brand Voice: Makes sure content actually sounds like your brand, not generic AI slop

  • 🎯 Context Aware: Different rules for different platforms (LinkedIn vs TikTok vs docs)

  • πŸ“Š Useful Reports: Tells you what's wrong AND how to fix it

  • ⚑ Actually Fast: <100ms responses, handles 1000+ requests/second

  • 🌍 Works Globally: 15+ languages with cultural sensitivity built in

  • πŸ”Œ Extensible: Add your own rules without forking the whole project

Quick Start

# Clone and setup
git clone https://github.com/sapochat/brand-mcp.git
cd brand-mcp
npm install
npm run build

# Start the MCP server
npm start

# Or use CLI for quick evaluation
npx brand-mcp validate "Your content here"

Architecture

This project uses Hexagonal Architecture (Ports and Adapters) for maximum flexibility:

src/
β”œβ”€β”€ domain/           # Pure business logic (no external dependencies)
β”‚   β”œβ”€β”€ entities/     # Core business entities
β”‚   β”œβ”€β”€ services/     # Domain services & business rules
β”‚   └── repositories/ # Repository interfaces
β”œβ”€β”€ application/      # Use cases & orchestration
β”œβ”€β”€ adapters/         # External interfaces
β”‚   β”œβ”€β”€ primary/      # MCP protocol adapter
β”‚   └── secondary/    # File system, caching
β”œβ”€β”€ infrastructure/   # DI container & cross-cutting concerns
β”œβ”€β”€ cli/             # Command-line interface
└── plugins/         # Extensible plugin system

Features

πŸ›‘οΈ Safety Evaluation

Comprehensive content screening across multiple categories:

  • Content Categories: Violence, Hate Speech, Harassment, Self-Harm, etc.

  • Risk Levels: NONE | LOW | MEDIUM | HIGH | CRITICAL

  • Contextual Analysis: Understands nuance and intent

  • False Positive Reduction: Bayesian probability with confidence scoring

βœ… Brand Compliance

Ensure content aligns with your brand:

  • Tone Analysis: Primary, secondary, and avoided tones

  • Voice Guidelines: Contractions, pronouns, sentence structure

  • Terminology: Preferred terms, prohibited words, proper nouns

  • Visual Identity: Colors, typography, imagery guidelines

  • Context Rules: Different rules for different platforms

🌍 Multi-Language Support

Global content evaluation:

// Automatic language detection
const result = await analyzer.detectLanguage(content);
// Returns: { language: 'es', confidence: 0.95, script: 'Latin' }

// Cultural sensitivity checks
const cultural = await analyzer.analyzeCulturalSensitivity(content);
// Returns warnings about cultural considerations

πŸ“Š Confidence Scoring

Know when to trust automated evaluations:

const confidence = await scorer.calculateConfidence(context);
// Returns: {
//   score: 0.87,
//   level: 'high',
//   factors: { dataQuality: 0.9, consistency: 0.85 },
//   recommendation: 'Suitable for automated approval'
// }

πŸ’‘ Smart Recommendations

Get actionable improvement suggestions:

const recommendations = await engine.generateRecommendations(result);
// Returns prioritized action items with impact/effort matrix

πŸ₯ Industry Validators

Built-in validators for regulated content:

  • Healthcare: HIPAA checks, medical claims validation

  • Financial: SEC compliance, risk disclosures

  • Legal: Ethics rules, confidentiality checks

Installation

Requirements

  • Node.js 22.12+ (LTS recommended)

  • TypeScript 5.3+

  • npm or yarn

Setup

# Install globally for CLI usage
npm install -g brand-safety-mcp

# Or add to your project
npm install brand-safety-mcp

Configuration

Basic Configuration

Edit brandSchema.js in the root directory:

export const activeBrandProfile = {
  name: "YourBrand",
  description: "Your brand description",
  
  toneGuidelines: {
    primaryTone: "confident",
    secondaryTones: ["optimistic", "innovative"],
    avoidedTones: ["pessimistic", "condescending"]
  },
  
  voiceGuidelines: {
    personality: "knowledgeable but accessible",
    usesContractions: true,
    usesPronoun: {
      firstPerson: true,  // "we", "our"
      secondPerson: true  // "you", "your"
    }
  },
  
  terminologyGuidelines: {
    avoidedGlobalTerms: ["leverage", "synergy", "disrupt"],
    preferredTerms: [
      {
        preferred: "artificial intelligence",
        alternatives: ["AI"],
        contexts: ["formal", "first-mention"]
      }
    ]
  }
};

Advanced Configuration

Custom Rules Engine

// Add custom validation rules
const rule = {
  id: 'custom-medical-claims',
  name: 'Medical Claims Validator',
  condition: (content) => content.includes('cures') || content.includes('treats'),
  action: 'flag',
  severity: 'high',
  message: 'Medical claims require FDA approval'
};

engine.addRule(rule);

Plugin Development

// Create custom plugin
export class CustomValidator {
  async evaluate(content, context) {
    // Your custom logic
    return {
      score: 95,
      issues: [],
      recommendations: []
    };
  }
}

// Register plugin
brand-mcp plugin add ./custom-validator.js

CLI Usage

The Brand MCP includes a comprehensive CLI for developers:

Content Validation

# Quick validation
brand-mcp validate "Your content here"

# With context
brand-mcp validate "Content" --context social-media

# Validate file
brand-mcp validate -f content.txt --type combined

Batch Processing

# Process CSV file
brand-mcp batch process content.csv --output results.json

# Process with specific evaluations
brand-mcp batch process data.csv --type safety --format json

Configuration Management

# View current config
brand-mcp config view

# Update specific setting
brand-mcp config set safety.threshold 0.8

# Reset to defaults
brand-mcp config reset

Plugin Management

# List installed plugins
brand-mcp plugin list

# Add new plugin
brand-mcp plugin add ./my-plugin.js

# Remove plugin
brand-mcp plugin remove plugin-id

Testing

# Run test scenarios
brand-mcp test --scenario risky

# Test with custom content
brand-mcp test --input "Test content" --expected-risk high

API Reference

Tools

safety-check

Analyzes content for safety risks across all categories.

{
  name: 'safety-check',
  arguments: {
    content: string,
    context?: string
  }
}

check-compliance

Evaluates brand compliance with detailed scoring.

{
  name: 'check-compliance',
  arguments: {
    content: string,
    context?: string
  }
}

evaluate-content

Combined safety and compliance evaluation.

{
  name: 'evaluate-content',
  arguments: {
    content: string,
    context?: string,
    includeSafety?: boolean,
    includeBrand?: boolean,
    brandWeight?: number,
    safetyWeight?: number
  }
}

batch-evaluation

Process multiple content items efficiently.

{
  name: 'batch-evaluation',
  arguments: {
    items: Array<{
      id?: string,
      content: string,
      context?: string
    }>,
    evaluationType?: 'safety' | 'compliance' | 'combined'
  }
}

update-config

Update brand safety configuration at runtime.

{
  name: 'update-config',
  arguments: {
    sensitiveKeywords?: string[],
    allowedTopics?: string[],
    blockedTopics?: string[],
    riskTolerances?: Record<string, string>
  }
}

Advanced Features

Batch Processing

Process large content libraries efficiently:

const results = await client.callTool({
  name: 'batch-evaluation',
  arguments: {
    items: contentArray,
    evaluationType: 'combined'
  }
});

// Returns:
// {
//   results: [...],
//   statistics: { processed: 100, failed: 0 },
//   commonIssues: [...],
//   processingTime: 1234
// }

Multi-Language Analysis

const analysis = await analyzer.analyzeContent(content);
// Automatically detects language and applies appropriate rules

// Supports:
// - English, Spanish, French, German, Italian, Portuguese
// - Chinese, Japanese, Korean
// - Arabic, Hebrew, Russian
// - Hindi, Bengali, Tamil

Confidence Scoring

const evaluation = await evaluator.evaluate(content);
// Returns confidence metrics with each evaluation

// confidence: {
//   overall: 0.92,
//   breakdown: {
//     dataQuality: 0.95,
//     ruleMatches: 0.88,
//     consistency: 0.93
//   }
// }

Smart Recommendations

const recommendations = await engine.generateRecommendations(result, {
  strategy: 'quick-wins',  // or 'safety-first', 'compliance-focused', 'balanced'
  maxRecommendations: 10
});

// Returns prioritized, actionable improvements with:
// - Impact/effort matrix
// - Implementation roadmap
// - Estimated timeline
// - Success metrics

Claude Desktop Integration

Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "brand-safety": {
      "command": "node",
      "args": ["/absolute/path/to/brand-mcp/dist/main.js"],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}

Or if published to npm:

{
  "mcpServers": {
    "brand-safety": {
      "command": "npx",
      "args": ["-y", "brand-safety-mcp"]
    }
  }
}

Natural Language Usage

Once configured, interact naturally with Claude:

"Check this marketing copy for brand compliance: 'We're leveraging cutting-edge AI to disrupt the industry.'"

Claude will automatically use the Brand MCP tools and provide formatted feedback.

Claude Code Skills

This project includes Claude Code skills for AI-assisted development:

.claude/skills/
β”œβ”€β”€ evaluate.md    # Brand safety evaluation skill
β”œβ”€β”€ compliance.md  # Brand compliance check skill
└── batch.md       # Batch evaluation skill

Using Skills

When working with Claude Code, reference the skills for guidance:

  • /evaluate - Check content for brand safety

  • /compliance - Verify brand guideline compliance

  • /batch - Process multiple content items

See also AGENTS.md for multi-agent coordination guidelines.

Development

Project Structure

npm run dev          # Development with auto-reload
npm run build        # Production build
npm run test:unit    # Run unit tests
npm run test:coverage # Coverage report
npm run lint         # Code linting
npm run format       # Code formatting

Testing

// Unit test example
describe('SafetyEvaluator', () => {
  it('should detect high-risk content', async () => {
    const result = await evaluator.evaluate('harmful content');
    expect(result.riskLevel).toBe('HIGH');
  });
});

Debugging

Enable debug logging:

NODE_ENV=development DEBUG=brand-mcp:* npm start

Performance

Metrics

  • Response Time: <100ms average

  • Throughput: 1000+ requests/second

  • Memory: <50MB footprint

  • Accuracy: 95% confidence in evaluations

Optimization Tips

  1. Enable Caching: Reduces repeated evaluations

  2. Use Batch Processing: More efficient for multiple items

  3. Configure Thresholds: Adjust sensitivity for your needs

  4. Selective Categories: Only check relevant safety categories

Security

Built-in Protections

  • βœ… Input validation with Zod schemas

  • βœ… Path traversal protection with defense-in-depth validation

  • βœ… Symlink attack prevention in plugin system

  • βœ… Execute permission removal for plugin files

  • βœ… Rate limiting (configurable)

  • βœ… Safe error handling

  • βœ… No eval() or dynamic execution

  • βœ… Secure file operations with lstat protection

Best Practices

  1. Always validate input content length

  2. Use environment variables for sensitive config

  3. Implement authentication for production

  4. Regular security audits with npm audit

  5. Keep dependencies updated

Contributing

We welcome contributions! See:

Development Setup

# Fork and clone
git clone https://github.com/sapochat/brand-mcp.git

# Create feature branch
git checkout -b feature/your-feature

# Make changes and test
npm run test:unit
npm run lint

# Submit PR

Support

License

MIT License - See LICENSE file for details.


Available Tools

5 tools
batch-evaluationC
Read-only

Evaluate multiple content pieces in a single batch operation

Inputs: items (required), includeBrand, includeSafety, evaluationType.

check-complianceC
Read-only

Evaluate content for compliance with brand guidelines

Inputs: content (required), context.

evaluate-contentC
Read-only

Perform a combined evaluation for both brand safety and brand compliance

Inputs: content (required), context, brandWeight, includeBrand, +2 more.

safety-checkC
Read-only

Analyze text content for brand safety concerns

Inputs: content (required), context.

update-configC

Update brand safety configuration settings

Inputs: allowedTopics, blockedTopics, riskTolerances, sensitiveKeywords.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 5 tools

    Disambiguation4/5

    Each tool has a reasonably distinct purpose: safety checking, compliance checking, combined evaluation, batch evaluation, and configuration updates. The main potential confusion is between evaluate-content and the two single-purpose checks, but the description explicitly frames it as a combined operation, making the relationship clear. Batch-evaluation is also distinguishable by its multi-item scope.

    Naming Consistency3/5

    All names use kebab-case, but the word order is inconsistent: check-compliance, evaluate-content, and update-config are verb-first, while safety-check and batch-evaluation are noun-first. The pattern is readable but not predictable enough for a top score.

    Tool Count5/5

    Five tools is well-scoped for a brand safety server, balancing single checks, combined evaluation, batch processing, and configuration. Each tool appears to earn its place without redundant surface area.

    Completeness4/5

    The server covers the core lifecycle of checking safety, checking compliance, combined evaluation, batch evaluation, and updating configuration. Minor gaps exist, such as retrieving current configuration or accessing prior evaluation results, but agents can work around them.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides AI security guardrails through Javelin's platform to detect harmful content, prompt injection attempts, and language policies. Enables comprehensive content safety analysis with trust & safety detection, prompt injection protection, and language identification.
      1
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides real-time content safety protection for large language models by detecting and preventing risks in both input and output content across multiple dimensions including compliance, ethics, and security.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides advanced evaluation tools for assessing AI safety, alignment, and performance of LLM outputs. Enables programmatic evaluation of quality, safety metrics like toxicity and PII detection, and operational metrics including carbon footprint and cost estimation.
      4
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides real-time content security for large language models by identifying and intercepting risks across compliance, ethics, and safety dimensions. It enables secure input and output monitoring through a customizable policy engine using an SSE-based interface.
      1
      MIT