返回 博客
发布日期:Feb 18, 2026
阅读时间:2 min read

LAMMPS MCP Server:AI 助手的分子动力学文档检索工具

介绍 LAMMPS MCP Server 的功能、对外接口和接入方法,让 Claude 等 AI 助手直接查阅 LAMMPS 官方手册

LAMMPS MCP Server

LAMMPS MCP Server 是一个基于 Model Context Protocol 的 LAMMPS 文档检索服务。它将 LAMMPS 官方手册解析并建立索引,通过 MCP 协议对外提供搜索能力,使 Claude 等 AI 助手在对话中可以直接查阅 LAMMPS 命令语法和用法。

服务支持关键词 + 语义向量混合搜索,中英文查询均可使用。

服务端点

  • MCP 端点: https://chaxiejun.xyz/_mcp(Streamable HTTP 传输)
  • 健康检查: https://chaxiejun.xyz/_mcp/health
  • 认证方式: Authorization: Bearer <API_KEY>

健康检查返回示例:

{
  "status": "ok",
  "sections": 342,
  "files": 20,
  "embeddingsReady": true
}

提供的 MCP 工具

search_lammps

搜索 LAMMPS 文档,支持关键词和自然语言查询。

参数类型说明
querystring搜索词,如 "pair_style lj/cut""怎么控制温度"
max_resultsnumber返回数量,默认 10

get_section

根据标题获取完整章节内容,支持模糊匹配。

参数类型说明
titlestring章节标题,如 "fix npt command"

list_commands

列出 LAMMPS 命令,可按类别过滤。

参数类型说明
categorystring可选,类别名:fixpair_stylecomputecommanddumpbond_style

接入 Claude Desktop

在 Claude Desktop 的 MCP 配置中添加:

{
  "mcpServers": {
    "lammps-docs": {
      "url": "https://chaxiejun.xyz/_mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

配置完成后,与 Claude 对话时即可自动调用 LAMMPS 文档检索。例如问 “LAMMPS 中 fix npt 怎么用”,Claude 会自动搜索并返回官方文档中的语法和参数说明。

本地 Stdio 模式

也可以直接通过标准输入输出接入:

npx tsx src/index.ts --stdio

部署

使用 systemd 管理:

systemctl --user enable lammps-mcp
systemctl --user start lammps-mcp
systemctl --user status lammps-mcp