
Colabfit Mcp
io.github.colabfit由 GitHub 帳號 colabfit 發布v1.0.0更新於 Oct 24, 2026
An MCP server that provides access to the ColabFit database
概覽
一個 MCP 伺服器,讓助理搜尋並下載 ColabFit 材料資料集、在本機訓練 MACE 風格原子間勢,並用 OpenKIM 測試驅動驗證模型。
- 可以做什麼
- 依文字、元素、性質或軟體搜尋 ColabFit 資料庫,並掃描本機資料目錄中已下載的資料集,可依元素與性質篩選。透過 KLIFF 從 HuggingFace 下載資料集並在本機構建資料集。在本機 GPU 或 CPU 上從零訓練 MACE 風格的 KLAY 模型。用訓練好的模型執行能量、力與弛豫計算,或產生對應的 Python 程式碼片段。列出並執行 OpenKIM kimvv 測試驅動來驗證模型,查詢非同步工作結果,並檢查 GPU、套件、磁碟及本機模型狀態。
- 適用情境
- 適合材料科學與原子尺度建模情境:希望助理在對話中尋找合適的 ColabFit 訓練資料、在本機啟動勢函數訓練,並用標準性質測試驗證所得模型。
- 執行需求
- 以本機 stdio 程序執行。訓練與推論需要 Docker 和 Docker Compose v2;僅用 pip 安裝 Python 套件(Python 3.10+)時只支援搜尋、下載、建構與狀態類工具。GPU 訓練可選配 NVIDIA GPU、驅動程式和 nvidia-container-toolkit。需要存取 ColabFit 和 HuggingFace 的網路。可選環境變數包括 COLABFIT_DATA_ROOT、USER_ID、GROUP_ID、KLIFF_BATCH_SIZE、KLIFF_NUM_WORKERS、TRAIN_SIZE、VAL_SIZE、KLIFF_DTYPE、COLABFIT_BASE_URL 等。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Colabfit Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
colabfit-mcp
An MCP server for discovering ColabFit datasets and training MACE interatomic potentials using KLIFF and KLAY.
Overview
This is a Model Context Protocol (MCP) server that gives AI assistants the ability to:
- Search and download scientific datasets from ColabFit
- Train MACE interatomic potentials on your local hardware (GPU or CPU)
- Run energy/forces calculations and validate models with OpenKIM test drivers
It bridges conversational AI and local compute — the AI agent searches for data, trains models, and runs simulations on your machine through this server.
Prerequisites
- Docker and Docker Compose v2 — for the containerized server
- Git — for cloning the repository
- make — for the quick-start commands (optional; manual steps are documented below)
- (Optional) NVIDIA GPU + drivers — for GPU-accelerated training
- (Optional) nvidia-container-toolkit — required for Docker to access the GPU
For local (non-Docker) installation, only Python 3.10+ is required. See Local Installation.
Setup
Quick Start (Recommended)
Then register the MCP server with your client (see Register the MCP server below) and restart your client. The container starts automatically when your AI client connects.
Run make help to see all available commands.
Manual Setup
If you prefer not to use the Makefile:
1. Configure environment
2. Create data directories
3. Build with user ID mapping
Register the MCP server
start.sh automatically detects NVIDIA GPU availability and enables GPU passthrough when present, falling back to CPU otherwise.
Claude Code:
Replace /path/to/colabfit-mcp with the absolute path to this repository.
Then restart Claude Code for the new server to take effect.
Claude Desktop:
Add to your Claude Desktop config (Settings > Developer > Edit Config):
OpenAI Agent (API-based, not ChatGPT app):
OpenAI agents that support MCP can connect to this server over stdio by launching the same command used above.
Use this command as the MCP server entrypoint:
If your agent framework requires explicit command/args fields, use:
Notes:
- This is for OpenAI API-based agent runtimes that support MCP server registration.
- The ChatGPT consumer app (including non-Pro accounts) does not provide local
stdioMCP server registration in the same way as developer agent runtimes. - Replace
/path/to/colabfit-mcpwith the absolute path to this repository.
Generic MCP Client Setup
The server uses standard MCP stdio transport and works with any MCP-compatible client.
Entry point (after pip install or in the Docker container):
Testing with mcp-cli:
Any stdio MCP client (Gemini, OpenAI agents, Cursor, etc.) can register the server using the same command / args pattern as Claude Desktop above. The protocol is standardized — all tools use MCP stdio transport, no HTTP server or open port is required.
Python SDK client example:
Install the client library with pip install mcp. The server uses JSON-RPC 2.0 over stdio — raw subprocess.Popen with hand-crafted JSON will not work; use a proper MCP client library.
Note: Docker is required for training and inference (heavy dependencies). The
search_datasets,check_local_datasets,download_dataset,build_dataset, andcheck_statustools work without Docker via a plain pip install.
Tools
Available Test Drivers (kimvv)
Typical Workflow
search_datasets— find datasets with the elements/properties you needdownload_dataset— download from HuggingFace (cached locally for reuse)train_mace— train a MACE-style KLAY model on the downloaded datause_model— run energy/forces/relax calculations or generate a Python snippetrun_test_driver— validate the model against OpenKIM-style property tests
Sample Prompts
The following prompts work directly in Claude Code or Claude Desktop once the MCP server is registered.
Explore available data:
Search ColabFit for silicon datasets that include forces. Which ones look best for training an interatomic potential?
What datasets do I have downloaded locally? Do any contain iron with stress data?
End-to-end training:
Find a dataset for copper, download it, and train a MACE model on it. Use default settings.
I need a potential for lithium phosphate. Search ColabFit for Li and P datasets, pick the most suitable one, and start training.
Run inference:
Use my model at /home/mcpuser/colabfit/models/cu_mace/cu_mace__MO_000000000000_000 to calculate the energy and forces on bulk copper in FCC structure.
Relax an FCC aluminum structure with my trained model and report the final energy and cell parameters.
Generate a Python snippet to run the energy calculation on bulk silicon using my KLAY model.
Validate with test drivers:
What test drivers are available for validating my model?
Run the ElasticConstantsCrystal test driver on my silicon model at /home/mcpuser/colabfit/models/si_mace/si_mace__MO_000000000000_000.
Run the EquilibriumCrystalStructure and VacancyFormationEnergyRelaxationVolumeCrystal tests on my copper FCC model.
Check status:
Check my GPU status and list all the models and datasets I have locally.
End-to-end workflow:
Search ColabFit for silicon datasets with forces, download the best one, train a MACE model, calculate energy and forces on bulk diamond-cubic silicon, then run the ElasticConstantsCrystal and EquilibriumCrystalStructure test drivers to validate the model. Report the elastic constants and equilibrium lattice parameter when done.
Stopping / Canceling Training
The MCP server runs via docker compose run (not docker compose up), so
docker compose down alone will not stop an active training container.
Use the methods below to stop the server including any in-progress training job.
Using Makefile
Without Makefile
If the project directory is not named colabfit-mcp, replace the filter value with your
directory name (lowercased). You can check the label on a running container with:
Training progress is saved as
training.loginside the model's KIM subdirectory (<model_name>__MO_000000000000_000/training.log). Stopping mid-training discards any in-progress epoch; completed epochs and their checkpoints are preserved on disk.
Monitoring Training Progress
View training output in the following ways:
1. Real-time Container Logs (Recommended)
View live training output as it happens:
Press Ctrl+C to exit (training continues in background).
2. Persistent Log Files
Training writes log files inside the model's KIM subdirectory:
GPU Support
start.sh automatically detects your GPU:
- NVIDIA GPU present: starts with
compose.nvidia.yamloverlay, enabling CUDA passthrough via nvidia-container-toolkit - No NVIDIA GPU: starts without the overlay; the container selects the best available device (MPS or CPU) automatically at runtime
The pip-installed version handles GPU detection purely in Python via detect_device() — no shell wrapper needed, since PyTorch can see the host GPU directly.
Local Installation (without Docker)
Install
This enables search_datasets, check_local_datasets, download_dataset, build_dataset,
and check_status. Training and inference require Docker — the full dependency stack
(CUDA, kim-api, PyG wheels) is only supported via the Docker build.
Register with Claude Code
Register with Claude Desktop
Add to your Claude Desktop config (Settings > Developer > Edit Config):
Data directory
By default, datasets and models are stored under ~/colabfit/. Override with:
Subdirectories are created automatically the first time each tool writes data.
Requirements
- Python 3.10+
- CUDA 12.x + nvidia drivers (for GPU training; CPU fallback works without CUDA)
Architecture
Datasets are downloaded from HuggingFace (colabfit/ org) as parquet/arrow files via KLIFF's
Dataset.from_huggingface and cached locally. Models are MACE-style graphs
built with KLAY and trained with KLIFF's Lightning trainer.
Container managed by Docker Compose:
- server — MCP server + ML training
Environment Variables
Data Storage:
By default, models and datasets are stored in ./colabfit_data/ (relative to the
project root), making data portable with the project. COLABFIT_DATA_ROOT controls
only the host-side bind-mount source — the container-internal data root is always
/home/mcpuser/colabfit regardless of this setting. To use a fixed host location that
persists across project clones, set COLABFIT_DATA_ROOT in .env:
User ID Mapping:
The USER_ID and GROUP_ID variables ensure the container user matches your host
user, preventing permission issues with bind-mounted directories. The Makefile
automatically detects your IDs, but you can override them in .env if needed.
Requirements
See Prerequisites for the full list. In short: Docker + Compose v2 for the containerized server, or Python 3.10+ for local installation.
HPC / cluster users: Docker is typically unavailable on HPC systems. Apptainer (formerly Singularity) can pull and convert Docker images (
apptainer pull docker://...), but the Docker Compose lifecycle andstart.shMCP registration do not translate directly to an HPC environment. Native Apptainer/Podman support is a planned future goal.
Troubleshooting
torch_scatter fails to install with "torch not found": When installing into an existing
Python environment (e.g. a KDP container or a system Python), pip's build isolation prevents
the build from seeing an already-installed torch. Use --no-build-isolation:
Then reinstall the package to pick up the newly available extension:
GPU not detected in container: Ensure nvidia-container-toolkit is
installed and the Docker daemon has been restarted. Verify with
docker run --rm --gpus all nvidia/cuda:12.8.0-base-ubuntu22.04 nvidia-smi.
If no NVIDIA GPU is present, use ./start.sh which falls back to CPU automatically.
MCP server not responding: The server uses stdio transport, not HTTP. It
must be launched via docker compose run --rm -i server, not accessed
over a network port.
Manual Usage: Running Inference with a Trained KLAY Model
After training, the model directory (model_path returned by train_mace) contains
model.pt and kliff_graph.param. Use these directly with PyTorch and KLIFF.
Loading and Running the Model
Geometry Optimization with ASE
The use_model tool's _KliffInlineCalculator wraps the KLAY model as an ASE
calculator. For custom scripts, replicate the same pattern:
來源:README.md,提交 06ecad2
工具
0版本歷史
1- v1.0.0最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。