Skip to main content

BibTeX MCP Server

PyPI version Python 3.10+ License: MIT MCP Compatible

🚀 一个高效的 BibTeX 文件操作 MCP 服务器

基于 Model Context Protocol (MCP) 构建,让 AI 助手(如 Cursor)能够智能地读取、查询和管理 BibTeX 文献数据库。

✨ 特色亮点

  • 📚 BibTeX 支持 - 完整的 .bib 文件解析和处理
  • 🤖 AI 友好 - 专为 LLM 设计的简洁 API
  • ⚡ 即开即用 - 使用 uvx 一键启动,无需复杂配置
  • 🔧 Cursor 集成 - 完美集成到 Cursor 编辑器的 MCP 系统
  • 🎯 轻量高效 - 专注核心功能,性能卓越

功能特性

🎯 核心功能

  • 读取文件 - 默认返回所有key,可选显示前5条详细信息
  • 查询条目 - 根据key获取单条entry的详细信息
  • 写入文件 - 根据key列表筛选并写入新文件

使用uvx运行

安装和运行

# 从 PyPI 直接运行(推荐)
uvx bibtex-file-mcp

# 或者使用服务器名称
uvx --from bibtex-file-mcp bibtex-mcp-server

# 从本地项目运行
uvx --from . bibtex-mcp-server

# 指定 Python 版本
uvx --python 3.10+ --from bibtex-file-mcp bibtex-file-mcp

依赖配置

项目已配置 pyproject.toml,uvx会自动处理依赖安装。

🎯 Cursor 中的配置

方式一:从 PyPI 安装(推荐)

发布到 PyPI 后,在 Cursor 的 MCP 服务器设置中添加以下 JSON 配置:

{
  "mcpServers": {
    "bibtex-mcp": {
      "command": "uvx",
      "args": ["bibtex-file-mcp"]
    }
  }
}

方式二:从本地项目运行

如果你想从本地项目运行(开发或测试),使用以下配置:

{
  "mcpServers": {
    "bibtex-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "/path/to/your/bibtex_mcp",
        "bibtex-mcp-server"
      ],
      "env": {
        "PYTHONPATH": "/path/to/your/bibtex_mcp"
      }
    }
  }
}

🚀 配置完成后的使用

配置完成后,你可以在 Cursor 中直接使用 BibTeX 工具:

请帮我读取 references.bib 文件并显示所有条目的 key
从 library.bib 中找到 key 为 "smith2024" 的条目详细信息
从 all_papers.bib 中选择这些条目:["paper1", "paper2", "paper3"] 并保存到 selected.bib

可用工具

1. read_bibtex_file(filepath, show_details=False)

读取BibTeX文件

# 获取所有key(默认)
read_bibtex_file("references.bib")

# 显示前5条详细信息
read_bibtex_file("references.bib", show_details=True)

2. get_bibtex_entry(filepath, key)

根据key获取单条条目详细信息

get_bibtex_entry("references.bib", "smith2024")

3. write_bibtex_entries(source_filepath, target_filepath, keys)

根据key列表写入选定条目到新文件

write_bibtex_entries(
    source_filepath="all_refs.bib",
    target_filepath="selected_refs.bib", 
    keys=["smith2024", "doe2023", "jones2022"]
)

典型工作流程

  1. 浏览文献库:

    # 查看所有可用的key
    read_bibtex_file("my_library.bib")
    
  2. 查看具体条目:

    # 查看感兴趣的条目详情
    get_bibtex_entry("my_library.bib", "interesting_paper_2024")
    
  3. 创建子集:

    # 筛选相关论文到新文件
    write_bibtex_entries(
        "my_library.bib", 
        "project_refs.bib",
        ["paper1_2024", "paper2_2023", "paper3_2024"]
    )
    

项目结构

bibtex_mcp/
├── bibtex_file_mcp.py    # 主程序
├── pyproject.toml        # uvx配置文件
├── requirements.txt      # 依赖列表
└── README.md            # 使用说明

特点

  • 轻量高效 - 只保留核心功能,没有冗余
  • 假设正确 - 假设所有BibTeX格式都是正确的
  • 简单解析 - 使用简单正则表达式解析
  • uvx友好 - 支持uvx一键运行和配置

系统要求

  • Python 3.10+
  • 依赖包:
    • mcp>=0.1.0
    • fastmcp>=0.1.0
    • pydantic>=2.0.0

使用uvx的优势

  • 无需手动管理虚拟环境
  • 自动处理依赖安装
  • 一次性运行,无残留
  • 支持不同Python版本

📦 安装和获取

从 PyPI 安装(推荐)

# 直接运行,无需预安装
uvx bibtex-file-mcp

# 或者安装到系统
pip install bibtex-file-mcp
bibtex-file-mcp

从源码安装

# 克隆仓库
git clone https://github.com/Qing25/bibtex-file-mcp.git
cd bibtex-file-mcp

# 从本地运行
uvx --from . bibtex-mcp-server

# 或者本地安装
pip install -e .

🔧 开发和贡献

# 克隆项目
git clone https://github.com/Qing25/bibtex-file-mcp.git
cd bibtex-file-mcp

# 设置开发环境
uv venv
source .venv/bin/activate  # Linux/Mac
# 或 .venv\Scripts\activate  # Windows

# 安装依赖
uv pip install -e .

# 运行测试
python test_tools.py

📄 许可证

MIT License - 详见 LICENSE 文件

🤝 贡献

欢迎提交 Issue 和 Pull Request!

Metadata

Release files for bibtex-file-mcp 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bibtex-file-mcp 1.1.0
File Size Uploaded Provenance
bibtex_file_mcp-1.1.0.tar.gz 7.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bibtex-file-mcp 1.1.0
File Interpreter ABI Platform
bibtex_file_mcp-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / bibtex_file_mcp-1.1.0.tar.gz

Download URL bibtex_file_mcp-1.1.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
799f2ebe8d95f7ef7f71b0e87f325d993f04bc85e5cd1ada8ba6abce974b780f
BLAKE2b-256 checksum
How to use checksums
79bd67cf642feefc5f3a8688b6a2bf583226f202834debe0b7fa9d0fe1391c9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2025.

Transparency log

Release files / bibtex_file_mcp-1.1.0-py3-none-any.whl

Download URL bibtex_file_mcp-1.1.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
421d4317de125181d5e26cca83b8eac438b47125bca3b338a5df84a0b08f58d7
BLAKE2b-256 checksum
How to use checksums
7c24deefd16d3bb7da61469c40ad4c3d95dad26090c884edfa62243411d8b627
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2025.

Transparency log

Security for bibtex-file-mcp 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bibtex_file_mcp-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page