Token导航 LogoToken导航TokenDH.com
LLM Guard MCP logo
安全风控stdio官方级别未说明来源级核验

LLM Guard MCP

MCP Server

一个基于MCP协议的隐私保护网关,用于在LLM应用中检测和过滤敏感信息。

工具数

1

提示词数

0

GitHub Stars

0

资源数

0
隐私保护Python安全

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Amywith

提供方

Amywith

最后核验

2026/5/17 20:23

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -r requirements.txt

详细介绍

LLM Guard Privacy Gateway

A privacy protection gateway based on MCP protocol for detecting and filtering sensitive information in LLM applications.

Features

  1. PII desensitizationAutomatically recognize Chinese names, phone numbers, and email addresses in text and replace them with placeholders
  2. Key interceptionDetect common API Keys, Alibaba Cloud AccessKeys, and RSA private keys
  3. Business blockadeDefine a blacklist list, and if the text contains these words, return the intercept status directly
  4. MCP packagingEncapsulate the above logic into an MCP tool and return the processing result in JSON format

install

pip install -r requirements.txt

Regarding the issue of downloading the spaCy model

If you encounter network issues while downloading the spaCy Chinese language model (such as a connection being closed by a remote host), you can try the following solutions:

Solution 1: Use domestic image sources

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple spacy

Solution 2: Manually download the model

visit https://github.com/explosion/spacy-models/releases Download the corresponding model file and install it locally:

pip install path/to/zh_core_web_sm-3.x.x.tar.gz

Solution 3: Use other mirror sites

# 使用清华镜像
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ spacy
python -m spacy download zh_core_web_sm --index-url https://pypi.tuna.tsinghua.edu.cn/simple/

Instructions for use

Basic Usage

from llm_guard import sanitize_prompt_mcp

prompt = "你好,我是张三,我的电话是13812345678"
result = sanitize_prompt_mcp(prompt)
print(result)

Used in MCP services

from llm_guard import LLMSanitizer

sanitizer = LLMSanitizer()
result = sanitizer.sanitize_prompt("你的提示文本")

MCP Service Deployment

This project supports the MCP protocol and can run as an MCP tool server. In this architecture, tools are registered in the cloud, but data processing is entirely done locally to ensure data privacy.

Run MCP service

python mcp_server.py

Docker deployment

Build Docker image:

docker build -t llm-guard-mcp .

Run container:

docker run -it --rm llm-guard-mcp

MCP Tool Description

MCP services provide the following tools:

sanitize_prompt

Used for cleaning prompt text and removing sensitive information.

parameter

  • prompt (string, required): Prompt text that needs to be cleaned

Return value:

  • The result in JSON format, including the original text, cleaned text, detected sensitive information, etc

Plugin Market Listing

This project supports publishing to the Ant Treasure Box plugin market. The specific steps are as follows:

1. Prepare materials

2. Create MCP plugin

Reference document: https://alipaytbox.yuque.com/sxs0ba/huntb8/hwhtg4sp1mdppsib

3. Add plugins to the market

Reference document: https://alipaytbox.yuque.com/sxs0ba/huntb8/ohqgnh2gt1qhymqb

return format

The function will return a JSON object containing the following fields:

  • original_prompt: Original prompt text
  • sanitized_promptProcessed prompt text
  • pii_detectedList of detected PII information
  • api_keys_detectedList of detected API keys
  • blacklist_words_foundDiscovered blacklist vocabulary
  • status: Processing status ("allowed" or "blocked")
  • message: Processing messages

Custom Configuration

You can modify \[llm_guard. py\]( file:///e:/llm -In guard/lm_guard. py LLMSanitizer Class to customize blacklist vocabulary or other rules.

Error handling and downgrade mechanism

This implementation has a comprehensive error handling and downgrade mechanism:

  1. Even if the Presidio library is not installed or cannot be initialized, the system will still use built-in regular expressions for detection
  2. When network issues prevent the spaCy model from downloading, the system can still run (although the accuracy may slightly decrease)
  3. All exceptions are properly captured and will not cause the entire application to crash

This design ensures that the system can still function properly in environments with network limitations or missing dependency libraries.

目录标签

目录标签

隐私保护Python安全本地部署敏感信息检测PII脱敏密钥拦截商业阻断

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP