FastAPI Python backend providing materials science computation, structure manipulation, and AI agent integration (MCP).
The backend implements a unified Tool-First architecture. Every capability (readers, calculators, optimizers, analysis) is registered as a TOOL.
- Registry:
server/tools/registry.pymanages all available tools. - Discovery:
server/tools/discovery.pyautomatically loads tools fromserver/tools/builtin/,plugins/, and~/.catgo/tools/. - Execution: Tools can be executed via REST API or through AI agents using the Model Context Protocol (MCP).
- Main MCP Server (
server/mcp_tools/server.py): Provides 50+ granular tools for the built-in AI chat interface. - Claude Code MCP (
server/mcp_tools/server_claude_code.py): A lightweight version with 5 "merged" tools (catgo_structure, catgo_fetch, etc.) optimized for the Claude Code CLI.
The backend is modularized into several routers (see server/routers/):
- Structure Ops: Atomic manipulation (add, delete, move, replace).
- Optimization: MACE, CHGNet, M3GNet, and EMT calculators.
- Symmetry: Integration with
moyo(spglib) for space group analysis. - Simulation: Input generation for VASP, QE, LAMMPS, CP2K, ORCA.
- Analysis: DOS, Bands, COHP, RDF, RMSD, Clustering, etc.
- External Data: Fetching from Materials Project, OPTIMADE, and PubChem.
- HPC: SSH management and job submission to clusters.
conda create -n catgo python=3.11
conda activate catgo
pip install -r server/requirements.txt# Standard start
python server/main.py
# Or via pnpm from project root
pnpm desktop:serveThe server runs at http://localhost:8000 (or 8001+ if in a worktree).
- Create a directory in
plugins/orserver/tools/builtin/. - Add a
tool.pydefining aTOOLdictionary and anasync def execute(context)function. - The server will automatically discover and register it on startup.
Once running, visit http://localhost:8000/docs for the interactive Swagger UI.
See server/CLAUDE.md for a detailed log of architectural decisions, bug fixes, and platform-specific (Windows/Linux) "lessons learned".