文献引用验证服务

一个基于Model Context Protocol (MCP)的服务器,为Claude和其他兼容MCP的AI助手提供文献引用验证功能,包括DOI验证、引用元数据提取和格式化输出。

  • by DWFlanagan
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 dwflanagan/citation-verifier-mcp

使用说明

引文验证器MCP服务器

A. 模型上下文协议(MCP) 该服务器为Claude和其他MCP兼容的AI助手提供引文验证功能。

此服务器包装 llm引文验证器 图书馆将引文验证作为MCP工具公开。

特性

  • ✅ 验证DOI引用 针对Crossref数据库
  • ✅ 检测幻觉引用 通过检查DOI是否确实存在
  • ✅ 提取书目元数据 (标题、作者、期刊、年份)
  • ✅ 干净、格式化的输出 具有明确的验证状态
  • ✅ 不需要API密钥 -使用公共交叉引用API
  • 🆕 远程访问支持 -为远程MCP客户端部署为web服务
  • 🆕 WebSocket和HTTP端点 -与基于web的MCP客户端兼容

安装

先决条件

  • Python 3.10+
  • Claude Desktop(用于本地测试)

本地安装

# Clone the repository
git clone https://github.com/dwflanagan/citation-verifier-mcp.git
cd citation-verifier-mcp

# Initialize uv project and install dependencies
uv sync

# Activate the virtual environment
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

用法

本地MCP服务器(克劳德桌面)

这是在本地使用Claude Desktop服务器的传统方式。

使用克劳德桌面

  1. 添加到您的Claude Desktop配置(claude_desktop_config.json):
{
  "mcpServers": {
    "citation-verifier": {
      "command": "python",
      "args": ["-m", "citation_verifier_mcp.server"]
    }
  }
}
  1. 重新启动克劳德桌面
  2. 引文验证工具将在您的对话中提供:
You: Can you verify this DOI for me: 10.1038/nature12373

Claude: I'll verify that DOI using the citation verification tool.

[Tool call: verify_citation with DOI "10.1038/nature12373"]

# ✅ Citation Verified

**DOI:** 10.1038/nature12373
**Title:** A quantum gas of deeply bound ground state molecules
**Authors:** T. Takekoshi, L. Reichsöllner, et al.
**Journal:** Nature
**Publisher:** Springer Science and Business Media LLC
**Year:** 2014
**URL:** https://doi.org/10.1038/nature12373

This DOI exists in the Crossref database and appears to be a legitimate citation.

远程MCP服务器(Web服务)

🆕 新 现在,您可以将引文验证器作为远程web服务运行,类似于 Cloudflare MCP示例.

快速开始

# Start the remote server
./launch_remote_server.sh

# Or manually:
uv run python start_server.py

服务器将在以下时间可用 http://localhost:8000 使用这些端点:

  • 网络套接字: ws://localhost:8000/mcp (适用于MCP客户)
  • 健康检查: http://localhost:8000/health
  • API信息: http://localhost:8000/

将Claude Desktop连接到远程服务器

  1. 安装mcp远程代理:

    npm install -g mcp-remote
    
  2. 更新您的Claude Desktop配置:

    {
      "mcpServers": {
        "citation-verifier-remote": {
          "command": "npx",
          "args": ["mcp-remote", "ws://localhost:8000/mcp"]
        }
      }
    }
    
  3. 重新启动克劳德桌面

部署到生产

看 REMOTE_SETUP.md 有关详细的部署说明,包括:

  • 云部署(Render.com)
  • 轻松部署到云平台
  • 生产配置
  • 安全注意事项

发展

# Install with development dependencies (already done with uv sync)
uv sync

# Run tests
uv run pytest

# Lint code
uv run ruff check .

# Type check
uv run mypy src/

# Run the server for testing
uv run python -m citation_verifier_mcp.server

工具参考

verify_citation

根据Crossref数据库验证DOI引用。

参数:

  • doi (string,必填):要验证的DOI。可以包含URL前缀,如 https://doi.org/ 其将被自动剥离。

退货:

  • 如果已验证,则使用书目元数据格式化验证结果
  • 未经验证的错误消息和建议

要尝试的DOI示例:

  • 10.1038/nature12373 (真纸)
  • 10.1234/fake.doi.2024 (假DOI)

运作原理

此MCP服务器:

  1. 接收MCP客户(如Claude)的DOI验证请求
  2. 使用 llm-citation-verifier 用于查询Crossref API的库
  3. 返回格式化结果,指示DOI是否存在并包含元数据

基础验证过程:

  • 清除DOI输入(删除URL前缀、空格)
  • 查询交叉引用REST API
  • 提取和格式化书目元数据
  • 提供清晰的验证状态

用例

  • 助研:验证人工智能生成内容中的引用
  • 学术写作:发布前检查DOI
  • 事实核查:验证可疑引用
  • 质量控制:用于引文幻觉的审计AI工具

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 添加测试
  5. 提交拉取请求

许可证

MIT许可证-有关详细信息,请参阅许可证文件。

相关项目