Purpose: This project provides an MCP server that lets AI agents perform toxicity detection before publishing text, as an alternative to the Google Perspective API. Google's Perspective API will be discontinued on December 31, 2026, and this project keeps its request and response formats consistent with it.
Main capabilities: The server exposes only one tool, analyze_toxicity, which returns six scores from 0 to 1 and a flagged value for each piece of text: TOXICITY, SEVERE_TOXICITY, INSULT, PROFANITY, THREAT, and IDENTITY_ATTACK. Scores come from the open-source Detoxify model, which is not an LLM, so the same text always gets the same scores. Only English is supported; if the text does not appear to be English, the result will include a warning field, and the scores for that text are unreliable.
Usage: The server is implemented as server.py in the repository, uses only the Python standard library (Python 3.9 or later), reads JSON-RPC messages from stdin, and writes responses to stdout. initialize, ping, and tools/list are answered by the server itself and require no token; tools/call sends the text to the toxicity API on Apify and returns the scores. Before running, configure an Apify API token in the APIFY_TOKEN environment variable (obtained in the Apify Console under Settings > API & Integrations). You can clone the repository and add python /path/to/perspective-api-alternative-mcp/server.py to the MCP client configuration, or build a Docker image and run it with docker run -i --rm -e APIFY_TOKEN perspective-api-alternative-mcp. Alternatively, you can have the MCP client connect directly to the toxicity API; this approach does not use server.py.
Use cases: Suitable for workflows that need automated toxicity screening before AI agent output or published content, such as community comments and pre-publication review of generated contentand similar.
Limitations and costs: Only English is supported; scoring relies on the toxicity API on Apify, with pay-per-call pricing of $0.50 per 1,000 text units, where one text unit means each started 1,000 characters, and most comments are 1 unit; Apify Bronze, Silver, and Gold plans have lower prices. The first call after 60 seconds of idleness may take 10 to 30 seconds due to cold start. The project is under the MIT license and is not affiliated with Google or Jigsaw; "Perspective API" is a trademark of Google LLC.