Perspective API Alternative (Toxicity Detection)

السجل الرسمي الذكاء الاصطناعي والوكلاء

Toxicity scores (0-1) for text before an agent posts it. Perspective API compatible. No LLM.

التثبيت

أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: ‏.cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).

Remote (streamable-http)
Claude Code
claude mcp add --transport http perspective-api-alternative-toxicity-det 'https://koyourmoon--perspective-api-alternative.apify.actor/mcp' --header 'Authorization: <Bearer <your Apify API token>>'
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "perspective-api-alternative-toxicity-det": {
            "type": "http",
            "url": "https://koyourmoon--perspective-api-alternative.apify.actor/mcp",
            "headers": {
                "Authorization": "<Bearer <your Apify API token>>"
            }
        }
    }
}

التوثيق

مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.

المحتويات
  1. Perspective API Alternative: Toxicity Detection MCP Server
  2. How the server operates
  3. Requirements
  4. Installation
  5. Tool: analyze_toxicity
  6. Environment variables
  7. Prices
  8. Remote connection (optional)
  9. Files
  10. Links
  11. License

Perspective API Alternative: Toxicity Detection MCP Server

This repository contains an MCP server for the stdio transport. The server gives AI agents one tool, analyze_toxicity. Use the tool to examine text before an agent publishes it.

The tool returns six scores from 0 to 1 and a flagged value for each text:

  • TOXICITY, SEVERE_TOXICITY, INSULT, PROFANITY, THREAT, IDENTITY_ATTACK

The scores come from the open-source Detoxify model. The model is not an LLM. Thus, the same text always gets the same score. English only.

The request and response format is the same as the format of the Google Perspective API. Google stops the Perspective API on December 31, 2026.

How the server operates

The server implementation is server.py in this repository. It uses only the Python standard library (Python 3.9 or later).

  • The server reads JSON-RPC messages from stdin and writes the responses to stdout.
  • The server answers initialize, ping and tools/list itself. These messages do not need a token.
  • For tools/call, the server sends the texts to the toxicity API on Apify, and returns the scores.
  • The toxicity API runs the Detoxify model. You pay for each call through your Apify account.

Requirements

  • Python 3.9 or later, or Docker
  • An Apify API token in the APIFY_TOKEN environment variable

To get a token, open the Apify Console. Then go to Settings > API & Integrations.

Installation

Python
  1. Clone the repository:
     git clone https://github.com/koyourmoon/perspective-api-alternative-mcp.git
  2. Add the server to the configuration of your MCP client:
     {
       "mcpServers": {
         "perspective-api-alternative": {
           "command": "python",
           "args": ["/path/to/perspective-api-alternative-mcp/server.py"],
           "env": { "APIFY_TOKEN": "<APIFY_TOKEN>" }
         }
       }
     }
Docker
  1. Build the image:
     docker build -t perspective-api-alternative-mcp .
  2. Add the server to the configuration of your MCP client:
     {
       "mcpServers": {
         "perspective-api-alternative": {
           "command": "docker",
           "args": ["run", "-i", "--rm", "-e", "APIFY_TOKEN", "perspective-api-alternative-mcp"],
           "env": { "APIFY_TOKEN": "<APIFY_TOKEN>" }
         }
       }
     }

Tool: analyze_toxicity

ParameterTypeDescription
textsarray of strings, required1 to 100 English texts to score
attributesarray of stringsAttributes to return. The default is all six.
thresholdnumberTOXICITY score at which a text is flagged. The default is 0.5.

Example result for one text:

{
  "results": [
    {
      "text": "You are an idiot.",
      "scores": { "TOXICITY": 0.98, "INSULT": 0.95, "PROFANITY": 0.62 },
      "flagged": true,
      "billed_units": 1
    }
  ]
}

If a text looks non-English, the result has a warning field. The scores for that text are not reliable.

Environment variables

NameRequiredDescription
APIFY_TOKENYes, for tools/callYour Apify API token
PERSPECTIVE_ALT_URLNoA different URL for the toxicity API

Prices

  • $0.50 for 1,000 text units. A text unit is each started 1,000 characters of a text. Most comments are 1 unit.
  • Lower prices for Apify Bronze, Silver and Gold plans.
  • The first call after an idle period of 60 seconds can take 10 to 30 seconds (cold start).

Remote connection (optional)

You can also connect your MCP client directly to the toxicity API. This connection does not use server.py.

ItemValue
TransportStreamable HTTP
URLhttps://koyourmoon--perspective-api-alternative.apify.actor/mcp
AuthenticationAuthorization: Bearer <APIFY_TOKEN>

Files

FileContent
server.pyThe MCP server
DockerfileThe container image for the server
glama.jsonThe maintainer data for Glama
server.jsonThe entry for the official MCP Registry

License

MIT. This project is not affiliated with Google or Jigsaw. "Perspective API" is a trademark of Google LLC.

الأسئلة الشائعة

ما هو Perspective API Alternative (Toxicity Detection)؟

Toxicity scores (0-1) for text before an agent posts it. Perspective API compatible. No LLM.

كيف أثبّت Perspective API Alternative (Toxicity Detection)؟

يعمل كخادم بعيد. في Claude Code: claude mcp add --transport http perspective-api-alternative-toxicity-det 'https://koyourmoon--perspective-api-alternative.apify.actor/mcp' --header 'Authorization: <Bearer <your Apify API token>>'. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.

هل يحتاج Perspective API Alternative (Toxicity Detection) إلى مفتاح API؟

نعم. يتطلب Authorization، وتضبطها في إعداداته.

هل Perspective API Alternative (Toxicity Detection) مفتوح المصدر؟

نعم. شيفرته متاحة على GitHub بترخيص MIT.

من يصون Perspective API Alternative (Toxicity Detection)؟

ينشره koyourmoon. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.

من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.