MCP Research Pipeline
A stage-gated MCP server for processing academic papers, enabling sequential extraction of paper sections, methodology, results, and report generation through a controlled workflow with enforced tool visibility across stages.
README
MCP Research Pipeline
This is my personal learning project for exploring Hermes Agent and MCP tree architecture. The goal is not to provide a production-grade academic paper review system, though it may grow into something more useful later. The main purpose is to understand how a larger agent runtime can call a custom MCP service, how work can be split across stage-specific MCP servers, and how an aggregator can enforce which tools are visible at each step.
This project is a stage-gated MCP tree for academic paper processing. A central
aggregator is the only entry point for the staged workflow for now. It loads one
MCP server over stdio for the current workflow phase, verifies that the server
exposes exactly the tools listed in src/config/phase_manifest.json, runs that
phase, then closes the stdio session before moving to the next phase.
The core rule is enforced in src/aggregator/router.py: Stage 2 cannot call
Stage 3, 4, or 5 tools because only the Stage 2 MCP server is connected and the
router rejects any tool name outside the active phase manifest.
In my local setup, Hermes Agent is the client/runtime I use to interact with this pipeline. This repository contains the MCP research pipeline itself; Hermes is kept as a separate supporting project and connects to this service through MCP.
Project Layout
mcp-research-pipeline/
|-- main.py
|-- pipeline_server.py
|-- Dockerfile
|-- docker-compose.yml
|-- requirements.txt
|-- README.md
`-- src/
|-- aggregator/
| `-- router.py
|-- config/
| `-- phase_manifest.json
|-- db/
| `-- step_results.py
|-- servers/
| |-- ingestion_server.py
| |-- context_server.py
| |-- methodology_server.py
| |-- results_server.py
| `-- report_server.py
`-- output/
|-- step_results.sqlite
|-- report_<run_id>.json
|-- report_<run_id>.md
`-- papers/
main.py is the command-line entrypoint. pipeline_server.py exposes the
pipeline as an HTTP MCP server with a run_research_pipeline tool. The actual
router, stage servers, manifest, database helper, and generated outputs live
under src/.
Architecture
Each server is a separate FastMCP stdio server:
| Stage | Server | Active tools |
|---|---|---|
| 1 | src/servers/ingestion_server.py |
fetch_paper, extract_raw_text, detect_sections |
| 2 | src/servers/context_server.py |
extract_abstract, extract_introduction, summarize_context, extract_research_questions |
| 3 | src/servers/methodology_server.py |
extract_methodology, identify_hardware, identify_frameworks, extract_datasets |
| 4 | src/servers/results_server.py |
extract_results, extract_conclusion, summarize_conclusion, extract_key_metrics |
| 5 | src/servers/report_server.py |
compile_report, export_markdown, save_to_file |
Intermediate outputs are saved in SQLite at src/output/step_results.sqlite.
Full stage outputs are persisted for recovery, but the simulated orchestrator
context passed between stages uses only compressed summaries from
StepResultsDB, not the raw full paper text.
Install
cd mcp-research-pipeline
python -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
Windows PowerShell:
cd mcp-research-pipeline
py -3.11 -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
Run
Process a real arXiv paper:
PYTHONPATH=src python main.py --paper https://arxiv.org/abs/1706.03762 --verify-gate
Windows PowerShell:
$env:PYTHONPATH = "src"
python main.py --paper https://arxiv.org/abs/1706.03762 --verify-gate
The --verify-gate flag intentionally attempts to call the Stage 3
extract_methodology tool while Stage 2 is active. The router blocks it before
the request reaches any server.
Expected progress output:
[stage_2_context] active tools: extract_abstract, extract_introduction, extract_research_questions, summarize_context
stage gate verified: Tool 'extract_methodology' is not active in phase 'stage_2_context'. Allowed tools for this phase: extract_abstract, extract_introduction, summarize_context, extract_research_questions
run_id: 20260610T120000Z
[stage_1_ingestion] active tools: detect_sections, extract_raw_text, fetch_paper
[stage_1_ingestion] tools unloaded
[stage_2_context] active tools: extract_abstract, extract_introduction, extract_research_questions, summarize_context
[stage_2_context] tools unloaded
[stage_3_methodology] active tools: extract_datasets, extract_methodology, identify_frameworks, identify_hardware
[stage_3_methodology] tools unloaded
[stage_4_results] active tools: extract_conclusion, extract_key_metrics, extract_results, summarize_conclusion
[stage_4_results] tools unloaded
[stage_5_report] active tools: compile_report, export_markdown, save_to_file
[stage_5_report] tools unloaded
Generated reports land in src/output/:
src/output/report_<run_id>.json
src/output/report_<run_id>.md
src/output/step_results.sqlite
Docker
The compose file is meant to run the HTTP MCP server from pipeline_server.py
so Hermes can connect to it as an external MCP service. It joins the external
Docker network hermes-mcp, which is also used by my Hermes setup.
Create the network once if it does not exist:
docker network create hermes-mcp
Build and run the service:
docker compose up --build
The MCP service listens on 127.0.0.1:8000 from the host. Inside the pipeline,
the aggregator starts each stage server as a local stdio child process, one stage
at a time. This preserves stdio transport while still packaging the full server
tree.
For a Hermes client running in the same Docker network, the MCP endpoint is:
http://research-mcp:8000/mcp
For a Hermes client running directly on the host, use:
http://127.0.0.1:8000/mcp
Stage Gate Enforcement
The enforcement has three layers:
src/config/phase_manifest.jsonmaps each phase to its allowed tool names.ResearchPipelineRouter.active_stage()starts only the MCP server for the active phase and verifiessession.list_tools()equals the manifest tools.ActiveStageClient.call_tool()rejects any tool not listed for the active phase before callingsession.call_tool().
Because the router closes the stdio session after every phase, tools from prior or future phases are not visible in the active MCP context.
Notes
- PDF text extraction uses
pypdf, so quality depends on the PDF text layer. - The summaries are heuristic and dependency-light. You can replace those tools with model-backed implementations later without changing the tree architecture.
fetch_paperaccepts local PDF paths, direct PDF URLs, and arXiv abstract URLs.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。