literature-bot-mcp
This server acts as a local literature assistant, enabling users to search academic papers on arXiv, retrieve evidence from specific PDFs, and validate scientific claims.
Search for papers on arXiv using semantic query inputs.
Acquire and process PDF papers into searchable data chunks.
Perform BM25-based retrieval to find relevant text evidence for a given query.
Link retrieved textual evidence back to the original PDF page numbers.
Provide structured diagnostic prompts (MiniCheck) to aid in manual scientific verification of findings.
Provides tools for searching arXiv papers, retrieving paper metadata, downloading and parsing PDFs, and retrieving relevant text evidence from prepared papers for question answering with page citations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@literature-bot-mcp分析 arXiv 论文 2508.19294v2 的主要方法,并给出页码依据"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Local MCP Literature Assistant
文献搜索与问答助手,支持语义排序、原文溯源与科学证据核对。
在本地搜索 arXiv、读取 PDF,并用可追溯的正文证据回答文献问题。 提供 Streamlit 聊天界面和独立的本地 stdio MCP Server。
从查找论文到核对回答依据,在一个界面中完成。科学证据核对会提供 片段支持度、数值与实验条件等诊断提示,帮助定位需要回到原文确认的内容; 它不认证结论真假,也不会自动修改回答。
本仓库面向希望在自己电脑上运行文献助手的用户。无需使用 Notebook、 MCP Inspector 或开发评测脚本,安装后直接通过浏览器使用。
功能
查找论文:搜索 arXiv,用 SPECTER2 对标题与摘要候选进行语义排序。
基于原文问答:读取 PDF,通过 BM25 查找相关正文片段,生成带引用的回答。
追溯回答依据:将结论与证据片段关联,通过页码引用查看 PDF 原文。
核对科学证据:结合本地 MiniCheck、简单计算、比例与单位规则,以及实验条件差异,提供只读诊断提示。
便于人工确认:逐条查看诊断,并按需下载回答诊断或人工核对材料。
多种使用入口:浏览器内提供搜索、分析、总结快捷任务,也可通过 MCP Tools、Resources 和 Prompts 接入其他客户端。
SPECTER2 只重排最多 10 篇 arXiv 候选,不是全库语义检索。 MiniCheck 只评估所给片段的支持信号,低分不等于论文反驳。
Related MCP server: arxiv-mcp
安装
以下命令用于 Windows 的 Anaconda Prompt;需要 Git、Conda 和网络连接。
git clone https://github.com/Remus-cloud/local-mcp-literature-assistant.git
cd local-mcp-literature-assistant
conda create -n literature-bot python=3.12 -y
conda activate literature-bot
python -m pip install -e ".[scientific,verification]"
python scripts/prepare_verification.py环境已存在时跳过创建命令。MiniCheck 准备步骤会下载约 3.2 GB 固定版本权重; SPECTER2 在首次搜索时下载并缓存权重。已有缓存不必重新下载。 无 Git 时可下载仓库 ZIP,解压后在项目根目录执行后续命令。
已验证的 Windows / Python 3.12 依赖版本记录在 版本快照。若需要尽量复现本次验证环境, 可将安装命令换为:
python -m pip install -c docs/tested-windows-py312.txt -e ".[scientific,verification]"这是测试时的版本约束,不是跨平台锁文件;其他系统不保证使用完全相同的版本。
配置接口
首次使用:
if not exist .env copy .env.example .env
notepad .env不要覆盖已有 .env。填写:
DASHSCOPE_API_KEY=你的API密钥
DASHSCOPE_BASE_URL=https://你的服务地址/v1
DASHSCOPE_MODEL=服务商提供的模型ID
LITERATURE_BOT_EXTRA_BODY={}沿用的 DASHSCOPE_* 变量名不限定服务商。接口需支持 OpenAI 格式的
Chat Completions、工具调用及工具结果消息,结构化绑定默认还使用
response_format={"type":"json_object"}。仅支持普通聊天不够。
默认不发送私有扩展参数。若当前 Qwen 服务需要关闭思考模式,可显式设置:
LITERATURE_BOT_EXTRA_BODY={"enable_thinking":false}问答及辅助模型调用使用同一配置,无需修改源码。 扩展配置不允许覆盖 model/messages/tools 等核心字段。 接口兼容性仍需由服务商确认,不承诺所有模型都接受相同的 token 或 JSON 模式参数。 SDK 扩展机制见 OpenAI Python 官方文档。
不支持 JSON 模式的服务可将 LITERATURE_BOT_BINDING_FORMAT=prompt_only;
此模式仍严格校验返回内容,但格式失败风险更高。
不要把真实 .env、密钥或研究会话记录提交到仓库。
启动与使用
在项目根目录运行:
python scripts/check_setup.py
python -m streamlit run src/literature_bot/streamlit_app.py --server.address 127.0.0.1 --server.port 8501 --browser.gatherUsageStats false浏览器访问 http://localhost:8501。保持终端开启,停止时按 Ctrl+C。
以后重新进入项目目录并 conda activate literature-bot,执行同一启动命令即可。
页面中的三个选择
论文排序:SPECTER2 按标题和摘要重排候选论文;正文证据仍由 BM25 检索。
运行科学核验:为新回答增加 MiniCheck 及数值等检查,可能增加耗时与 API 费用。
显示诊断:查看已经生成的提示;隐藏或显示不会重新调用模型。
页面选项只影响当前会话的使用;关闭核验运行只影响之后的新问题, 不会删除已有诊断,结构化引用仍保留。 首次使用建议先完成一次搜索,再针对指定论文提问并开启核验。
示例:
搜索 5 篇关于 multimodal object detection 的论文。
分析 arXiv <填入所选论文的完整 ID> 的实验设置、主要结果和局限,并给出原文依据。
每次提问独立,页面旧消息不构成模型长期记忆;请明确给出 arXiv ID。 “查看原文”的页码是 PDF 文件页序,不一定是印刷页码。
如何理解诊断
“支持信号”只表示所提供片段与结论具有一定一致性,不等于结论已被科学证明。 “低支持信号”也不等于论文反驳;可能是证据片段不足、翻译偏差或模型误判。 未评分、证据不足和条件不同均不能当作核验通过。请结合页码引用查看原文, 特别留意表格、实验条件与比较对象。
可选:MCP 与命令行
网页会自动启动 MCP 子进程,无需单独运行 Inspector 或 Server。
Streamlit → Chatbot → MCP Client → 本地 stdio MCP Server
├─ arXiv / SPECTER2
└─ PDF / BM25
回答与证据 → MiniCheck / 数值规则 / 统一诊断 → 只读提示可独立启动:
literature-bot-mcp
literature-bot-chat --question "搜索三篇视觉语言模型论文"第一条用于 MCP 客户端通信,不会启动网页。支持四个文献 Tools、 论文元数据/页面 Resources,以及搜索/分析/总结 Prompts。
限制与数据处理
面向本地单用户,不包含公网服务、登录或多用户隔离。
检索只覆盖 arXiv 候选及选中的正文片段,不保证全文审阅。
指定历史 arXiv 版本时,当前流程可能返回其他版本;涉及版本对比或精确复现时,请先核对返回的论文 ID 与 PDF 版本。
复杂任务可能达到工具调用轮次上限而无法完成;可先搜索并确认论文,再将分析任务拆成较小的问题。
不支持扫描 PDF OCR;复杂表格、公式和多栏排版可能损坏。
数值与条件规则覆盖较窄,不验证因果、统计显著性或实验可重复性。
MiniCheck 最多检查 8 条已绑定结论;未评分不算通过,分数未经领域校准。
语义核验软预算不是硬超时;首次加载和 CPU 推理可能较慢。
问题、证据和核验翻译会发送到所配置的 API,可能产生费用。
普通聊天仅保存在浏览器会话;论文缓存和主动导出的文件保存在本地。
常见问题
启动提示缺少模块或找不到命令
确认已激活 literature-bot 环境,并在含有 pyproject.toml 的项目根目录
执行安装命令。python scripts/check_setup.py 可检查配置项是否填写、安装版本
和部分模型缓存,不会调用付费 API;它不代表网络连接或实际推理已验证。
接口能聊天,但文献问答失败
检查工具调用与 JSON 模式支持,以及模型 ID、额度和扩展参数。
若服务不支持 JSON 模式,可尝试上文的 prompt_only 配置。
配置修改后应停止并重新启动应用。
模型下载失败或首次搜索很慢
科学组件需要访问 Hugging Face 下载权重,并占用数 GB 磁盘和额外内存。
先确认网络及磁盘空间,MiniCheck 下载失败后可重新运行
python scripts/prepare_verification.py。CPU 推理可能较慢;
暂时不使用科学组件时,可在页面选择不使用 SPECTER2 的排序方式并关闭科学核验。
arXiv 搜索或 PDF 下载失败
检查本机网络、代理和 arXiv 访问情况,稍后重试。当前仅支持可提取文字的 PDF, 扫描版论文无法通过本项目自动 OCR。
端口 8501 被占用
将启动命令中的 --server.port 8501 改为 --server.port 8502,
然后访问 http://localhost:8502。
组件如何配合
SPECTER2 帮助排序候选论文,BM25 查找正文证据,配置的聊天模型负责生成回答。 结构化绑定记录结论与证据的对应关系;MiniCheck 和规则检查在此基础上提供诊断。 这些组件各司其职,不是将主模型替换为另一个“科学大模型”。
主模型可使用满足上文接口要求的服务。论文缓存与模型权重按需在本地生成或下载, 不随仓库分发;安装与使用无需开发用 Notebook 或内部评测数据。
Available Tools
4 toolsliterature_get_paper_detailsGet arXiv Paper DetailsARead-onlyIdempotent
Return detailed metadata for one arXiv paper.
Use this for title, authors, abstract, categories, dates, and URLs. If the paper has not been seen in this session, the server resolves the ID through arXiv. It does not download the PDF.
| Name | Required | Description | Default |
|---|---|---|---|
| arxiv_id | Yes | arXiv ID such as '2508.19294v2'. |
Output Schema
| Name | Required | Description |
|---|---|---|
| paper | Yes | |
| prepared_in_memory | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already cover readOnly, idempotent, openWorld and non-destructive, so the safety profile is free. The description adds genuinely new behavior: the server performs a live arXiv resolution when the paper was not seen this session, and it does not download the PDF — a useful scope boundary and a latency/network hint.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short sentences, front-loaded with the core purpose, then field list, then behavioral caveats. No filler, though the field enumeration is somewhat redundant with the output schema.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With an output schema present, return values need not be described, and the description covers the notable non-obvious behavior (session-aware arXiv resolution, no PDF). The only gap is not situating itself against the three sibling tools.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% and the single parameter is documented with a concrete example ('2508.19294v2'), so the schema carries the semantics. The description adds nothing about ID format, versioning, or invalid-ID behavior, so the baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('Return detailed metadata for one arXiv paper') and enumerates the fields returned (title, authors, abstract, categories, dates, URLs). This distinguishes it implicitly from the search sibling by scope ('one paper'), though it never names an alternative explicitly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
'Use this for title, authors, abstract, categories, dates, and URLs' gives a context of use, but there is no when-not guidance and no routing to literature_search_papers or literature_retrieve_paper_evidence, which an agent choosing among four siblings would benefit from.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
literature_prepare_paperPrepare Paper for RetrievalAIdempotent
Download, extract, and chunk one paper for evidence retrieval.
The PDF is cached in the configured local papers directory and is not overwritten. Extracted pages and chunks stay only in server memory. Repeating the call is safe and reuses the cache.
| Name | Required | Description | Default |
|---|---|---|---|
| arxiv_id | Yes | arXiv ID returned by literature_search_papers. |
Output Schema
| Name | Required | Description |
|---|---|---|
| title | Yes | |
| arxiv_id | Yes | |
| pdf_path | Yes | |
| page_count | Yes | |
| chunk_count | Yes | |
| nonempty_page_count | Yes | |
| reused_memory_cache | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the annotations, the description discloses that the PDF is cached in a configured local directory and never overwritten, that extracted pages/chunks live only in server memory, and that repeat calls are safe and reuse the cache. This substantiates the idempotentHint=true and readOnlyHint=false (disk cache write) annotations with concrete mechanics.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three tight sentences with the action front-loaded and secondary behavioral facts (cache location, memory-only chunks, idempotency) following. No filler or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter, output-schema-backed preparation tool, the description covers the action, the caching side effect, the memory footprint, and repeat-call safety. An agent has everything needed to invoke it correctly and predict its side effects.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% and the single arxiv_id parameter is well documented in the schema ('arXiv ID returned by literature_search_papers'). The description adds no syntax, format, or validation detail beyond the schema, so baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific three-step verb chain (download, extract, chunk) on a specific resource (one paper) with a stated purpose (evidence retrieval). An agent can distinguish this preparation step from literature_search_papers and literature_retrieve_paper_evidence without opening any schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'for evidence retrieval' implies this is a prerequisite for literature_retrieve_paper_evidence, giving implied usage. However, no sibling is named explicitly, and there is no statement of when not to call it (e.g. already-prepared papers) or which tool must precede it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
literature_retrieve_paper_evidenceRetrieve Evidence from a PaperAIdempotent
Retrieve page-cited evidence chunks from one paper.
Use this before answering a question about paper content. The query must be concise English keywords because retrieval uses local BM25 rather than a model. If necessary, the paper is prepared automatically. Return the page numbers with any answer built from these results.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Concise English keywords. Translate non-English questions before calling. | |
| top_k | No | Return between 1 and 8 chunks. | |
| arxiv_id | Yes | arXiv ID identifying the paper to search. |
Output Schema
| Name | Required | Description |
|---|---|---|
| query | Yes | |
| title | Yes | |
| arxiv_id | Yes | |
| evidence | Yes | |
| auto_prepared | Yes | |
| evidence_count | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Adds real mechanics beyond the annotations: retrieval is local BM25 rather than a model, the paper may be prepared as a side effect, and callers should carry page numbers into the answer. The auto-preparation side effect is consistent with readOnlyHint=false (a read tool that can trigger a write), so there is no contradiction, though failure modes (paper not found, no hits) go unmentioned.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Four short sentences, front-loaded with the action and the pre-condition, then the query-format constraint, then the side effect and the citation obligation. Nothing is redundant or padded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With annotations present and an output schema covering the return shape, the description supplies the missing operational context: when to call it, how to phrase the query, and the auto-preparation behavior. It omits edge cases such as an unknown arxiv_id or an empty result set, which keeps it just short of complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3, but the description earns credit by explaining *why* the query must be short English keywords (BM25, not a model), which is the rationale the schema omits. The top_k parameter is not addressed in prose beyond the schema's own range documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource: retrieving page-cited evidence chunks, scoped to 'one paper', which implicitly separates it from the corpus-wide literature_search_papers sibling. It never names that sibling, so the differentiation is inferable rather than explicit.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
"Use this before answering a question about paper content" gives a clear trigger condition, and "the paper is prepared automatically" tells the agent it need not call literature_prepare_paper first. No explicit when-not or named alternative is given, so it stops short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
literature_search_papersSearch arXiv PapersARead-onlyIdempotent
Search arXiv and return concise paper metadata.
Use this first when the user wants literature recommendations or has not supplied an arXiv ID. It does not download PDFs. The returned arXiv IDs can be passed to the other literature tools.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | English arXiv search query. | |
| max_results | No | Return between 1 and 10 papers. |
Output Schema
| Name | Required | Description |
|---|---|---|
| count | Yes | |
| query | Yes | |
| papers | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint, idempotentHint, openWorldHint and destructiveHint=false, so safety is covered structurally. The description still earns credit for adding non-annotation context: no PDF download, concise metadata output, and that the returned arXiv IDs are reusable inputs for the sibling tools.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short sentences with no filler. The core capability is front-loaded and the routing/exclusion notes follow in priority order.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With an output schema present, return values need no explanation, and the description still sketches what comes back (IDs, metadata) and how to chain it. Nothing an agent needs to call this correctly is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with both query and max_results documented in the schema (including bounds and default), so the baseline is 3. The description adds no syntax, language, or formatting detail for the query parameter beyond what the schema already states.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ("Search arXiv") plus the return shape ("concise paper metadata"). It also positions itself against siblings by telling the agent to use it first when no arXiv ID is supplied, so an agent can distinguish it from literature_get_paper_details and friends without opening a schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicit routing rule: "Use this first when the user wants literature recommendations or has not supplied an arXiv ID," plus a clear negative ("It does not download PDFs") and a hand-off path (returned IDs pass to the other literature tools). The only gap is that the alternatives are referred to generically rather than named as literature_get_paper_details / literature_prepare_paper.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.2.0- First observed
literature_get_paper_details - First observed
literature_prepare_paper - First observed
literature_retrieve_paper_evidence - First observed
literature_search_papers
TDQS
Scored across 4 tools
Each tool targets a distinct stage: search, metadata details, preparation/download, and evidence retrieval. The only mild overlap is prepare_paper vs retrieve_paper_evidence, since retrieve auto-prepares when needed, but descriptions clarify the distinction well.
All four tools follow a strict literature_verb_noun pattern (search_papers, get_paper_details, prepare_paper, retrieve_paper_evidence), making the namespace and conventions fully predictable.
Four tools is slightly lean but well-matched to a focused paper search-and-retrieval server. Each tool earns its place with a distinct role in the pipeline.
The surface covers a coherent lifecycle: search, inspect metadata, prepare, and retrieve cited evidence. Minor gaps exist (no listing/clearing of the local cache), but core literature workflows are fully supported.
Maintenance
Related MCP Connectors
Search arXiv/Semantic Scholar/OpenAlex + medical evidence (PubMed/Europe PMC) + LaTeX/PDF tools.
Search arXiv, fetch paper metadata, and read full-text content.
Search GitHub, npm, PyPI, StackOverflow, ArXiv from one MCP — built for coding agents.
Search arXiv papers and read Scout reports with methods, evidence and verification points.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables searching, downloading, and managing academic papers from arXiv.org through natural language interactions. Provides tools for paper discovery, PDF downloads, and local paper collection management.41MIT
- AlicenseNot gradedqualityDmaintenanceEnables searching arXiv, fetching metadata, reading papers as section-aware Markdown, listing recent papers, and downloading PDFs via five MCP tools.17 npm2MIT
- FlicenseNot gradedqualityDmaintenanceA local, rule-based MCP server for searching and analyzing academic papers from arXiv. Enables paper search, ranking, smart summarization, keyword extraction, and citation generation without API keys or LLM calls.-
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to search, retrieve, and manage a personal arXiv paper library over MCP, with explainable relevance ranking, trend analysis, saved papers, and reading suggestions — all running locally without accounts or external services.MIT