
Aviation Accident Analysis MCP
io.github.hzy9981Published by GitHub account hzy9981v0.1.0Updated Oct 25, 2026
Aviation accident report parsing and prompt generation service under the SHELL framework.
Overview
A local MCP server that parses aviation accident reports (PDF, DOCX, TXT) and injects the text into GraphRAG prompt templates for entity and cause extraction.
- What you can do
- Parse and clean aviation accident report documents in PDF, DOCX and TXT formats from a given file path, then inject the extracted text into a chosen prompt template for GraphRAG entity and relationship extraction; list the prompt templates available in the prompts directory. The wider project builds a human-machine-environment-management knowledge graph and can export results to Neo4j.
- When to use it
- Useful when working with aviation accident reports and wanting an assistant to turn them into structured GraphRAG extraction prompts, or when exploring the project's knowledge-graph pipeline for accident cause analysis.
- Requirements
- Runs as a local Python process (Python 3.10+, uv recommended), started with uv run mcp_server.py. The full pipeline needs a GraphRAG settings.yaml with an LLM endpoint (local Ollama or an OpenAI-compatible API); the optional Docker setup includes Neo4j.
Installation
In SourceWeft
- Open Aviation Accident Analysis MCP in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
航空事故致因抽取与知识图谱项目 (Aviation Accident Analysis)
本项目基于 Microsoft GraphRAG 框架 ,旨在自动从航空事故报告中抽取实体与因果关系,并构建符合“人-机-环-管”框架的知识图谱。
项目结构
data/: 原始数据与地标数据。input/: GraphRAG 输入目录(清洗后的文本)。output/: GraphRAG 输出结果(Parquet, GraphML 等)。prompts/: 自定义的 GraphRAG 提取提示词。src/:ingest.py: PDF/DOCX 解析与文本清洗。evaluate.py: 提取准确率与 F1 分数评测脚本。
run.sh: 一键运行脚本。settings.yaml: GraphRAG 配置文件。
环境要求
- Python 3.10+
- uv (推荐)
环境配置注意事项
- 若遇到 LLM 连接错误,请检查
settings.yaml中的api_base是否配置正确。在某些 Docker 或受限环境中,建议将localhost修改为127.0.0.1。 - 本项目已对
prompts/extract_graph.txt中的抽取示例进行了优化,通过引入复杂场景示例,提升了在航空事故报告中的实体抽取表现。
Prompt 优化与评估记录 (2026-07-24)
优化策略
针对航空事故报告的复杂性,对 prompts/extract_graph.txt 进行了多轮手动迭代优化:
- 实体原子化:强制拆分复杂短语(如“燃油管路破裂”拆分为实体“燃油管路”与关系“破裂导致”),提升知识图谱的结构化程度。
- 严格去噪:建立了否定约束,排除通用职衔(如单独的“机长”)和指示代词(如“该部件”),提升精确率。
- 少样本增强:集成了
few_shot_data.csv中的高质量航空事故致因链示例,引导模型识别长程因果关系。 - 因果链强制构建:明确
[因素] -> [事件] -> [结果]的链条要求。
评估结果 (Fuzzy Match)
通过 scripts/run_automated_evaluation.py 运行自动化评估,对比 data/ground_truth.json 得到以下指标:
结论:实体抽取的精确率和 F1 分数相比基准版本有显著提升。关系抽取受限于本地模型的指令遵循能力,仍有优化空间。
MCP 服务 (Model Context Protocol)
本项目提供了一个 MCP 服务,方便通过 MCP 客户端(如 Claude Desktop)直接调用文档解析与提示词生成功能。
核心功能
- 文档解析:支持 PDF、DOCX、TXT 格式的自动解析与清洗。
- 提示词注入:将解析出的文档内容自动注入到指定的提示词模板中。
启动方式
可用工具
upload_and_generate_prompt:- 参数
file_path: 文档路径。 - 参数
template_name:prompts/目录下的模板名(默认extract_entities)。
- 参数
list_available_templates: 列出所有可用的提示词模板。
🐳 一键启动 (Docker)
如果你想快速启动整个分析环境(包含 Neo4j 数据库和 MCP 服务),可以使用 Docker Compose:
启动后:
- Neo4j 控制台: http://localhost:7474 (默认账号:
neo4j, 密码:password) - MCP 服务: 已在容器内运行,并自动连接到容器内的 Neo4j。
运行流程
- 将事故报告(PDF/DOCX/TXT)放入
data/input_reports。 - 运行流水线:
使用 Ollama (本地 LLM)
在 settings.yaml 中修改 completion_models 和 embedding_models:
注意:GraphRAG 对本地模型的支持取决于模型的遵循指令能力。
提取 Schema (人-机-环-管)
- 实体类型: person (人), equipment (机), environment (环), organization (管), procedure, event, weather, violation.
- 关系类型: leads to, limited by, violates, not executed, belongs to.
Neo4j 知识图谱导入
- 本项目支持将 GraphRAG 提取的实体与关系导入 Neo4j 图数据库。
- 使用
src/export_to_neo4j.py脚本完成导入。 - 已配置 Docker 容器运行 Neo4j 实例,确保能够正常连接。
Source: README.md at commit 82a0ccc
Tools
0Version history
1- v0.1.0LatestSep 16, 2026
Score
40% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Declare a license in the repository or the registry entry.