Content
# Baidu Cloud Large Model Content Security MCP Server
This code repository contains an MCP server that provides access to the [Baidu Cloud Large Model Content Security](https://cloud.baidu.com/doc/AIGC_SEC/s/qlxblhd5j) features.
## Prerequisites
Before using the Baidu Cloud Large Model Content Security MCP Server, please ensure you meet the following requirements:
1. Python 3.10 or higher
2. [uv](https://github.com/astral-sh/uv) installed to run the MCP Server
## Usage
The recommended way to use the Baidu Cloud Large Model Content Security MCP Server is to run it via `uv` without installation.
Clone the code repository and execute the following commands:
```
git clone https://github.com/liangjunyu2010/mcp_server_safe_content_check.git
cd mcp_server_safe_content_check
```
Then, you can run it directly using `uv`, modifying `BAIDU_CLOUD_ACCESS_KEY_ID` and `BAIDU_CLOUD_SECRET_ACCESS_KEY` as needed:
```
uv run src/mcp_server_safe_content_check/server.py
uv run src/mcp_server_safe_content_check/server.py --BAIDU_CLOUD_ACCESS_KEY_ID ACCESS_KEY --BAIDU_CLOUD_SECRET_ACCESS_KEY SECRET_KEY
```
Alternatively, modify the `.env` file in the `src/mcp_server_safe_content_check/` directory to set environment variables, and then run the server using the following command:
```
uv run src/mcp_server_safe_content_check/server.py
```
## Supported Applications
The Baidu Cloud Large Model Content Security MCP Server can be used with various large language model applications that support the model context protocol:
- **Cursor**: An AI code editor that supports MCP
- **Custom MCP Client**: Any application that implements the MCP client specification
## How to Use in Cursor
[Cursor also supports MCP](https://docs.cursor.com/context/model-context-protocol) tools. You can add the Baidu MCP Server to Cursor in two ways:
Open `Cursor Settings` > `Features` > `MCP`, click the `+ Add New MCP Server` button, and add the following configuration in `mcp.json`:
```JSON
{
"mcpServers": {
"safe-content-check": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"mcp",
"run",
"/PATH/mcp_server_safe_content_check/src/mcp_server_safe_content_check/server.py"
],
"env": {
"BAIDU_CLOUD_ACCESS_KEY_ID": "****",
"BAIDU_CLOUD_SECRET_ACCESS_KEY": "****"
}
}
}
}
```
Restart Cursor or reload the window.
## Available Tools
The Baidu Cloud Large Model Content Security MCP Server provides the following tools:
### Input Detection Operation
- `input_analyze`: Analyze input content
- Parameters:
- `text`: The input text content
## Environment Variables
[Create Baidu Cloud IAM](https://console.bce.baidu.com/iam/#/iam/accesslist) and select the permission `AFDFullControlAccessPolicy`
- `BAIDU_CLOUD_ACCESS_KEY_ID`: Baidu Cloud authorized ACCESS_KEY
- `BAIDU_CLOUD_SECRET_ACCESS_KEY`: Baidu Cloud authorized SECRET_KEY
## Usage Example
### Using Cursor
#### Example: Check if the file content contains unsafe information
```
Please help check for risks
```
Cursor will use the `input_analyze` provided by the Baidu Cloud Large Model Content Security MCP Server to check if the input content is safe.
```
The detection result shows that the text content has a very high risk:
Risk Type: Crime-related content (hitType: crime)
Risk Score: 0.998 (out of 1)
Recommended Action: Prohibit dissemination (action: 2)
Safety Assessment: Content is unsafe (isSafe: 0)
```
Connection Info
You Might Also Like
MarkItDown MCP
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
Time
A Model Context Protocol server for time and timezone conversions.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
Git
A Model Context Protocol server for Git automation and interaction.
Fetch
Retrieve and process content from web pages by converting HTML into markdown format.