BibTeX MCP Server for manipulating BibTeX entries
Project description
BibTeX MCP Server
🚀 一个高效的 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-mcp-server
# 从本地项目运行
uvx --from . bibtex-mcp-server
# 指定 Python 版本
uvx --python 3.10+ bibtex-mcp-server
依赖配置
项目已配置 pyproject.toml,uvx会自动处理依赖安装。
🎯 Cursor 中的配置
方式一:从 PyPI 安装(推荐)
发布到 PyPI 后,在 Cursor 的 MCP 服务器设置中添加以下 JSON 配置:
{
"mcpServers": {
"bibtex-mcp": {
"command": "uvx",
"args": ["bibtex-mcp-server"]
}
}
}
方式二:从本地项目运行
如果你想从本地项目运行(开发或测试),使用以下配置:
{
"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"]
)
典型工作流程
-
浏览文献库:
# 查看所有可用的key read_bibtex_file("my_library.bib")
-
查看具体条目:
# 查看感兴趣的条目详情 get_bibtex_entry("my_library.bib", "interesting_paper_2024")
-
创建子集:
# 筛选相关论文到新文件 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.0fastmcp>=0.1.0pydantic>=2.0.0
使用uvx的优势
- 无需手动管理虚拟环境
- 自动处理依赖安装
- 一次性运行,无残留
- 支持不同Python版本
📦 安装和获取
从 PyPI 安装(推荐)
# 直接运行,无需预安装
uvx bibtex-mcp-server
# 或者安装到系统
pip install 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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bibtex_file_mcp-1.0.0.tar.gz.
File metadata
- Download URL: bibtex_file_mcp-1.0.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfbfa438f47c7282dd0d584d93c925ddce0bf4238c5d50ea86e9b1ab6c128f97
|
|
| MD5 |
729400c81e310cb13fc7122979709a83
|
|
| BLAKE2b-256 |
197fcdeeabb4ffe07e9fb11b1f8d0ddd27f381ae846003f6c6a1108937d66586
|
Provenance
The following attestation bundles were made for bibtex_file_mcp-1.0.0.tar.gz:
Publisher:
publish.yml on Qing25/bibtex-file-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bibtex_file_mcp-1.0.0.tar.gz -
Subject digest:
cfbfa438f47c7282dd0d584d93c925ddce0bf4238c5d50ea86e9b1ab6c128f97 - Sigstore transparency entry: 492890763
- Sigstore integration time:
-
Permalink:
Qing25/bibtex-file-mcp@83af088260b986469924a8883671e5398c2d0f17 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Qing25
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@83af088260b986469924a8883671e5398c2d0f17 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bibtex_file_mcp-1.0.0-py3-none-any.whl.
File metadata
- Download URL: bibtex_file_mcp-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd0089d0ecd734b56f4a53dee31649e06be5fbcfd0b299e4bd9a5ddc3fcbaf56
|
|
| MD5 |
d979c1519d911d3a267b46d4b85bfb4b
|
|
| BLAKE2b-256 |
16c8401aaed2d721852680148ada8eaff186e6fbc08ea8a144f9a2378a03f8e8
|
Provenance
The following attestation bundles were made for bibtex_file_mcp-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on Qing25/bibtex-file-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bibtex_file_mcp-1.0.0-py3-none-any.whl -
Subject digest:
dd0089d0ecd734b56f4a53dee31649e06be5fbcfd0b299e4bd9a5ddc3fcbaf56 - Sigstore transparency entry: 492890792
- Sigstore integration time:
-
Permalink:
Qing25/bibtex-file-mcp@83af088260b986469924a8883671e5398c2d0f17 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Qing25
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@83af088260b986469924a8883671e5398c2d0f17 -
Trigger Event:
push
-
Statement type: