Token导航 LogoToken导航TokenDH.com
EASACompliance logo
搜索检索stdio官方级别未说明来源级核验

EASACompliance

MCP Server

用于解析欧盟航空安全局(EASA)法规并支持语义搜索的系统,优化了与检索增强生成(RAG)系统的集成,适用于航空法规合规性验证和自动化审计。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
安全Python搜索

安装说明

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

作者 / 组织

dmoraine

提供方

dmoraine

最后核验

2026/5/17 20:20

快速接入

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

命令预览

pip install -e .

详细介绍

EASA合规性分析器

![Python 3.10+](https://www.python.org/downloads/) ![License: MIT](https://opensource.org/licenses/MIT)

EASA(欧盟航空安全局)法规的解析器和语义搜索系统。针对与RAG(检索增强生成)系统的集成进行了优化。

✨ 特性

  • EASA官方基于结构的解析器 :使用EASA eRules XML导出XSD架构
  • 已提取3357+个主题 :完全访问所有法规(IR、AMC、GM、CS)
  • 批量处理 :自动解析目录中的所有XML文件
  • 通用解析器 :自动检测EASA文档位置(item2.xml、item9.xml等)
  • 语义搜索 :嵌入句子变换器进行相似性搜索
  • 完整的元数据 :日期、监管来源、内容类型
  • 优化性能 :O(n)中的SDT索引用于快速解析(约5秒)
  • MCP服务器 :与LLM的模型上下文协议集成
  • 聊天客户端 :CLI界面,用于与符合EASA法规的LLM聊天
  • CrewAI合规性 :人工智能代理团队的自动审计(审计员+QA)

📦 安装

# Clone the repository
git clone https://github.com/dmoraine/easacompliance.git
cd easacompliance

# Install with pip
pip install -e .

# Or with uv (modern and faster)
./install.sh

install.sh 脚本使用 uv 用于快速解析和安装依赖关系。

🚀 快速开始

🤖 聊天MCP客户端

交互式CLI界面,用于与通过MCP连接到EASA法规的LLM(OpenAI、Ollama、Hyperbolic)聊天:

# Configuration
cp env.example .env
# Edit .env with your API keys

# Launch chat
python chat_mcp.py --provider ollama  # Local, no API key needed
python chat_mcp.py --provider openai  # With OpenAI
python chat_mcp.py --provider hyperbolic  # With Hyperbolic

特性:

  • 💬 带有流媒体响应的交互式聊天
  • 🔧 自动调用EASA MCP服务器功能
  • 🔍 搜索、检索和法规遵从性验证
  • 🌐 多提供商支持(OpenAI、本地Ollama、Hyperbolic)

👉 完整的聊天MCP指南

🎯 CrewAI合规性验证器(新增!)

由2名AI代理(审计员+QA挑战者)组成的团队进行自动化合规审计,他们相互协作并相互挑战:

# Configuration (same .env as for chat)
cp env.example .env

# Audit a text
python compliance_crew.py \
  --text "Flight crew members must not exceed 900 hours" \
  --output report.md \
  --provider openai

# Audit a file
python compliance_crew.py \
  --file operations_manual.txt \
  --output compliance_report.md \
  --provider openai

# Interactive mode
python compliance_crew.py --interactive --output report.md

特性:

  • 🤖 2名专业代理:专家审核员+QA挑战者
  • ✅ 交叉验证:QA挑战和验证结果
  • 📋 详细的Markdown报告,包含确切的EASA参考
  • 🔍 根据严重程度识别不合规行为
  • 🔧 代理商可以完全访问EASA MCP工具
  • 🌐 多提供商支持(推荐:OpenAI GPT-4)

👉 完整的CrewAI合规指南

📊 构建嵌入数据库

脚本支持两种模式: 单个文件目录批处理.

单文件模式

# Parse a single XML file (3,357 topics)
python build_embeddings.py \
    --xml "Easy Access Rules for Air Operations - February 2025 - xml.xml" \
    --db easa_complete.db \
    --clear

# Parse only a specific category (e.g., ORO.FTL)
python build_embeddings.py \
    --xml "Easy Access Rules for Air Operations - February 2025 - xml.xml" \
    --category "ORO.FTL" \
    --db oro_ftl.db \
    --clear

# Parse only IR (Implementing Rules)
python build_embeddings.py \
    --xml "Easy Access Rules for Air Operations - February 2025 - xml.xml" \
    --types IR \
    --db easa_ir.db \
    --clear

目录批处理模式(新增!)

自动解析目录中的所有XML文件:

# Parse all XML files in easy_access/ (default directory)
python build_embeddings.py \
    --db easa_complete.db \
    --clear

# Parse all XML files in a specific directory
python build_embeddings.py \
    --dir easy_access \
    --db easa_complete.db \
    --clear

# Parse all XML files with filters
python build_embeddings.py \
    --dir easy_access \
    --db easa_ir_only.db \
    --types IR \
    --clear

特性:

  • ✅ 自动检测所有 .xml 目录中的文件
  • ✅ 按顺序处理文件并跟踪进度
  • ✅ 防止重复(对引用的唯一约束)
  • ✅ 每个文件的错误处理(如果失败,则继续)
  • ✅ 详细摘要,包括每个文件的统计数据和最终总计

备注:The build_embeddings.py 根目录下的脚本是中完整实现的方便包装器 easacompliance/scripts/build_embeddings.py。您也可以直接使用该模块: python -m easacompliance.scripts.build_embeddingspython easacompliance/scripts/build_embeddings.py

🔍 语义搜索

# Interactive mode
python -m easacompliance.scripts.search_regulations \
    --db "easa_complete.db" \
    --interactive

# Single search
python -m easacompliance.scripts.search_regulations \
    --db "easa_complete.db" \
    --query "flight time limitations" \
    --top-k 5

# Manual compliance validation
python -m easacompliance.scripts.search_regulations \
    --db "easa_complete.db" \
    --manual "operations_manual.txt" \
    --top-k 10 \
    --min-score 0.3

备注:您也可以使用直接路径: python easacompliance/scripts/search_regulations.py

💻 Python用法

from easacompliance import EASAParser, EmbeddingsManager, TopicType

# Parser
parser = EASAParser("regulations.xml")

# Extract a specific topic
topic = parser.get_topic_by_reference("ORO.FTL.110")
print(f"{topic.reference} - {topic.title}")
print(f"Type: {topic.topic_type.value}")
print(f"Content: {topic.content}")

# Extract all topics from a category
oro_ftl_topics = parser.get_all_topics(pattern=r'^ORO\.FTL\.')
print(f"Found {len(oro_ftl_topics)} ORO.FTL topics")

# Semantic search
manager = EmbeddingsManager("easa_complete.db")
results = manager.search("flight time limitations", top_k=5)

for result in results:
    print(f"{result.reference}: {result.title} (score: {result.score:.3f})")

📁 项目结构

EASACompliance/              # Project root
├── build_embeddings.py      # Build embeddings database (root script wrapper)
├── chat_mcp.py              # Chat MCP client (root script)
├── compliance_crew.py        # CrewAI compliance validator (root script)
├── run_mcp_server.py        # MCP server launcher (root script)
├── install.sh               # Installation script (uses uv)
├── env.example              # Environment variables template
├── requirements.txt          # Consolidated dependencies
│
├── easacompliance/          # Main package
│   ├── __init__.py          # Public exports
│   ├── parser.py            # EASA parser (EASAParser, Topic, TopicType)
│   ├── embeddings.py        # Embeddings manager (EmbeddingsManager)
│   └── scripts/             # CLI scripts
│       ├── build_embeddings.py
│       └── search_regulations.py
│
├── mcp_server_easa/          # MCP server package
│   ├── server.py            # MCP server implementation
│   ├── config.py            # Configuration
│   ├── schemas.py           # Data schemas
│   └── tools/               # MCP tools
│       ├── search.py
│       ├── retrieve.py
│       ├── browse.py
│       └── validate.py
│
├── tests/                   # Tests
│   ├── test_embeddings.py
│   ├── test_chat_setup.py
│   └── test_crew_setup.py
│
├── docs/                    # Documentation
│   ├── chat/                # Chat MCP documentation
│   │   ├── README.md
│   │   ├── QUICKSTART.md
│   │   └── IMPLEMENTATION.md
│   ├── crew/                # CrewAI documentation
│   │   ├── README.md
│   │   └── IMPLEMENTATION.md
│   ├── EMBEDDINGS_GUIDE.md
│   └── ...
│
├── data/                    # Reference data
│   └── EASA-eRules-XML-Export-Schema-1.0.0.xsd
│
├── README.md
├── pyproject.toml
└── requirements.txt

📊 统计

解析器提取 3357+结构化主题 来自空中作战文件:

类型计数描述
红外1025实施细则
美国数学竞赛1263可接受的合规方式
GM转IR1026实施细则指导材料
计算机科学7认证规范
GM转CS18认证规范指导材料
其他18便捷访问规则、免责声明等。

备注:使用批处理模式时,从其他EASA文件(机组人员等)中提取其他主题。

🔧 筛选选项

所有过滤选项在这两种情况下都有效 单个文件批处理目录 模式:

按类别

--category "ORO.FTL"     # All ORO.FTL.*
--category "CS FTL"      # All CS FTL.*

按内容类型

--types IR               # Only Implementing Rules
--types IR AMC           # IR + AMC
--types ALL              # All (default)

按监管主体

--subject "Part-ORO"     # All Part-ORO
--subject "Part-CAT"     # All Part-CAT

按正则表达式模式

--pattern "ORO\\.FTL\\." # Custom pattern

备注:使用批处理模式时,过滤器应用于所有文件(--dir).

📚 文档

🧪 测试

# Run tests
python -m pytest tests/

# Or directly
python tests/test_embeddings.py
python tests/test_chat_setup.py
python tests/test_crew_setup.py

📝 更新日志

更改日志.md 版本历史。

🤝 贡献

欢迎投稿!请随时打开问题或拉取请求。

📄 许可证

MIT许可证-有关详细信息,请参阅许可证文件。

🙏 致谢

  • EASA官方XML模式
  • 嵌入语句变换器
  • Python开发工具社区

📧 联系

如有疑问或建议,请在GitHub上发布问题。

______________________________________________________________________

版本: 2.0.0\ 最后更新: 2025

目录标签

目录标签

安全Python搜索法规解析本地部署语义搜索航空安全合规验证自动化审计

接入字段

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

stdio

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

api-key

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

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

0

权限和风险

stdioapi-key部署方式未说明

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

安装前确认

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

来源信息

继续浏览同类 MCP