Token导航 LogoToken导航TokenDH.com
Jama MCP Server Graphrag logo
数据服务stdio官方级别未说明来源级核验

Jama MCP Server Graphrag

MCP Server

一个基于知识图谱的检索增强生成系统,提供聊天界面和多级图增强检索功能,适用于需求管理和可追溯性领域。

工具数

7

提示词数

0

GitHub Stars

1

资源数

0
知识图谱Python检索增强生成

安装说明

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

作者 / 组织

arthurfantaci

提供方

arthurfantaci

最后核验

2026/5/17 20:20

运行时

Python

快速接入

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

命令预览

uv run uvicorn requirements_graphrag_api.api:app --reload

详细介绍

![CI](https://github.com/arthurfantaci/requirements-graphrag-api/actions/workflows/ci.yml) ![codecov](https://codecov.io/gh/arthurfantaci/requirements-graphrag-api) ![License: MIT](LICENSE) ![Python 3.12+](https://www.python.org/downloads/) ![React 19](https://react.dev/)

需求图API

A. 图增强检索增强生成 (GraphRAG)系统,带有聊天界面 Jama软件“需求管理和可追溯性基本指南” 知识库。特点和 代理RAG架构 基于LangGraph构建,具有自主工具选择、多跳推理和自我批评功能。包括4级图丰富管道、自动查询路由、具有渐进元数据的SSE流、会话持久性和具有综合评估的端到端LangSmith可观察性。

现场演示

截图

Welcome screen showing sidebar with quick-start prompts and architecture overview

GraphRAG explanatory response — intent badge, citations, entity concepts, media gallery

Text2Cypher structured response — generated Cypher query with tabular results

特性

图形丰富的RAG管道

每个查询都经过一个多阶段的丰富管道,该管道逐步从Neo4j知识图中添加上下文:

级别丰富它增加了什么
1窗口扩展相邻块文本通过 NEXT_CHUNK 叙事连续性关系
2实体提取实体 MENTIONED_IN 具有属性的块:名称、类型、定义、益处、影响
3语义遍历相关实体通过 RELATED_TO, ADDRESSES, REQUIRES, COMPONENT_OF 关系
4域上下文行业标准、图像、网络研讨会、视频、交叉引用和术语表定义

自动查询路由

两级分类器将每个查询路由到适当的处理程序:

  • 第一阶段——关键词匹配:一组冻结的结构化触发器("list all", "how many", "count", "table of")加上用于即时分类的正则表达式模式
  • 第二阶段——LLM分类:对于不明确的查询,LLM分类器(温度0)返回 {"intent": "structured" | "explanatory"}
意图处理程序输出
解释性自主工具选择+图形丰富的代理RAG带有引用、实体、媒体的流式散文
结构化的Text2Cypher--自然语言转换为Cypher查询生成的查询+表格结果

代理RAG架构

建立在 LangGraph,代理系统自主地协调检索和合成:

┌─────────────────────────────────────────────────────────────────┐
│                      AGENTIC ORCHESTRATOR                        │
│  ┌──────────┐    ┌──────────┐    ┌──────────┐    ┌──────────┐  │
│  │   RAG    │───▶│ Research │───▶│Synthesis │───▶│  Output  │  │
│  │ Subgraph │    │ Subgraph │    │ Subgraph │    │          │  │
│  └──────────┘    └──────────┘    └──────────┘    └──────────┘  │
│       │               │               │                         │
│       ▼               ▼               ▼                         │
│  Query Expansion  Entity        Self-Critique                   │
│  Parallel Search  Exploration   Revision Loop                   │
└─────────────────────────────────────────────────────────────────┘
子图节点能力
检索增强生成expand_query→ 并行重试→ dedupe_rank带回溯推理的多查询扩展
研究识别实体→ explore_instance(循环)带条件迭代的深度实体探索
合成草稿_答复→ 批评→ 修订→ 格式自动修订的自我批评

主要特点:

  • 7代理工具:graph_search、text2cypher、explore_instance、lookup_standard、search_definition、lookup_term、get_webinars
  • 对话持久性:PostgresSaver用于线程隔离的多轮对话
  • 自我批评:CRITIC提示评估答案的完整性,并在需要时触发修订
  • 性能跟踪:子图执行时间和优化提示的内置指标
  • 成本分析:LLM令牌跟踪,每个模型的成本估算

SSE流媒体聊天

通过渐进式元数据传递的服务器发送事件上的响应流:

Explanatory:  routing → sources → token (repeated) → done
Structured:   routing → cypher → results → done

每个事件都携带键入的JSON有效载荷(StreamEventType StrEnum有7个值: ROUTING, SOURCES, TOKEN, CYPHER, RESULTS, DONE, ERROR).前端通过自定义方式使用这些 useSSEChat 反应钩子。

附加功能

  • 搜索模式 --向量相似性、混合(向量+全文,权重可调)和图形丰富的搜索端点
  • 术语表和定义 --基于知识图的模糊匹配项查找
  • 行业标准 --按行业(汽车、医疗、航空航天、国防、铁路)筛选的可查询标准
  • 架构浏览器 --节点标签、关系和计数;每个实体关系图
  • 用户反馈 --分数+类别+校正,与LangSmith跑步ID相关
  • 分层评估 --通过GitHub Actions对发布标签(第3层)和夜间深度评估(第4层)进行自动基准测试

建筑

┌──────────────────────┐
│   React 19 + Vite    │
│   Tailwind CSS v4    │
│   (Vercel)           │
└──────────┬───────────┘
           │ SSE / REST
           ▼
┌──────────────────────────────────────┐
│   FastAPI + Agentic Orchestrator     │
│   (LangGraph StateGraph)             │
│   ├─ Query Router                    │──── LangSmith Tracing
│   ├─ Tool Selection                  │
│   └─ Self-Critique Loop              │
│   (Railway)                          │
└──────┬───────┬───────────────────────┘
       │       │              │
       ▼       ▼              ▼
  ┌─────────┐ ┌────────────┐ ┌──────────────┐
  │ Agentic │ │ Text2Cypher│ │  PostgreSQL  │
  │   RAG   │ │  (LLM →    │ │  Checkpoints │
  │Subgraphs│ │   Cypher)  │ │ (Persistence)│
  └────┬────┘ └──────┬─────┘ └──────────────┘
       │             │
       ▼             ▼
┌──────────────────────┐
│   Neo4j AuraDB       │
│   Knowledge Graph    │
│   (Chunks, Entities, │
│    Media, Standards) │
└──────────────────────┘

技术栈

技术目的
前端React 19、Vite 7、Tailwind CSS 4带有SSE流媒体、实体徽章、媒体画廊的聊天UI
后端FastAPI,Python 3.12+,uvREST API,带SSE端点,异步I/O
图形数据库Neo4j AuraDB、Neo4j graphrag知识图存储、向量索引、Cypher查询
LLMOpenAI GPT-4o,Voyage AI Voyage-4答案生成、意图分类、嵌入
代理编排LangGraph,LangGraph检查点postgres有状态代理图,子图组合,会话持久性
链构成朗链核心、朗链开放RAG链建设、及时管理
可观察性LangSmith跟踪、反馈、即时版本控制、评估
CI/CDGitHub操作,CodecovLint,测试,覆盖率,评估,提示同步
部署铁路(后端),Vercel(前端)Docker容器,边缘CDN

API终点

方法路径描述
POST/chat带有自动意图路由的SSE流式聊天
GET/chat/{thread_id}按线程ID检索对话状态
POST/chat/{thread_id}/continue继续现有的对话线程
GET/chat/routing-guide面向用户的查询路由文档
POST/search/vector语义向量相似度搜索
POST/search/hybrid向量+关键字搜索,权重可调
POST/search/graph多级图丰富搜索
GET/definitions/{term}查找特定的词汇表术语(模糊匹配)
GET/definitions列出或搜索所有术语表术语
GET/standards/{name}查找特定的行业标准
GET/standards使用可选行业筛选器列出或搜索标准
GET/schema节点标签、关系和计数
GET/schema/entity/{name}探索实体及其关系
POST/feedback提交响应反馈(评分、类别、更正)
GET/health使用Neo4j连接状态进行健康检查

知识图谱

节点类型

类别标签关键属性
内容Chunk, Article, Definition文本、文章标题、url、术语、定义
域实体Concept, Challenge, Bestpractice, Standard, Methodology, Artifact, Tool, Role, Processstage, Industry名称、显示名称、定义、好处、影响
媒体Image, Webinar, Video标题、URL、ALT文本、缩略图

关系

关系方向目的
FROM_ARTICLEChunk→ 文章来源
NEXT_CHUNKChunk→ Chunk顺序排序(窗口扩展)
MENTIONED_IN实体→ 块实体提取
RELATED_TO实体→ 实体跨域连接
ADDRESSES实体→ 实体挑战解决
REQUIRES实体→ 实体依赖关系
COMPONENT_OF实体→ 实体部分整体
APPLIES_TO标准→ 行业行业适用性
HAS_IMAGE / HAS_WEBINAR / HAS_VIDEO文章→ 媒体媒体丰富
REFERENCES文章→ 文章交叉引用

实体颜色编码

前端显示知识图实体的颜色编码徽章:

实体类型颜色示例
概念灰色需求可追溯性,商业智能
挑战红色范围蠕变,需求波动
最佳实践绿色变更管理,持续验证
ArtifactBlue设计规范、测试用例
标准紫色ISO 13485,DO-178C

快速开始

Docker(推荐)

# Clone and configure
git clone https://github.com/arthurfantaci/requirements-graphrag-api.git
cd requirements-graphrag-api
cp .env.example .env
# Edit .env with your Neo4j, OpenAI, and LangSmith credentials

# Start both services
docker-compose up

# Backend API: http://localhost:8000
# Frontend:    http://localhost:5173
# API Docs:    http://localhost:8000/docs

没有Docker

# Backend
cd backend
uv sync --extra dev
uv run uvicorn requirements_graphrag_api.api:app --reload

# Frontend (new terminal)
cd frontend
npm install
npm run dev

部署

平台服务URL配置
铁路后端APIgraphrag-api.norfolkaibi.comrailway.toml, backend/Dockerfile
Vercel前端graphrag.norfolkaibi.comfrontend/vercel.json
Neo4j AuraDB图形数据库--neo4j+s:// env变量中的URI

CI/CD和评估

工作流触发器它的作用
持续集成 (ci.yml)推送到主/开发,PRRuff lint+格式检查,覆盖率pytest,Codecov上传
评估 (evaluation.yml)发布标签、夜间时间表、手册发布的第3级完整基准;每晚进行4级深度评估(失败时自动创建GitHub问题)
同步提示 (sync-prompts.yml)推送到主(提示文件),手动将版本化的提示推送到LangSmith Hub
部署 (deploy.yml)手动调度手动Vercel部署(禁用--Vercel GitHub集成处理自动部署)

环境变量

backend/.env.example 对于带有内联文档的完整模板。

变量必填默认描述
NEO4J_URI--Neo4j连接URI(neo4j+s:// 用于生产)
NEO4J_USERNAME--Neo4j用户名
NEO4J_PASSWORD--Neo4j密码
NEO4J_DATABASE没有neo4jNeo4j数据库名称
OPENAI_API_KEY-OpenAI API密钥
OPENAI_MODEL没有gpt-4oLLM生成和分类模型
EMBEDDING_MODEL没有voyage-4嵌入模型(必须与Neo4j索引匹配)
EMBEDDING_DIMENSIONS没有1024嵌入向量维度(必须与索引匹配)
VOYAGE_API_KEY-Voyage AI API键用于查询时嵌入
OPENAI_EMBEDDING_MODEL没有text-embedding-3-smallOpenAI嵌入模型(仅限离线RAGAS评估者)
VECTOR_INDEX_NAME没有chunk_embeddingsNeo4j矢量索引名称
SIMILARITY_K没有6要检索的相似块的数量
NEO4J_MAX_POOL_SIZE没有5连接池大小(无服务器时较小)
NEO4J_CONNECTION_TIMEOUT没有30.0连接超时(秒)
LANGSMITH_TRACING没有false启用LangSmith跟踪
LANGSMITH_API_KEY-LangSmith API密钥
LANGSMITH_PROJECT没有graphrag-api-devLangSmith项目名称
CHECKPOINT_DATABASE_URL没有用于会话持久性的PostgreSQL URL(LangGraph检查点)
CORS_ORIGINS没有localhost:3000,5173允许的CORS源(逗号分隔)
VITE_API_URL是(前端)-前端的后端API URL

项目结构

requirements-graphrag-api/
├── .github/workflows/
│   ├── ci.yml                          # Lint + test + coverage
│   ├── evaluation.yml                  # Tiered evaluation (release + nightly)
│   ├── sync-prompts.yml                # LangSmith Hub prompt sync
│   └── deploy.yml                      # Manual Vercel deploy
│
├── backend/
│   ├── src/requirements_graphrag_api/
│   │   ├── api.py                      # FastAPI app with lifespan (driver init)
│   │   ├── config.py                   # AppConfig with env validation
│   │   ├── neo4j_client.py             # Driver creation helpers
│   │   ├── observability.py            # LangSmith tracing setup
│   │   ├── exceptions.py               # Custom exception hierarchy
│   │   ├── core/
│   │   │   ├── retrieval.py            # Vector/hybrid/graph search + 4-level enrichment
│   │   │   ├── generation.py           # RAG answer generation + SSE streaming
│   │   │   ├── routing.py              # Intent classification (keyword + LLM)
│   │   │   ├── text2cypher.py          # Natural language → Cypher translation
│   │   │   ├── definitions.py          # Glossary/definition lookup
│   │   │   ├── standards.py            # Industry standards queries
│   │   │   └── agentic/                # LangGraph agentic orchestration
│   │   │       ├── state.py            # TypedDict state definitions
│   │   │       ├── tools.py            # Agent tool definitions (7 tools)
│   │   │       ├── orchestrator.py     # Main composed graph with routing
│   │   │       ├── checkpoints.py      # PostgresSaver configuration
│   │   │       ├── streaming.py        # SSE streaming utilities
│   │   │       └── subgraphs/          # RAG, Research, Synthesis subgraphs
│   │   ├── routes/
│   │   │   ├── chat.py                 # /chat SSE endpoint
│   │   │   ├── search.py              # /search/vector|hybrid|graph
│   │   │   ├── definitions.py          # /definitions, /glossary
│   │   │   ├── standards.py            # /standards
│   │   │   ├── schema.py              # /schema
│   │   │   ├── feedback.py             # /feedback (LangSmith integration)
│   │   │   └── health.py              # /health
│   │   ├── prompts/
│   │   │   ├── catalog.py              # PromptCatalog with Hub caching
│   │   │   └── definitions.py          # Prompt text + Text2Cypher examples
│   │   └── evaluation/
│   │       ├── __init__.py             # Exports all evaluation utilities
│   │       ├── agentic_evaluators.py   # LangSmith evaluators for agentic RAG
│   │       ├── performance.py          # Subgraph performance tracking
│   │       ├── cost_analysis.py        # LLM cost tracking and estimation
│   │       ├── metrics.py              # Standard RAG evaluation metrics
│   │       └── domain_metrics.py       # Domain-specific metrics
│   ├── tests/                          # pytest suite (unit + integration)
│   ├── Dockerfile                      # Production container (Python 3.12)
│   └── pyproject.toml                  # Dependencies, Ruff, pytest config
│
├── frontend/
│   ├── src/
│   │   ├── App.jsx                     # Main layout (header, sidebar, chat)
│   │   ├── hooks/useSSEChat.js         # SSE streaming hook
│   │   └── components/
│   │       ├── chat/                   # MessageList, ChatInput, AssistantMessage
│   │       ├── metadata/              # EntityBadges, CypherDisplay, ResultsTable
│   │       ├── feedback/              # FeedbackBar, FeedbackModal
│   │       └── sidebar/               # Sidebar, quick-start templates
│   ├── Dockerfile                      # Dev/prod Node container
│   └── package.json                    # React 19, Vite 7, Tailwind 4
│
├── docker-compose.yml                  # Local dev: backend + frontend
├── railway.toml                        # Railway deployment config
└── LICENSE                             # MIT

许可证

麻省理工学院

目录标签

目录标签

知识图谱Python检索增强生成本地部署需求管理多跳推理自主工具选择

接入字段

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

stdio

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

token

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

7

资源数量(resourceCount,资源数)

0

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

0

权限和风险

stdiotoken部署方式未说明

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

安装前确认

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

来源信息

继续浏览同类 MCP