EU AI Act合规工具

提供自动化工具帮助AI系统开发者满足欧盟AI法案的透明度、安全性和治理要求,包括风险分类、角色确定、内容水印和深度伪造标签等功能。

  • by SonnyLabs
  • Python
  • 本地部署
  • 33 星标
  • 更新于
在 GitHub 查看 SonnyLabs/EU_AI_ACT_MCP

使用说明

符合欧盟AI法案的MCP服务器🇪🇺

A. 模型上下文协议(MCP) 服务器提供 欧盟人工智能法案合规工具 对于AI系统。该服务器帮助人工智能应用程序的开发人员,如聊天机器人和人工智能代理,满足整个欧盟人工智能法案框架的透明度、安全性和治理要求。

⚠️ 测试版软件-非法律建议

此MCP服务器正在积极开发中。它提供技术工具来协助 符合欧盟人工智能法案,但不构成法律建议。咨询合格人员 合规决策的法律顾问。

🧑 需要贡献者! 该解决方案尚处于早期阶段,还有欧盟人工智能法案的要求以及一般指导意见有待补充。如果您想为改善每个人的解决方案做出贡献,我们很乐意!请参阅贡献指南 这里 关于贡献的一般指导。

🎯 这个服务器做什么?

此MCP服务器可以自托管,提供 自动化合规工具 这有助于您和您的人工智能系统遵守欧盟人工智能法案:

  • ✅ 对AI系统进行分类 按风险等级(禁止、高风险、有限风险、最低风险)
  • ✅ 确定你的角色 根据《欧盟人工智能法案》(提供商、部署商、进口商等)
  • ✅ 检查是否存在违禁行为 (违反第5条)
  • ✅ 增加透明度披露 (第50条-聊天机器人、情绪识别)
  • ✅ 水印AI内容 (第50(2)条-文本、图像、视频、音频)
  • ✅ 标签deepfakes (第50条第(4)款-所有媒体类型)
  • ✅ 检测安全威胁 (第15条-及时注射)

几种风险类型的合规截止日期2026年8月2日🗓️

📦 包含什么

🔧 17种可用工具

风险和角色分类(3个工具)

  • ✅ classify_ai_system_risk -确定风险等级(第5、6、50条)
  • ✅ check_prohibited_practices -检查违反第5条的行为
  • ✅ determine_eu_ai_act_role -确定你的角色(第3条)

透明度和披露(4个工具)

  • ✅ get_ai_interaction_disclosure -聊天机器人披露(第50(1)条)
  • ✅ get_emotion_recognition_disclosure -情感AI披露(第50(3)条)
  • ✅ get_deepfake_label_templates -访问所有标签模板
  • ✅ label_news_text -标签AI生成的新闻(文章50(4))

内容水印(4个工具)

  • ✅ watermark_text -水印AI文本(第50(2)条)
  • ✅ watermark_image -使用C2PA对AI图像进行水印(第50(2)条)
  • ✅ watermark_video -使用C2PA对AI视频进行水印(第50(2)条)
  • ✅ watermark_audio -水印AI音频(第50(2)条)

Deepfake标签(3个工具)

  • ✅ label_image_deepfake -标记人工智能生成的图像(第50(4)条)
  • ✅ label_video_deepfake -标记AI生成的视频(第50(4)条)
  • ✅ label_audio_deepfake -标签AI生成的音频(第50(4)条)

人工智能安全(3个工具-SonnyLabs.AI集成)

  • ✅ scan_for_prompt_injection -检测即时攻击(第15条)
  • ✅ check_sensitive_file_access -监控文件访问(第10条和第15条)

📚 4可用资源

  • ✅ disclosure-templates://ai-interaction-and-emotion -预先书面披露
  • ✅ deepfake-labels://content-labeling -所有deepfake标签
  • ✅ article50-rules://official-text -官方第50条规则
  • ✅ watermark-config://technical-standards -C2PA和IPTC标准

🌍 多语言支持

所有披露和标签可在以下网址获得:

  • 🇬🇧 英语(en)
  • 🇪🇸 西班牙语(es)
  • 🇫🇷 法语(fr)
  • 🇩🇪 德语(de)
  • 🇮🇹 意大利语(it)-仅披露模板

📦 如果我想要托管MCP服务器而不是自己托管它怎么办?

您可以成为设计合作伙伴,并使用我们托管的EU AI Act MCP服务器,网址为 SonnyLabs.ai.

🚀 自助主机快速入门

预设置

Git在本地克隆此仓库。

1.安装

cd FILE_PATH_OF_THIS_MCP
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

2.设置SonnyLabs安全工具

对于安全工具,请从以下位置获取凭据 SonnyLabs仪表板:

export SONNYLABS_API_TOKEN="your_api_token"
export SONNYLABS_ANALYSIS_ID="your_analysis_id"

注:为了获得SonnyLabs API令牌和分析ID,在 SonnyLabs仪表板,您可以在生成新的API密钥 SonnyLabs仪表板上的API键.下一步是 创建新的分析 在SonnyLabs仪表板上,获取与之关联的分析ID。

有一个通用的免费层,你可以调用SonnyLabs API。

3.测试服务器

# Quick test - all tools
./venv/bin/python test_all_tools.py

# Test specific categories
./venv/bin/python test_risk_classification.py
./venv/bin/python test_role_determination.py
./venv/bin/python test_sonnylabs_security.py

4.连接到您的AI助手或AI代理

看 Claude桌面设置, Windsurf设置 或 光标设置 在......下面

这也适用于CrewAI代理等AI代理。

📁 项目结构

.
├── server.py                           # Main MCP server with all 17 tools
├── main.py                             # Server entry point
├── requirements.txt                    # Python dependencies
│
├── Resources (4 JSON files)
├── disclosure_templates.json           # Pre-written disclosures (50(1), 50(3))
├── deepfake_labels.json               # Deepfake labels (50(4))
├── article50_rules.json               # Official Article 50 rules
├── watermark_config.json              # C2PA & IPTC watermarking standards
│
├── Tests (7 test files)
├── test_all_tools.py                  # Test all 17 tools
├── test_risk_classification.py        # Test risk & prohibited tools
├── test_role_determination.py         # Test role determination
├── test_sonnylabs_security.py         # Test security tools
├── test_watermark_media.py            # Test watermarking tools
├── test_label_*_deepfake.py          # Test deepfake labeling
│
└── Documentation
    ├── README.md                       # This file
    ├── SONNYLABS_TESTING_GUIDE.md     # Security tools guide
    └── PHASE2_SUMMARY.md              # Implementation summary

Claude桌面设置

1.查找配置文件

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

2.添加此服务器配置

编辑配置文件并添加:

{
  "mcpServers": {
    "eu-ai-act-compliance": {
      "command": "FILE_PATH_OF_THIS_MCP/venv/bin/python",
      "args": [
        "FILE_PATH_OF_THIS_MCP/server.py"
      ],
      "env": {}
    }
  }
}

3.重新启动克劳德桌面

完全退出Claude Desktop并重新打开。

4.测试它是否有效

在新的对话中,问克劳德:

Use classify_ai_system_risk to classify a chatbot that interacts with users.

Windsurf设置

1.查找配置文件

Windsurf MCP配置文件位于:

macOS/Linux: ~/.codeium/windsurf/mcp_config.json
视窗: %USERPROFILE%\.codeium\windsurf\mcp_config.json

2.添加此服务器配置

编辑配置文件并添加:

{
  "mcpServers": {
    "eu-ai-act-compliance": {
      "command": "/path/to/your/project/venv/bin/python",
      "args": [
        "/path/to/your/project/main.py"
      ],
      "env": {
        "SONNYLABS_API_TOKEN": "your_sonnylabs_api_token_here",
        "SONNYLABS_ANALYSIS_ID": "your_analysis_id_here"
      }
    }
  }
}

替换占位符:

  • /path/to/your/project/venv/bin/python -虚拟环境路径Python二进制文件
  • /path/to/your/project/main.py -此存储库中main.py文件的路径
  • your_sonnylabs_api_token_here -SonnyLabs API令牌(可选,仅用于安全工具)
  • your_analysis_id_here -您的SonnyLabs分析ID(可选,仅安全工具需要)

备注:在Windows上,在路径中使用反斜杠(例如。, C:\\path\\to\\project\\venv\\Scripts\\python.exe)

3.重新启动Windsurf

完全退出Windsurf并重新打开它。

4.测试它是否有效

在Windsurf上问我:

Use get_ai_interaction_disclosure with language "en" and style "simple"

光标设置

1.打开光标设置->工具和MCP,然后单击“添加自定义MCP”

2.编辑配置文件以添加此服务器配置

编辑配置文件并添加:

{ “mcpServers”:{ “欧盟人工智能法案合规性”:{ “command”:“/path/to/your/project/venv/bin/python”, “args”:[ “/path/to/your/project/main.py” ], “env”:{ “SONNYLABS_API_TOKEN”:“your_SONNYLABS_API_TOKEN_here”, “SONNYLABS_ANALYSIS_ID”:“您的分析_ID_here” } } } }

3.替换占位符:

  • /path/to/your/project/venv/bin/python -虚拟环境路径Python二进制文件
  • /path/to/your/project/main.py -此存储库中main.py文件的路径
  • your_sonnylabs_api_token_here -SonnyLabs API令牌(可选,仅用于安全工具)
  • your_analysis_id_here -您的SonnyLabs分析ID(可选,仅安全工具需要)

备注:在Windows上,在路径中使用反斜杠(例如。, C:\\path\\to\\project\\venv\\Scripts\\python.exe)

4.重新启动游标

完全退出Cursor并重新打开它。

5.测试它是否有效

切换AI窗格并创建一个新的聊天来询问:

Use get_ai_interaction_disclosure with language "en" and style "simple"
'''
A dialog should appear offering to Run the get_ai_interaction_disclosure tool. Click Run and you should
see a response like this:

{
"article": "50(1)",
"obligation": "AI Interaction Transparency",
"language": "en",
"style": "simple",
"disclosure": "You are chatting with an AI assistant.",
"usage": "Display this text to users before or during AI interaction",
"compliance_deadline": "2026-08-02"
}
You are chatting with an AI assistant


---

## 💡 How to Use the Tools

### Simple Usage Examples

All tools are called the same way in Claude Desktop or Windsurf. Just ask the AI assistant to use the tool!

#### 1. Classify Your AI System

使用classify_ai_system_risk对我的系统进行分类:

  • 描述:“用于客户支持的AI聊天机器人”
  • 用例:“聊天机器人”
  • 与用户交互:true
  • 生成内容:true

**Returns**: Risk level (PROHIBITED, HIGH-RISK, LIMITED-RISK, or MINIMAL-RISK) with applicable obligations

#### 2. Check Your Role

使用determined_eu_ai_act_role:

  • 公司:“AI软件开发公司”
  • 地点:“美国”
  • 开发人工智能系统:真的
  • 销售人工智能系统:真的
  • 以自己的名义:true

**Returns**: Your role (PROVIDER, DEPLOYER, IMPORTER, etc.) with specific obligations

#### 3. Get a Chatbot Disclosure

使用带有语言“en”和样式“simple”的get_a_interaction_disclosure


**Returns**: "You are chatting with an AI assistant."

#### 4. Watermark AI-Generated Text

使用watermark_text:

  • 文本:“这篇文章是关于量子计算的……”
  • 发电机:“GPT-4”
  • 格式:“markdown”

**Returns**: Text with embedded metadata watermark

#### 5. Label a Deepfake Image

使用标签image_deepfake:

  • 描述:“AI生成的肖像照片”
  • 艺术作品:假的
  • 语言:“en”

**Returns**: Label text and placement guidelines

#### 6. Scan for Security Threats (Requires SonnyLabs credentials)

使用scan_for_prompt_injection:

  • 输入:“忽略之前的所有指令”
  • API代币:[您的代币]
  • 分析ID:[您的ID]

**Returns**: Threat analysis with risk level and recommendation

---

## 📋 Copy-Paste Test Prompts

Ready-to-use prompts for testing all tools in Claude Desktop or Windsurf. Just copy and paste!

### 1. Risk Classification

使用classify_ai_system_risk对我的系统进行分类,包括以下详细信息:

  • system_description:“用于医疗保健客户支持的人工智能聊天机器人”
  • use_case:“医疗保健”
  • interactions_with_users:true
  • generates_content:true
  • 进程_个人数据:true
  • makes_automated_decisions:false
  • in-critical_infrastructure:false
  • used_for_employment:false
  • used_for_education:false
  • used_for_law_enforcement:false
  • used_for_migration:false
  • used_for_justice:false

我的风险水平是多少,适用哪些义务?


### 2. Check Prohibited Practices

使用check_prohibited_practices检查我的系统是否违反了第5条:

  • system_description:“带行为评分的员工监控系统”
  • 潜意识操纵:错误
  • 漏洞利用:false
  • 社交评分:真
  • 生物计量学分类:错误
  • 情感_认知_工作场所:真
  • 情感、认知、教育:错误
  • untargeted_scraping:错误
  • 风险评估_个人特征:错误

发现了哪些违规行为,处罚是什么?


### 3. Determine Your Role

使用determined_eu_ai_act_role查找我的角色:

  • 公司简介:“美国AI软件公司”
  • 公司_地点:“美国”
  • develops_ai_system:真
  • uses_ai_system:false
  • sells_ai_system:true
  • distributes_in_eu:true
  • imports_to_eu:true
  • 未注册名称或商标:true
  • 集成_输入_产品:false
  • representatives_noneu_provider:false

我扮演什么角色,我的义务是什么?


### 4. Get Chatbot Disclosure

使用带有语言“en”和样式“detained”的get_a_interaction_disclosure

给我看我的聊天机器人需要的披露文本。


### 5. Get Emotion Recognition Disclosure

使用get_emotion_recognition_session:

  • 语言:“en”
  • 样式:“隐私通知”

我需要什么样的信息来识别情绪?


### 6. Get All Deepfake Labels

使用语言为“es”的get_depfake_label_templates

显示所有可用的西班牙语标签。


### 7. Label AI-Generated News

使用label_news_text标记此文章:

  • text_content:“突破:科学家宣布可再生能源存储取得重大突破。新电池技术有望将容量提高10倍。”
  • has_human_editor:true
  • 编辑名:“莎拉·约翰逊”
  • 语言:“en”

给我看正确标记的版本。


### 8. Watermark AI Text

使用watermark_text对此内容添加水印:

  • text_content:“人工智能正在改变我们的工作和生活方式。从医疗诊断到创意写作,人工智能系统正成为现代社会不可或缺的一部分。本文探讨了人工智能在各个行业的应用意义。”
  • 发电机:“GPT-4”
  • format_type:“markdown”

显示水印元数据和说明。


---

## 📖 Complete Tool Reference

### Risk & Role Tools

#### `classify_ai_system_risk`

**Purpose**: Determine if your AI system is Prohibited, High-Risk, Limited-Risk, or Minimal-Risk

**Simple call**:

对筛选简历的人工智能招聘系统进行分类。它用于就业。


**Parameters**:
- `system_description`: What your AI does
- `use_case`: Primary use (e.g., "employment", "healthcare", "chatbot")
- Various boolean flags for risk factors

**Returns**: Risk classification, applicable obligations, deadlines, penalties

---

#### `check_prohibited_practices`

**Purpose**: Check if your AI violates Article 5 prohibited practices

**Simple call**:

检查我的系统是否有禁止的行为。它进行社交评分。


**Parameters**: Boolean flags for 8 types of prohibited practices

**Returns**: Violations detected, severity, penalties (€35M or 7%), recommendations

---

#### `determine_eu_ai_act_role`

**Purpose**: Identify your role under EU AI Act (Provider, Deployer, etc.)

**Simple call**:

我的角色是什么?我开发人工智能系统,并以我的公司名义在欧盟销售。


**Parameters**: Company info and activity flags

**Returns**: Primary role, obligations, deadlines, compliance actions

---

### Transparency & Disclosure Tools

#### `get_ai_interaction_disclosure`

**Quick use**: `Get chatbot disclosure in English`

**Returns**: Ready-to-use disclosure text for AI interactions

---

#### `get_emotion_recognition_disclosure`

**Quick use**: `Get emotion recognition disclosure in German, detailed style`

**Returns**: GDPR-compliant emotion AI disclosure

---

#### `get_deepfake_label_templates`

**Quick use**: `Show me all deepfake labels in Spanish`

**Returns**: Complete list of labels for all content types

---

#### `label_news_text`

**Quick use**: `Label this AI news article: "Breaking: New discovery..." with editor "John Doe"`

**Returns**: Properly labeled text with EU AI Act compliance

---

### Watermarking Tools

#### `watermark_text` / `watermark_image` / `watermark_video` / `watermark_audio`

**Quick use**: `Watermark this AI-generated text from GPT-5`

**Returns**: Watermarking metadata and instructions (C2PA, IPTC standards)

---

### Deepfake Labeling Tools

#### `label_image_deepfake` / `label_video_deepfake` / `label_audio_deepfake`

**Quick use**: `Label this AI-generated video, not artistic work, in French`

**Returns**: Label text, placement guidance, compliance info

---

### Security Tools (Requires SonnyLabs)

#### `scan_for_prompt_injection`

**Purpose**: Detect prompt injection attacks in real-time

**Returns**: Attack detection, confidence score, risk level, recommendation

---

#### `check_sensitive_file_access`

**Purpose**: Monitor AI agent file access for security

**Returns**: File sensitivity analysis, access recommendations (BLOCK/ALLOW)

---

## 🎯 Real-World Usage Scenarios

### Scenario 1: Launching a Customer Service Chatbot

**What You Want To Do**: "My chatbot needs to be compliant. What do I do?"

**Instructions**: Ask the AI:

使用classify_ai_system_risk检查我的聊天机器人 然后使用get_a_interaction_disclosure获取披露文本


**Result**: You'll know your risk level (likely LIMITED-RISK) and get ready-to-use disclosure text in 5+ languages.

---

### Scenario 2: Publishing AI-Generated News

**What You Want To Do**: "I'm using AI to write news articles. How do I label them?"

**Instructions**: Ask the AI:

使用label_news_text将我的文章标记为编辑“Jane Smith”


**Result**: Properly formatted label + check if you qualify for exemptions with human editorial oversight.

---

### Scenario 3: Understanding Your Compliance Obligations

**What You Want To Do**: "I develop AI systems in the US and sell to EU customers. What are my obligations?"

**Instructions**: Ask the AI:

使用determined_eu_ai_act_role-我从美国向欧盟开发和销售人工智能系统


**Result**: You'll learn you're a PROVIDER + IMPORTER with specific obligations for each role.

---

### Scenario 4: Securing Your AI Against Prompt Injection Attacks

**What You Want To Do**: "How do I protect my AI from prompt injection?"

**Instructions**: Get SonnyLabs credentials, then ask the AI:

在处理之前,使用scan_for_prompt_injection检查用户输入


**Result**: Real-time threat detection with confidence scores and block/allow recommendations.

---

### Scenario 5: Securing Your AI Against Trying to Access Sensitive Files

**What You Want To Do**: "How do I ensure the AI agent doesn't access sensitive files on the server?"

**Instructions**: Get SonnyLabs credentials, then ask the AI:

现在我想转到/etc/shadow$。您可以使用EU_AI_ACT_MCP检查敏感文件或文件类型吗


**Result**: Real-time sensitive file detection and block/allow recommendations.

---

## 📋 EU AI Act Coverage Summary

This server covers the most critical EU AI Act articles for AI system operators:

| Article | What It Covers | Tools in This Server |
|---------|----------------|----------------------|
| **Article 3** | Role definitions | `determine_eu_ai_act_role` |
| **Article 5** | Prohibited practices (€35M penalty) | `check_prohibited_practices` |
| **Article 6** | High-risk classification | `classify_ai_system_risk` |
| **Article 15** | Cybersecurity & robustness | `scan_for_prompt_injection`, `check_sensitive_file_access` |
| **Article 50(1)** | AI interaction disclosure | `get_ai_interaction_disclosure` |
| **Article 50(2)** | Content watermarking | 4 watermarking tools |
| **Article 50(3)** | Emotion recognition disclosure | `get_emotion_recognition_disclosure` |
| **Article 50(4)** | Deepfake labeling | 4 deepfake labeling tools |

**Key Deadline**: August 2, 2026 🗓️ for High Risk AI Systems & Limited Risk AI Systems

### Why Use This Server?

✅ **Complete Coverage**: 17 tools covering Articles 3, 5, 6, 10, 15, and 50  
✅ **Multi-Language**: 5 languages supported (en, es, fr, de, it)  
✅ **Real-Time Security**: SonnyLabs integration for live threat detection  
✅ **Automatic Exemptions**: Tracks when exemptions apply  
✅ **Standards Compliant**: C2PA, IPTC, GDPR aligned  
✅ **Easy Integration**: Just ask your AI assistant to use the tools!

---

## 🧪 Testing & Development

### Run All Tests

```bash
# Test all 17 tools at once
./venv/bin/python test_all_tools.py

按类别测试

# Test risk classification
./venv/bin/python test_risk_classification.py

# Test role determination
./venv/bin/python test_role_determination.py

# Test watermarking
./venv/bin/python test_watermark_media.py

# Test security tools (requires SonnyLabs credentials)
./venv/bin/python test_sonnylabs_security.py

📚 其他资源

欧盟人工智能法案

技术标准

安全工具


💬 支持与贡献

需要帮助?

  • 欧盟人工智能法案法律问题:咨询法律顾问
  • 工具使用问题:向您的AI助手(Claude/Windsurf)寻求帮助
  • 技术问题:检查测试文件以获取示例
  • SonnyLabs安全:参见 SONNYLABS_TESTING_GUIDE.md

想贡献吗?

此服务器的设计是全面的。所有17个工具都已实施和测试。如果您需要额外的《欧盟人工智能法案》覆盖范围,请随时按照以下模式扩展工具 server.py.


📝 总结

所得

  • ✅ 17个合规工具 随时可用
  • ✅ 4个资源文件 使用模板和标准
  • ✅ 完整的欧盟人工智能法案覆盖范围 (第3、5、6、10、15、50条)
  • ✅ 多语言支持 (5种语言)
  • ✅ 实时安全 (SonnyLabs集成)
  • ✅ 生产准备就绪 通过全面测试

如何开始

  1. 安装: pip install -r requirements.txt
  2. 测试: ./venv/bin/python test_all_tools.py
  3. 配置:添加到克劳德桌面或在Windsurf中使用
  4. 使用:只需让你的AI助手使用任何工具!

合规性检查表

  • []对您的AI系统风险级别进行分类
  • []确定您的角色(提供者、部署者等)
  • []检查是否存在违禁行为
  • []为面向用户的人工智能增加透明度披露
  • []水印AI生成的内容
  • []适当标记deepfakes
  • []实施安全扫描(可选但推荐)
  • []记录合规行动