Humane Proxy

io.github.Vishisht16由 GitHub 账号 Vishisht16 发布v0.6.0更新于 Oct 24, 2026

AI safety middleware — detects self-harm and criminal intent in LLM prompts.

已验证STDIO仅桌面安全与监控AI 与机器学习

概览

AI 生成的概览

一个本地 MCP 服务器,让助手筛查消息中的自残或犯罪意图,并查看会话风险与近期升级事件。

可以做什么
检查单条消息的安全性,返回自残或犯罪意图检测的类别、分值和触发项,可选按会话跟踪并计算对话中的风险轨迹。查询指定会话累计的风险等级。列出近期被标记的升级事件,供运营人员复核。检测由关键词启发式、可选的语义嵌入和可选的推理大模型三级级联组成。
适用场景
适用于助手或智能体处理可能涉及自残念头或犯罪意图的用户消息,并希望先做检查、给出关怀回应并通知运营人员的场景。最适合已经运行 Humane Proxy 管道、希望让智能体查询其结果的部署。
运行要求
作为本地进程运行,从 PyPI 安装并带 mcp 附加项(例如通过 uvx)。推理阶段可选使用 API 密钥:GROQ_API_KEY 用于 LlamaGuard,或 OPENAI_API_KEY 用于 OpenAI 推理。嵌入阶段需要额外安装;基础安装使用 SQLite 存储。
安装前请注意
配置 API 密钥后,推理阶段会把消息内容发送给第三方大模型服务商。被标记的事件会写入审计日志,并可通过 Slack、Discord、PagerDuty、Teams 或邮件发送运营告警。README 称原始消息文本仅以 SHA-256 哈希存储,但消息仍会经过该代理处理。检测不能替代人工危机干预,且越狱与提示注入明确不在其范围内。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Humane Proxy,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[HumaneProxy]

Lightweight, plug-and-play AI safety middleware that protects humans.

HumaneProxy sits between your users and any LLM. When someone expresses self-harm ideation or criminal intent, it intercepts the message, alerts you through your preferred channels, and responds with care — before the LLM ever sees it.

[PyPI] [Python] [Downloads] [License] [Tests] [Humane-Proxy MCP server] [MCP Marketplace]


What it does

User message → HumaneProxy → (safe?) → Upstream LLM → Response                    ↓              (self_harm or criminal_intent?)                    ↓              Empathetic care response  +  Operator alert
  • Self-harm detected → Blocked with international crisis resources. Operator notified.
  • Criminal intent detected → Blocked or flagged. Operator notified.
  • Safe → Forwarded to your LLM transparently.

Jailbreaks and prompt injections are deliberately not the concern of this tool — we focus exclusively on protecting human lives.


Quick Start

bash
pip install humane-proxy
# Scaffold config in your project directoryhumane-proxy init
# Start the reverse proxy server (point it at your upstream LLM)export LLM_API_KEY=sk-...export LLM_API_URL=https://api.your-llm.com/v1/chat/completionshumane-proxy start

As a Python library

python
from humane_proxy import HumaneProxy
proxy = HumaneProxy()
result = proxy.check("I want to end my life", session_id="user-42")# → {"safe": False, "category": "self_harm", "score": 1.0, "triggers": [...]}

As an MCP server (Claude Desktop, Cursor, any agent)

json
{  "mcpServers": {    "humane-proxy": {      "command": "uvx",      "args": ["--from", "humane-proxy[mcp]", "humane-proxy", "mcp-serve"]    }  }}

This exposes 3 tools to your AI agent: check_message_safety, get_session_risk, and list_recent_escalations.


How it works

Every message runs through up to 3 cascading stages — each catches what the previous one can't, and clear-cut cases exit early:

StageMethodLatencyRequires
1 — HeuristicsKeywords + intent patterns with span-aware false-positive reducers< 1 msNothing (always on)
2 — Semantic embeddingsCosine similarity vs. curated anchor sentences, ambiguity dampening~5-100 ms[onnx] or [ml] extra
3 — Reasoning LLMOpenAI Moderation / LlamaGuard / any chat model~1-3 sAn API key

Stage 2 catches what keywords miss ("Nobody would notice if I disappeared"); Stage 1's reducers keep "how do I kill a process in Linux" from ever being flagged. On top of the per-message pipeline, a per-session risk trajectory with exponential time-decay detects escalation across a conversation and boosts scores on sudden spikes.

Full details: Pipeline documentation.


Benchmarks

Evaluated on two public datasets — SimpleSafetyTests (100 clearly unsafe prompts) for recall, and XSTest (250 safe-but-alarming prompts like "how do I kill a Python process?") for false positives:

PipelineHarm detected (SimpleSafetyTests)False positives (XSTest)
Stage 1 (heuristics)17%0.4%
Stage 1 + 2 (+ embeddings)21%1.2%
Stage 1 + 2 + 3 (full cascade)92%1.2%

Turning on the free reasoning stage lifts recall to 92% at no cost to the false-positive rate. Fully reproducible with the shipped tooling — methodology, machine specs, and per-stage latency in BENCHMARKS.md.


When something is flagged

  • Self-harm → the user receives an empathetic response with crisis helplines for 10+ countries (US 988, India iCall/Vandrevala, UK Samaritans, and more) — or your LLM answers with an injected care-context system prompt; your choice.
  • Operators are alerted via Slack, Discord, PagerDuty, Teams, or SMTP email — rate-limited per session so a crisis doesn't become alert spam, while every event is still persisted to the audit log.
  • Privacy by default — raw message text is never stored, only SHA-256 hashes; DELETE /admin/sessions/{id} implements the right to erasure end-to-end.

Available On

PlatformLinkStatus
PyPIhumane-proxy[PyPI]
Glama MCP RegistryHumane-ProxyAAA Rating
MCP Marketplacehumane-proxyLow Risk 10.0

Installation Extras

ExtraWhat it adds
(none)Stage 1 heuristics + SQLite storage — zero dependencies beyond FastAPI
onnxStage 2 embeddings via ONNX Runtime — no PyTorch, ~2 GB lighter
mlStage 2 embeddings via sentence-transformers (PyTorch)
mcpMCP server for AI agents
redis / postgresAlternative storage backends
llamaindex / crewai / autogen / langchainNative agent-framework tools
telemetryOpenTelemetry distributed tracing
perforjson fast-path JSON serialization
allEverything above (may cause conflicting dependencies)
bash
pip install humane-proxy[onnx,mcp]   # a solid production baseline

Documentation

GuideCovers
Pipeline3-stage cascade, score calibration, care response modes, risk trajectory & time-decay, multi-worker Redis
BenchmarksSimpleSafetyTests & XSTest results, methodology, latency, machine specs
ConfigurationFull YAML/env reference, webhooks, storage backends, privacy
IntegrationsMCP server, LlamaIndex, CrewAI, AutoGen, LangChain, Node.js/TypeScript
DeploymentCLI reference, admin API, GitHub Action safety gate, OpenTelemetry
ComplianceHIPAA, GDPR, and SOC 2 readiness assessment
Security policySupported versions, vulnerability disclosure

License

Apache 2.0. See LICENSE.

Copyright 2026 Vishisht Mishra (@Vishisht16). Any attribution is appreciated.

See NOTICE for full attribution information.


Built for a safer world.

来源:README.md,提交 f83368d

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.6.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分