glin-profanity-mcp

glin-profanity-mcp

Content moderation and profanity detection MCP server with 19 tools, 24 language support, leetspeak/Unicode obfuscation detection, context-aware analysis, batch processing, and user tracking for AI-powered content safety.

Category
访问服务器

README

<h1 align="center">GLIN PROFANITY</h1>

<p align="center"> <strong>ML-Powered Profanity Detection for the Modern Web</strong> </p>

<!-- Badges Row 1: Package Info --> <p align="center"> <a href="https://www.npmjs.com/package/glin-profanity"><img src="https://img.shields.io/npm/v/glin-profanity?style=flat-square&logo=npm&logoColor=white&label=npm" alt="npm version" /></a> <a href="https://pypi.org/project/glin-profanity/"><img src="https://img.shields.io/pypi/v/glin-profanity?style=flat-square&logo=pypi&logoColor=white&label=pypi" alt="PyPI version" /></a> <a href="https://www.npmjs.com/package/glin-profanity"><img src="https://img.shields.io/npm/dm/glin-profanity?style=flat-square&logo=npm&logoColor=white&label=npm%20downloads" alt="npm downloads" /></a> <a href="https://pepy.tech/projects/glin-profanity"><img src="https://img.shields.io/pepy/dt/glin-profanity?style=flat-square&logo=pypi&logoColor=white&label=pypi%20downloads" alt="PyPI downloads" /></a> </p>

<!-- Badges Row 2: Quality & Status --> <p align="center"> <a href="https://github.com/GLINCKER/glin-profanity/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/GLINCKER/glin-profanity/ci.yml?style=flat-square&logo=github&label=CI" alt="CI Status" /></a> <a href="https://bundlephobia.com/package/glin-profanity"><img src="https://img.shields.io/bundlephobia/minzip/glin-profanity?style=flat-square&logo=webpack&logoColor=white&label=bundle%20size" alt="Bundle Size" /></a> <a href="https://github.com/GLINCKER/glin-profanity/blob/main/LICENSE"><img src="https://img.shields.io/github/license/GLINCKER/glin-profanity?style=flat-square&label=license" alt="License" /></a> <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Ready-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript" /></a> </p>

<!-- Badges Row 3: Community --> <p align="center"> <a href="https://github.com/GLINCKER/glin-profanity/stargazers"><img src="https://img.shields.io/github/stars/GLINCKER/glin-profanity?style=flat-square&logo=github&label=stars" alt="GitHub Stars" /></a> <a href="https://github.com/GLINCKER/glin-profanity/network/members"><img src="https://img.shields.io/github/forks/GLINCKER/glin-profanity?style=flat-square&logo=github&label=forks" alt="GitHub Forks" /></a> <a href="https://github.com/GLINCKER/glin-profanity/issues"><img src="https://img.shields.io/github/issues/GLINCKER/glin-profanity?style=flat-square&logo=github&label=issues" alt="GitHub Issues" /></a> <a href="https://github.com/GLINCKER/glin-profanity/graphs/contributors"><img src="https://img.shields.io/github/contributors/GLINCKER/glin-profanity?style=flat-square&logo=github&label=contributors" alt="Contributors" /></a> </p>

<!-- Hero Image --> <p align="center"> <a href="https://www.glincker.com/tools/glin-profanity" target="_blank"> <img src="./og-image.png" alt="Glin Profanity - ML-Powered Profanity Detection" width="800" /> </a> </p>

<p align="center"> <a href="https://www.glincker.com/tools/glin-profanity"><img src="https://img.shields.io/badge/Try_Live_Demo-online-blue?style=for-the-badge&logo=vercel&logoColor=white" alt="Live Demo" /></a> </p>


📦 Packages

This monorepo maintains the following packages:

Package Version Description
glin-profanity npm Core profanity filter for JavaScript/TypeScript
glin-profanity PyPI Core profanity filter for Python
glin-profanity-mcp npm MCP server for AI assistants (Claude, Cursor, etc.)
openclaw-profanity npm Plugin for OpenClaw/Moltbot AI agents

Why Glin Profanity?

Most profanity filters are trivially bypassed. Users type f*ck, sh1t, or fսck (with Cyrillic characters) and walk right through. Glin Profanity doesn't just check against a word list—it understands evasion tactics.

┌─────────────────────────────────────────────────────────────────────────────┐
│                           GLIN PROFANITY v3                                 │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│   Input Text ──►  Unicode       ──►  Leetspeak    ──►  Dictionary  ──► ML  │
│                   Normalization      Detection         Matching        Check│
│                   (homoglyphs)       (f4ck→fuck)       (23 langs)     (opt) │
│                                                                             │
│   "fսck"     ──►  "fuck"        ──►  "fuck"       ──►  MATCH       ──► ✓   │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

Performance Benchmarks

Tested on Node.js 20, M1 MacBook Pro, single-threaded:

Operation Glin Profanity bad-words leo-profanity obscenity
Simple check 21M ops/sec 890K ops/sec 1.2M ops/sec 650K ops/sec
With leetspeak 8.5M ops/sec N/A N/A N/A
Multi-language (3) 18M ops/sec N/A 400K ops/sec N/A
Unicode normalization 15M ops/sec N/A N/A N/A

Feature Comparison

Feature Glin Profanity bad-words leo-profanity obscenity
Leetspeak detection (f4ck, sh1t) Yes No No Partial
Unicode homoglyph detection Yes No No No
ML toxicity detection Yes (TensorFlow.js) No No No
Multi-language support 23 languages English only 14 languages English only
Result caching (LRU) Yes No No No
Severity levels Yes No No No
React hook Yes No No No
Python package Yes No No No
TypeScript types Full Partial Partial Full
Bundle size (minified) 12KB + dictionaries 8KB 15KB 6KB
Active maintenance Yes Limited Limited Limited

Installation

JavaScript/TypeScript

npm install glin-profanity

Python

pip install glin-profanity

Quick Start

JavaScript

import { checkProfanity, Filter } from 'glin-profanity';

// Simple check
const result = checkProfanity("This is f4ck1ng bad", {
  detectLeetspeak: true,
  languages: ['english']
});

result.containsProfanity  // true
result.profaneWords       // ['fucking']

// With replacement
const filter = new Filter({
  replaceWith: '***',
  detectLeetspeak: true
});
filter.checkProfanity("sh1t happens").processedText  // "*** happens"

Python

from glin_profanity import Filter

filter = Filter({"languages": ["english"], "replace_with": "***"})

filter.is_profane("damn this")           # True
filter.check_profanity("damn this")      # Full result object

React

import { useProfanityChecker } from 'glin-profanity';

function ChatInput() {
  const { result, checkText } = useProfanityChecker({
    detectLeetspeak: true
  });

  return (
    <input onChange={(e) => checkText(e.target.value)} />
    {result?.containsProfanity && <span>Clean up your language</span>}
  );
}

Architecture

flowchart LR
    subgraph Input
        A[Raw Text]
    end

    subgraph Processing
        B[Unicode Normalizer]
        C[Leetspeak Decoder]
        D[Word Tokenizer]
    end

    subgraph Detection
        E[Dictionary Matcher]
        F[Fuzzy Matcher]
        G[ML Toxicity Model]
    end

    subgraph Output
        H[Result Object]
    end

    A --> B --> C --> D
    D --> E --> H
    D --> F --> H
    D -.->|Optional| G -.-> H

Detection Capabilities

Leetspeak Detection

const filter = new Filter({
  detectLeetspeak: true,
  leetspeakLevel: 'aggressive'  // basic | moderate | aggressive
});

filter.isProfane('f4ck');     // true
filter.isProfane('5h1t');     // true
filter.isProfane('@$$');      // true
filter.isProfane('ph.u" "ck'); // true (aggressive mode)

Unicode Homoglyph Detection

const filter = new Filter({ normalizeUnicode: true });

filter.isProfane('fսck');   // true (Armenian 'ս' → 'u')
filter.isProfane('shіt');   // true (Cyrillic 'і' → 'i')
filter.isProfane('ƒuck');   // true (Latin 'ƒ' → 'f')

ML-Powered Detection

import { loadToxicityModel, checkToxicity } from 'glin-profanity/ml';

await loadToxicityModel({ threshold: 0.9 });

const result = await checkToxicity("You're the worst player ever");
// { toxic: true, categories: { toxicity: 0.92, insult: 0.87, ... } }

Supported Languages

23 languages with curated dictionaries:

Arabic Chinese Czech Danish
Dutch English Esperanto Finnish
French German Hindi Hungarian
Italian Japanese Korean Norwegian
Persian Polish Portuguese Russian
Spanish Swedish Thai Turkish

Documentation

Document Description
Getting Started Installation and basic usage
API Reference Complete API documentation
Framework Examples React, Vue, Angular, Express, Next.js
Advanced Features Leetspeak, Unicode, ML, caching
ML Guide TensorFlow.js integration
Changelog Version history

Local Testing Interface

Run the interactive playground locally to test profanity detection:

# Clone the repo
git clone https://github.com/GLINCKER/glin-profanity.git
cd glin-profanity/packages/js

# Install dependencies
npm install

# Start the local testing server
npm run dev:playground

Open http://localhost:4000 to access the testing interface with:

  • Real-time profanity detection
  • Toggle leetspeak, Unicode normalization, ML detection
  • Multi-language selection
  • Visual results with severity indicators

Use Cases

Application How Glin Profanity Helps
Chat platforms Real-time message filtering with React hook
Gaming Detect obfuscated profanity in player names/chat
Social media Scale moderation with ML-powered detection
Education Maintain safe learning environments
Enterprise Filter internal communications
AI/ML pipelines Clean training data before model ingestion

MCP Server for AI Assistants

Glin Profanity includes an MCP (Model Context Protocol) server that enables AI assistants like Claude Desktop, Cursor, Windsurf, and other MCP-compatible tools to use profanity detection as a native tool.

Quick Setup

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "glin-profanity": {
      "command": "npx",
      "args": ["-y", "glin-profanity-mcp"]
    }
  }
}

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "glin-profanity": {
      "command": "npx",
      "args": ["-y", "glin-profanity-mcp"]
    }
  }
}

Available Tools (19)

Tool Description
check_profanity Check text for profanity with detailed results
censor_text Censor profanity with configurable replacement
analyze_context Context-aware analysis with domain whitelists
batch_check Check multiple texts in one operation
validate_content Content validation with safety scoring (0-100)
detect_obfuscation Detect leetspeak and Unicode tricks
get_supported_languages List all 24 supported languages
explain_match Explain why text was flagged with reasoning
suggest_alternatives Suggest clean alternatives for profane content
analyze_corpus Analyze up to 500 texts for moderation stats
compare_strictness Compare results across strictness levels
create_regex_pattern Generate regex patterns for custom detection
track_user_message Track user messages for repeat offender detection
get_user_profile Get moderation profile for a specific user
get_high_risk_users List users with high violation rates
reset_user_profile Reset a user's moderation history
stream_check Real-time streaming profanity check
stream_batch Stream multiple texts with live results
get_stream_stats Get streaming session statistics

Plus 4 workflow prompts and 5 reference resources for guided AI interactions.

Example Prompts for AI Assistants

"Check this user comment for profanity using glin-profanity"
"Validate this blog post content with high strictness"
"Batch check these 50 messages for any inappropriate content"
"Analyze this medical text with the medical domain context"

See the full MCP documentation for setup instructions and examples.


Roadmap

See our ROADMAP.md for planned features including:

  • Streaming support for real-time chat
  • OpenAI function calling integration
  • Image OCR for profanity in images
  • Edge deployment (Cloudflare Workers, Vercel Edge)
  • More framework integrations

License

MIT License - free for personal and commercial use.

Enterprise licensing with SLA and support available from GLINCKER.


Contributing

See CONTRIBUTING.md for guidelines. We welcome:

  • Bug reports and fixes
  • New language dictionaries
  • Performance improvements
  • Documentation updates

Star History

<a href="https://star-history.com/#GLINCKER/glin-profanity&Date"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=GLINCKER/glin-profanity&type=Date&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=GLINCKER/glin-profanity&type=Date" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=GLINCKER/glin-profanity&type=Date" /> </picture> </a>


<div align="center">

Live Demo · NPM · PyPI · GitHub

<br />

<a href="https://github.com/GLINCKER/glin-profanity/stargazers"> <img src="https://img.shields.io/github/stars/GLINCKER/glin-profanity?style=social" alt="Star on GitHub" /> </a>

<br /><br />

<sub>Built by <a href="https://glincker.com">GLINCKER</a> · Part of the <a href="https://github.com/GLINCKER">GLINR</a> ecosystem</sub>

</div>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选