返回 MCP 目录
public公开dns本地运行

onecite

OneCite是一个强大的学术引用工具,能自动将混乱的参考文献(如DOI、标题、arXiv ID等)转换为格式标准、数据完整的引用条目,支持BibTeX、APA、MLA等多种格式,并提供命令行、Python库和AI助手集成。

article

README

🚀 OneCite

OneCite 是一款通用的引用与学术参考工具包,它能轻松地将杂乱无章的参考文献转化为格式完美、标准化的引用内容,极大地提高了学术写作中引用管理的效率。

🚀 快速开始

安装

# 推荐:从 PyPI 安装
pip install onecite

# 或者,从源码安装以获取最新版本
git clone https://github.com/HzaCode/OneCite.git
cd OneCite
pip install -e .

基础用法

  1. 创建输入文件 (references.txt),包含多种引用类型:
10.1038/nature14539

Attention is all you need, Vaswani et al., NIPS 2017

Goodfellow, I., Bengio, Y., & Courville, A. (2016). Deep Learning. MIT Press.

https://github.com/tensorflow/tensorflow

10.5281/zenodo.3233118

arXiv:2103.00020

Smith, J. (2020). Neural Architecture Search. PhD Thesis. Stanford University.
  1. 运行命令
onecite process references.txt -o results.bib --quiet
  1. 获得格式完美的输出 (results.bib),包含 7 种不同类型:
📄 查看完整输出 (results.bib) ```bibtex @article{LeCun2015Deep, doi = "10.1038/nature14539", title = "Deep learning", author = "LeCun, Yann and Bengio, Yoshua and Hinton, Geoffrey", journal = "Nature", year = 2015, volume = 521, number = 7553, pages = "436-444", publisher = "Springer Science and Business Media LLC", url = "https://doi.org/10.1038/nature14539", type = "journal-article", }

@inproceedings{Vaswani2017Attention, arxiv = "1706.03762", title = "Attention Is All You Need", author = "Vaswani, Ashish and Shazeer, Noam and Parmar, Niki and Uszkoreit, Jakob and Jones, Llion and Gomez, Aidan N. and Kaiser, Lukasz and Polosukhin, Illia", year = 2017, journal = "arXiv preprint", url = "https://arxiv.org/abs/1706.03762", }

@book{Goodfellow2016Deep, title = "Deep Learning", author = "Ian Goodfellow and Yoshua Bengio and Aaron Courville", publisher = "MIT Press", year = 2016, isbn = "9780262337373", url = "https://play.google.com/store/books/details?id=omivDQAAQBAJ&source=gbs_api", pages = "801", }

@software{tensorflow2015tensorflow, title = "tensorflow", author = "tensorflow", publisher = "GitHub", year = 2015, version = "2.20.0", url = "https://github.com/tensorflow/tensorflow", }

@misc{Brett2019nipynibabel, title = "nipy/nibabel: 2.4.1", author = "Brett, Matthew and Markiewicz, Christopher J. and Hanke, Michael and Côté, Marc-Alexandre and Cipollini, Ben and McCarthy, Paul and Cheng, Christopher P. and Halchenko, Yaroslav O. and Cottaar, Michiel and Ghosh, Satrajit and Larson, Eric and Wassermann, Demian and Gerhard, Stephan and Lee, Gregory R. and Kastman, Erik and Rokem, Ariel and Madison, Cindee and Morency, Félix C. and Moloney, Brendan and Burns, Christopher and Millman, Jarrod and Gramfort, Alexandre and Leppäkangas, Jaakko and Markello, Ross and van den Bosch, Jasper J.F. and Vincent, Robert D. and Subramaniam, Krish and Raamana, Pradeep Reddy and Nichols, B. Nolan and Baker, Eric M. and Goncalves, Mathias and Hayashi, Soichi and Pinsard, Basile and Haselgrove, Christian and Hymers, Mark and Koudoro, Serge and Oosterhof, Nikolaas N. and Amirbekian, Bago and Nimmo-Smith, Ian and Nguyen, Ly and Reddigari, Samir and St-Jean, Samuel and Garyfallidis, Eleftherios and Varoquaux, Gael and Kaczmarzyk, Jakub and Legarreta, Jon Haitz and Hahn, Kevin S. and Hinds, Oliver P. and Fauber, Bennet and Poline, Jean-Baptiste and Stutters, Jon and Jordan, Kesshi and Cieslak, Matthew and Moreno, Miguel Estevan and Haenel, Valentin and Schwartz, Yannick and Thirion, Bertrand and Papadopoulos Orfanos, Dimitri and Pérez-García, Fernando and Solovey, Igor and Gonzalez, Ivan and Lecher, Justin and Leinweber, Katrin and Raktivan, Konstantinos and Fischer, Peter and Gervais, Philippe and Gadde, Syam and Ballinger, Thomas and Roos, Thomas and Reddam, Venkateswara Reddy and freec84", year = 2019, howpublished = "Zenodo", url = "https://zenodo.org/record/3233118", version = "2.4.1", doi = "10.5281/zenodo.3233118", }

@article{Radford2021Learning, arxiv = "2103.00020", title = "Learning Transferable Visual Models From Natural Language Supervision", author = "Radford, Alec and Kim, Jong Wook and Hallacy, Chris and Ramesh, Aditya and Goh, Gabriel and Agarwal, Sandhini and Sastry, Girish and Askell, Amanda and Mishkin, Pamela and Clark, Jack and Krueger, Gretchen and Sutskever, Ilya", year = 2021, journal = "arXiv preprint", url = "https://arxiv.org/abs/2103.00020", }

@phdthesis{Smith2020Neural, title = "Neural Architecture Search", author = "Smith, J.", school = "Stanford University", year = 2020, type = "phdthesis", }

</details>

## ✨ 主要特性
- 🔍 **智能识别**:可对多个学术数据库进行模糊匹配,从不完整或不准确的信息中查找参考文献。
- 📚 **通用格式支持**:输入 `.txt`/`.bib` 文件,可输出 **BibTeX**、**APA** 或 **MLA** 格式的引用。
- 🎯 **高精度处理流程**:采用 4 阶段处理(清理 → 查询 → 验证 → 格式化),确保输出质量。
- 🤖 **自动补全**:可自动填充缺失的数据(期刊、卷号、页码、ISBN、作者等)。
- 🎓 **7 种以上引用类型**:支持期刊文章、会议论文、书籍、软件、数据集、学位论文、预印本等。
- 🧠 **智能路由**:自动检测内容类型和领域(医学/计算机科学/通用),以实现最佳数据检索。
- 📄 **通用标识符支持**:支持 DOI、PMID、arXiv ID、ISBN、GitHub URL、Zenodo DOI 或纯文本。
- 🎛️ **交互式模式**:当找到多个匹配项时,可手动选择。
- ⚙️ **可定制模板**:基于 YAML 的模板系统,可完全控制输出格式。

## 🌐 数据源
<div align="center">

[![CrossRef](https://img.shields.io/badge/CrossRef-B31B1B?style=for-the-badge&logo=crossref&logoColor=white)](https://www.crossref.org/)
[![Semantic](https://img.shields.io/badge/Semantic-1857B6?style=for-the-badge&logo=semanticscholar&logoColor=white)](https://www.semanticscholar.org/)
[![OpenAlex](https://img.shields.io/badge/OpenAlex-FF6B35?style=for-the-badge)](https://openalex.org/)
[![PubMed](https://img.shields.io/badge/PubMed-326599?style=for-the-badge&logo=pubmed&logoColor=white)](https://pubmed.ncbi.nlm.nih.gov/)
[![dblp](https://img.shields.io/badge/dblp-002B5B?style=for-the-badge)](https://dblp.org/)
[![arXiv](https://img.shields.io/badge/arXiv-B31B1B?style=for-the-badge&logo=arxiv&logoColor=white)](https://arxiv.org/)
[![DataCite](https://img.shields.io/badge/DataCite-00B4A0?style=for-the-badge)](https://datacite.org/)
[![Zenodo](https://img.shields.io/badge/Zenodo-0A0E4A?style=for-the-badge)](https://zenodo.org/)
[![Google](https://img.shields.io/badge/Google-4285F4?style=for-the-badge&logo=google&logoColor=white)](https://books.google.com/)

</div>

## 💻 使用示例
### 高级用法
<details>
<summary><strong>🎨 多种输出格式 (APA, MLA)</strong></summary>
```bash
# 生成 APA 格式的引用
onecite process refs.txt --output-format apa
# → LeCun, Y., Bengio, Y., & Hinton, G. (2015). Deep learning. Nature, 521(7553), 436-444.
# → Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., ... & Polosukhin, I. (2017). Attention is all you need. In Advances in Neural Information Processing Systems.

# 生成 MLA 格式的引用
onecite process refs.txt --output-format mla
# → LeCun, Yann, Yoshua Bengio, and Geoffrey Hinton. "Deep Learning." Nature 521.7553 (2015): 436-444.
# → Vaswani, Ashish, et al. "Attention Is All You Need." Advances in Neural Information Processing Systems. 2017.
🤖 交互式消歧 对于有歧义的条目,使用 `--interactive` 标志以确保准确性。 **命令**: ```bash onecite process ambiguous.txt --interactive ``` **交互示例**: ``` Found multiple possible matches for "Deep learning Hinton": 1. Deep learning Authors: LeCun, Yann; Bengio, Yoshua; Hinton, Geoffrey Journal: Nature Year: 2015 Match Score: 92.5 DOI: 10.1038/nature14539
  1. Deep belief networks Authors: Hinton, Geoffrey E. Journal: Scholarpedia Year: 2009 Match Score: 78.3 DOI: 10.4249/scholarpedia.5947

Please select (1-2, 0=skip): 1 ✅ Selected: Deep learning

</details>
<details>
<summary><strong>🐍 作为 Python 库使用</strong></summary>
可将 OneCite 的处理能力直接集成到 Python 脚本中。
```python
from onecite import process_references

# 定义一个回调函数用于非交互式选择(例如,始终选择最佳匹配)
def auto_select_callback(candidates):
    return 0

result = process_references(
    input_content="Deep learning review\nLeCun, Bengio, Hinton\nNature 2015",
    input_type="txt",
    output_format="bibtex",
    interactive_callback=auto_select_callback
)

print(result['output_content'])
📑 支持的输入示例 ```text # DOI 10.1038/nature14539

会议论文

Attention is all you need, Vaswani et al., NIPS 2017

arXiv

1706.03762 https://arxiv.org/abs/1706.03762

书籍

Goodfellow, I., Bengio, Y., & Courville, A. (2016). Deep Learning. MIT Press. Russell, S., & Norvig, P. (2021). Artificial Intelligence. ISBN: 978-0-13-604259-4.

软件

https://github.com/tensorflow/tensorflow

数据集

10.5281/zenodo.3233118

学位论文

Smith, J. (2020). Deep Learning for Computer Vision. PhD Thesis. MIT.

PubMed

PMID: 27225100

</details>

## 📚 详细文档
### AI 助手集成 (MCP)
OneCite 提供完整的模型上下文协议 (MCP) 支持,使 AI 助手能够直接使用 OneCite 的功能进行文献搜索、处理和格式化。
<details>
<summary><strong>🚀 设置与配置</strong></summary>
#### 安装与测试
```bash
# 安装 OneCite
pip install onecite

# 测试 MCP 服务器
onecite-mcp

配置 AI 助手

在支持 MCP 的编辑器的 settings.json 中添加以下内容:

{
  "mcpServers": {
    "onecite": {
      "command": "onecite-mcp",
      "args": [],
      "env": {}
    }
  }
}

重启编辑器以启用 OneCite 集成。

可用功能

  • cite - 生成单个引用(DOI、标题、arXiv ID → APA/MLA/BibTeX)
  • batch_cite - 一次性处理多个参考文献
  • search - 通过关键词搜索学术文献

使用示例

配置完成后,可向 AI 助手发出以下指令:

  • "为 DOI: 10.1038/nature14539 生成 APA 格式的引用"
  • "以 BibTeX 格式批量处理这些参考文献"
  • "搜索关于机器学习的论文"

配置

📋 命令行选项 | 选项 | 描述 | 默认值 | | ---------------- | ------------------------------------ | -------------------- | | `--input-type` | 输入格式 (`txt`, `bib`) | `txt` | | `--output-format`| 输出格式 (`bibtex`, `apa`, `mla`) | `bibtex` | | `--template` | 指定要使用的自定义 YAML 模板 | `journal_article_full` | | `--interactive` | 启用交互式模式以进行消歧 | `False` | | `--quiet` | 抑制详细日志输出 | `False` | | `--output`, `-o` | 输出文件的路径 | `stdout` |
🎨 自定义模板 可使用简单的 YAML 模板定义自定义输出格式。 **示例 `my_template.yaml`**: ```yaml name: my_template entry_type: "@article" fields: - name: author required: true - name: title required: true - name: journal required: true - name: year required: true - name: doi required: false source_priority: [crossref_api] ``` **使用方法**: ```bash onecite process refs.txt --template my_template.yaml ```

🤝 贡献

欢迎贡献代码!请参阅 CONTRIBUTING.md 了解开发指南和提交拉取请求的说明。

📄 许可证

本项目采用 MIT 许可证。详情请参阅 LICENSE 文件。


OneCite - 简单、准确、强大的引用管理工具 ✨

⭐ 在 GitHub 上 star🚀 试用 Web 应用📖 阅读文档🐛 报告问题💬 发起讨论

help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端