MOF结构校验工具

一个用于检查金属有机框架(MOF)结构问题的工具,特别为AI代理集成而优化。

  • by lichman0405
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 lichman0405/mofchecker-mcp

使用说明

mofchecker--MCP版

精益、MCP支持的优秀产品重新包装 mofchecker 图书馆by 凯文·贾布隆卡 和那个 拉马拉组织 团队。

站在巨人的肩膀上

原版 mofchecker 坦率地说,它是设计得最周到的之一 计算MOF科学中的工具。在“健全性检查”通常意味着 “它崩溃了吗?”Kevin和合作者构建了一个严格的、可组合的框架 它捕捉到了从重叠原子到可疑的过度充电的一切 碎片-所有这些都在一个干净的、Python的API中,这实际上是有意义的。这 仅图哈希重复数据删除就值得付出代价。如果你正在做 任何严重的高通量MOF筛查,原始文库都是必不可少的 阅读;没有坚实的基础,这个叉子就不会存在。

原始存储库: https://github.com/lamalab-org/mofchecker
原始纸张: Jablonka等人。, 数字发现, 2023.


这个叉子是什么?

本版将原版精简为重点MCP(模型上下文协议) 服务器,以便人工智能代理,特别是那些使用 羽状流 --可以调用结构 将检查作为stdio上的工具。

相对于上游的变化:

更改 原因
已删除 PorosityCheck / is_porous 孔隙度分析由单独的 zeopp-backend MCP服务
已添加 mcp_server.py 使用8个MCP工具 将每个支票类别作为单独的可调用工具公开
迁移到 pyproject.toml (PEP 621) 现代包装,单一配置文件
python_requires >= 3.9,下降 backports.cached-property 3.8为EOL;使用 functools.cached_property 来自stdlib
已更换 black + isort + flake8 随着 ruff 单一、更快的linter/格式化器

孔隙度检查是有意进行的 不 包括在这里。请将您的代理指向 zeopp-backend (http://localhost:9877/mcp)对于那些。


安装

重要--虚拟环境隔离 每个MCP服务器都必须在自己的虚拟环境中运行。这 command 在 您的FeatherFlow配置必须指向 这个项目的 .venv/bin/python, 不是FeatherFlow的Python或系统Python。

0.安装uv(一次性,推荐)

# Linux / macOS
curl -LsSf https://astral.sh/uv/install.sh | sh

uv 自动管理Python版本,无需手动安装Python 3.9+。

1.克隆并创建专用环境

git clone https://github.com/lichman0405/mofchecker-mcp.git
cd mofchecker-mcp
uv venv .venv --python 3.10        # pyeqeq requires Python <3.11
source .venv/bin/activate          # Linux/macOS
# .venv\Scripts\Activate.ps1      # Windows PowerShell

2.安装

uv pip install -e .

pyeqeq (EQeq费用检查)要求Python<3.11且pybind11>=2.9(旧版本 失踪了 <cstdint> 包括GCC 10+上的中断)。 这两个约束都是通过以下方式自动处理的 pyproject.toml --不需要手动步骤。

3.验证

python -m mofchecker.mcp_server --help

MCP服务器

此fork的主要用例是运行 mofchecker 作为MCP工具服务器 对于AI代理。

启动服务器

# Activate the project's own venv first
source /path/to/mofchecker/.venv/bin/activate

python -m mofchecker.mcp_server   # stdio transport (for featherflow / Claude Desktop)

可用工具

工具 说明
list_available_descriptors 返回描述符键的完整列表
get_basic_info 公式、细胞体积、密度、空间群、维度
check_global_structure 浮动原子/溶剂,图形连接
check_atomic_overlaps 重叠原子对
check_coordination C、N、H和稀土/碱金属配位过高/过低
check_geometry 几何外露金属(开放式金属场所)
check_charges EQeq部分电荷健全性(过充原子)
check_mof_full 运行所有检查并返回完整的描述符字典

每个工具都接受 cif_path (服务器文件系统上的绝对路径) 或 cif_content (原始CIF文本)——以对呼叫者更方便的为准。

羽状流集成

编辑 ~/.featherflow/config.jsonThe command 一定是 绝对路径 到 这个项目的 .venv/bin/python --不是 mofchecker-mcp 上 $PATH 而不是 FeatherFlow自己的Python。

{
  "tools": {
    "mcpServers": {
      "mofchecker": {
        "command": "/path/to/mofchecker/.venv/bin/python",
        "args": ["-m", "mofchecker.mcp_server"],
        "toolTimeout": 120
      },
      "zeopp": {
        "url": "http://localhost:9877/mcp",
        "toolTimeout": 120
      }
    }
  },
  "channels": {
    "sendToolHints": true,
    "sendProgress": true
  }
}

在Windows上,将路径替换为 C:/path/to/mofchecker/.venv/Scripts/python.exe.

看 mcp_config_example.json 对于一个即用型代码段。


Python API

该库仍然可以作为常规Python包完全使用:

from mofchecker import MOFChecker

checker = MOFChecker.from_cif("path/to/structure.cif")

# Individual checks
print(checker.has_atomic_overlaps)     # bool
print(checker.has_oms)                 # bool
print(checker.has_overcoordinated_c)   # bool

# All descriptors at once
descriptors = checker.get_mof_descriptors()

发展

uv pip install -e ".[dev]"
pytest                            # run tests
ruff check mofchecker/ tests/            # lint
ruff format mofchecker/ tests/           # format

许可证

麻省理工学院——与最初的项目相同。