├── .github └── workflows │ └── generate-showcase.yml ├── .gitignore ├── .gitmodules ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── config └── categories.json ├── data ├── CONTRIBUTORS.md ├── contributors.json ├── image.png └── tools.json ├── mcp-agent ├── .env.template ├── GITHUB_AGENT_README.md ├── README.md ├── README_REPO_CONVERSION.md ├── __init__.py ├── agent.py ├── github_agent.py ├── github_prompt.py ├── github_tools.py ├── prompt.py ├── pyproject.toml ├── repo_tools.py ├── requirements.txt └── tools.py ├── scripts ├── generate_mcp_configs.py ├── generate_simple_showcase.py ├── generate_tools_json.py └── update_contributors.py ├── servers ├── ABACUS-tools │ ├── LICENSE │ ├── README.md │ ├── __init__.py │ ├── datasets │ │ ├── NiO.json │ │ ├── README_dataset.md │ │ ├── create_data.py │ │ └── dataset.json │ ├── examples │ │ ├── generate_bulk_structure.txt │ │ └── my_agent │ │ │ ├── __init__.py │ │ │ └── agent.py │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ ├── src │ │ └── abacusagent │ │ │ ├── __init__.py │ │ │ ├── env.py │ │ │ ├── init_mcp.py │ │ │ ├── main.py │ │ │ └── modules │ │ │ ├── __init__.py │ │ │ ├── abacus.py │ │ │ ├── bader.py │ │ │ ├── band.py │ │ │ ├── deeptb_tool.py │ │ │ ├── dos.py │ │ │ ├── elastic.py │ │ │ ├── relax.py │ │ │ └── util │ │ │ ├── __init__.py │ │ │ ├── comm.py │ │ │ ├── control.py │ │ │ ├── cube_manipulator.py │ │ │ └── pyatb.py │ ├── tests │ │ ├── abacus │ │ │ ├── INPUT_LiFePO4_old │ │ │ ├── INPUT_ref │ │ │ ├── POSCAR │ │ │ ├── STRU │ │ │ ├── STRU_LiFePO4 │ │ │ ├── STRU_NiO_fixatom │ │ │ ├── STRU_NiO_ref │ │ │ ├── Si-sp │ │ │ │ ├── INPUT │ │ │ │ ├── KPT │ │ │ │ ├── OUT.Si │ │ │ │ │ └── running_scf.log │ │ │ │ ├── STDOUTER │ │ │ │ ├── STRU │ │ │ │ ├── log │ │ │ │ └── metrics-ref.json │ │ │ ├── orb │ │ │ │ ├── As_gga_8au_100Ry_2s2p1d.orb │ │ │ │ └── Ga_gga_9au_100Ry_2s2p2d.orb │ │ │ └── pp │ │ │ │ ├── As_ONCV_PBE-1.0.upf │ │ │ │ └── Ga_ONCV_PBE-1.0.upf │ │ ├── plot_dos │ │ │ ├── INPUT │ │ │ ├── OUT.diamond │ │ │ │ ├── DOS1_smearing.dat │ │ │ │ ├── Orbital │ │ │ │ ├── PDOS │ │ │ │ ├── running_nscf.log │ │ │ │ └── running_scf.log │ │ │ └── STRU │ │ ├── test_abacus.py │ │ └── test_dos.py │ └── uv.lock ├── ASKCOS │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── CompositionDART │ ├── calc_density.py │ ├── constant │ │ ├── atomic_mass.json │ │ ├── densities.json │ │ ├── mk_metal_densities.py │ │ └── ptable.json │ ├── constraints_utils.py │ ├── ga.py │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ ├── struct_template │ │ ├── bcc-Cr_mp-90_conventional_standard.cif │ │ ├── bcc-Fe_mp-13_conventional_standard.cif │ │ ├── bcc-V_mp-146_conventional_standard.cif │ │ ├── fcc-Cu_mp-30_conventional_standard.cif │ │ ├── fcc-Ni_mp-23_conventional_standard.cif │ │ └── hcp-Co_mp-54_conventional_standard.cif │ ├── target.py │ └── uv.lock ├── DPACalculator │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── DPCombo │ ├── dpa1_train.json │ ├── dpa2_train.json │ ├── dpa3_train.json │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── HEA_paper_extract │ ├── README.md │ ├── dependencies │ │ └── HEA_extractor.py │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── HEA_predict │ ├── README.md │ ├── data │ │ └── binary_Hmix.csv │ ├── mcp-config.json │ ├── metadata.json │ ├── models │ │ ├── Structure_predict_model.pkl │ │ ├── Type_predict_model.pkl │ │ ├── feats_scaler_struc.pkl │ │ └── feats_scaler_type.pkl │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── ORCA_tools │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── Optimade_Server │ ├── environment.yml │ ├── mcp-config.json │ ├── metadata.json │ ├── requirements.txt │ ├── server.py │ └── utils.py ├── Paper_Search │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── papers │ │ └── agent │ │ │ └── papers_info.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── RDKit │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── Symbolic_regression │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ ├── src │ │ └── symbolic_regression.py │ └── uv.lock ├── _example │ ├── README.md │ ├── metadata.json │ ├── pyproject.toml │ └── server.py ├── bio-agents-mcp │ ├── .env.docker │ ├── .flake8 │ ├── .gitignore │ ├── .pre-commit-config.yaml │ ├── Makefile │ ├── README.md │ ├── chembl_mcp │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── src │ │ │ ├── __init__.py │ │ │ └── chembl_mcp │ │ │ │ ├── __init__.py │ │ │ │ ├── constants.py │ │ │ │ ├── main.py │ │ │ │ ├── molecules.py │ │ │ │ └── server.py │ │ └── uv.lock │ ├── docker-compose.yml │ ├── llm_client │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── chainlit.md │ │ ├── chainlit.yaml │ │ ├── chainlit_ui.py │ │ ├── client.py │ │ ├── conf │ │ │ └── config.yaml │ │ ├── pyproject.toml │ │ └── uv.lock │ ├── mcp-config.json │ ├── metadata.json │ ├── protein_data_bank_mcp │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── src │ │ │ ├── __init__.py │ │ │ └── protein_data_bank_mcp │ │ │ │ ├── __init__.py │ │ │ │ ├── main.py │ │ │ │ ├── pdb_store │ │ │ │ ├── __init__.py │ │ │ │ └── storage.py │ │ │ │ ├── rest_api │ │ │ │ ├── __init__.py │ │ │ │ ├── assembly.py │ │ │ │ ├── chemical_component.py │ │ │ │ ├── constants.py │ │ │ │ ├── entity.py │ │ │ │ ├── entity_instance.py │ │ │ │ ├── entry.py │ │ │ │ ├── groups.py │ │ │ │ ├── interface.py │ │ │ │ ├── repository_holdings.py │ │ │ │ ├── schema.py │ │ │ │ └── utils.py │ │ │ │ └── server.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ └── protein_data_bank_mcp │ │ │ │ ├── __init__.py │ │ │ │ └── pdb_store │ │ │ │ ├── __init__.py │ │ │ │ └── test_pdb_storage.py │ │ └── uv.lock │ └── server.py ├── catalysis │ ├── mcp-config.json │ ├── metadata.json │ └── server.py ├── data_analysis │ ├── .python-version │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── deepmd_docs_rag │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── dna_sequence_analyzer │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── matbench_property_prediction │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ └── server.py ├── nmrglue │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── perovskite_literature_plot │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── pubchem │ ├── INSTALL.md │ ├── README.md │ ├── mcp-config-example.json │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── python_version │ │ ├── README.md │ │ ├── mcp_server.py │ │ ├── pubchem_mcp_server │ │ │ ├── __init__.py │ │ │ ├── server.py │ │ │ └── xyz_utils.py │ │ └── setup.py │ ├── run_server.sh │ ├── server.py │ └── uv.lock ├── pymol-mcp │ ├── .gitattributes │ ├── LICENSE │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pymol-mcp-socket-plugin │ │ ├── __init__.py │ │ └── pymol_mcp_plugin.ui │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── structure_generate │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock ├── superconductor │ ├── README.md │ ├── metadata.json │ ├── pyproject.toml │ ├── superconductor_mcp_server.py │ └── uv.lock ├── thermoelectric │ ├── README.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── server.py │ └── uv.lock └── zotero-mcp │ ├── .gitignore │ ├── Dockerfile │ ├── LICENSE │ ├── MANIFEST.in │ ├── README.md │ ├── docs │ └── getting-started.md │ ├── mcp-config.json │ ├── metadata.json │ ├── pyproject.toml │ ├── requirements.txt │ ├── server.py │ ├── setup.py │ ├── smithery.yaml │ ├── src │ └── zotero_mcp │ │ ├── __init__.py │ │ ├── _version.py │ │ ├── better_bibtex_client.py │ │ ├── chroma_client.py │ │ ├── cli.py │ │ ├── client.py │ │ ├── local_db.py │ │ ├── pdfannots_downloader.py │ │ ├── pdfannots_helper.py │ │ ├── semantic_search.py │ │ ├── server.py │ │ ├── setup_helper.py │ │ ├── updater.py │ │ └── utils.py │ └── uv.lock └── showcase └── index.html /.github/workflows/generate-showcase.yml: -------------------------------------------------------------------------------- 1 | name: Generate and Deploy Showcase 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | - dev/showcase-improvements 9 | - 'dev/**' # 支持所有dev开头的分支 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | workflow_dispatch: 15 | 16 | permissions: 17 | contents: write # 改为write以允许提交 18 | pages: write 19 | id-token: write 20 | 21 | jobs: 22 | generate-and-deploy: 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: Checkout repository 26 | uses: actions/checkout@v4 27 | 28 | - name: Set up Python 29 | uses: actions/setup-python@v5 30 | with: 31 | python-version: '3.11' 32 | 33 | - name: Create data directory 34 | run: | 35 | mkdir -p data 36 | 37 | - name: Generate TOOLS.json 38 | run: | 39 | python scripts/generate_tools_json.py 40 | 41 | - name: Generate MCP configs 42 | run: | 43 | python scripts/generate_mcp_configs.py 44 | 45 | - name: Update contributors 46 | run: | 47 | python scripts/update_contributors.py 48 | 49 | - name: Generate showcase page 50 | run: | 51 | python scripts/generate_simple_showcase.py 52 | 53 | - name: Commit generated files 54 | if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/dev/')) 55 | run: | 56 | git config --local user.email "action@github.com" 57 | git config --local user.name "GitHub Action" 58 | git add data/tools.json data/contributors.json data/CONTRIBUTORS.md showcase/index.html servers/*/mcp-config.json || true 59 | git commit -m "chore: update generated files [skip ci]" || echo "No changes to commit" 60 | git push || echo "No changes to push" 61 | 62 | - name: Setup Pages 63 | if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' 64 | uses: actions/configure-pages@v4 65 | with: 66 | enablement: true 67 | 68 | - name: Upload artifact 69 | if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' 70 | uses: actions/upload-pages-artifact@v3 71 | with: 72 | path: './showcase' 73 | 74 | - name: Deploy to GitHub Pages 75 | if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' 76 | id: deployment 77 | uses: actions/deploy-pages@v4 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Python 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | *.so 6 | .Python 7 | build/ 8 | develop-eggs/ 9 | dist/ 10 | downloads/ 11 | eggs/ 12 | .eggs/ 13 | lib/ 14 | lib64/ 15 | parts/ 16 | sdist/ 17 | var/ 18 | wheels/ 19 | *.egg-info/ 20 | .installed.cfg 21 | *.egg 22 | MANIFEST 23 | 24 | # Virtual environments 25 | venv/ 26 | ENV/ 27 | env/ 28 | .venv 29 | 30 | # IDE 31 | .vscode/ 32 | .idea/ 33 | *.swp 34 | *.swo 35 | *~ 36 | .project 37 | .pydevproject 38 | 39 | # OS 40 | .DS_Store 41 | .DS_Store? 42 | ._* 43 | .Spotlight-V100 44 | .Trashes 45 | ehthumbs.db 46 | Thumbs.db 47 | 48 | # Logs 49 | *.log 50 | logs/ 51 | 52 | # Local development 53 | .env 54 | .env.local 55 | .env.*.local 56 | 57 | # UV 58 | .venv/ 59 | 60 | # MCP server logs 61 | servers/*/.logs/ 62 | servers/*/logs/ 63 | 64 | # Test coverage 65 | htmlcov/ 66 | .tox/ 67 | .coverage 68 | .coverage.* 69 | .cache 70 | nosetests.xml 71 | coverage.xml 72 | *.cover 73 | .hypothesis/ 74 | .pytest_cache/ 75 | 76 | # Jupyter Notebook 77 | .ipynb_checkpoints 78 | 79 | # Documentation build 80 | docs/_build/ 81 | docs/_static/ 82 | docs/_templates/ 83 | 84 | # Temporary files 85 | *.tmp 86 | *.temp 87 | *.bak 88 | *.backup 89 | *~ 90 | 91 | # Local configuration 92 | local_config/ 93 | *.local.json 94 | *.local.yaml 95 | *.local.yml 96 | 97 | # Generated files (keep TOOLS.json and showcase/) 98 | # TOOLS.json and showcase/ are tracked in git 99 | 100 | # Claude configuration (local only) 101 | CLAUDE.md 102 | .venv/ 103 | .env -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/.gitmodules -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Yuzhi Zhang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # **AI4S-agent-tools** 2 | 3 | An open project by the DeepModeling community - Building intelligent tools for scientific research. 4 | 5 | 🌐 **[View Tool Showcase](https://deepmodeling.github.io/AI4S-agent-tools/)** | 6 | 🤝 **[Contribute](CONTRIBUTING.md)** | 7 | 8 | 9 | ## 🎯 Mission 10 | 11 | We're building a comprehensive "scientific capability library" - agent-ready tools that cover the full spectrum of AI for Science tasks: 12 | 13 | ### 🔬 Current Tools 14 | 15 | - **Materials Science** 16 | - [DPACalculator](servers/DPACalculator/) - Deep learning atomistic simulations with universal potentials 17 | - [Thermoelectric](servers/thermoelectric/) - Materials screening with CALYPSO 18 | - [ABACUS-tools](servers/ABACUS-tools/) - First-principles calculations with ABACUS 19 | 20 | - **Chemistry** 21 | - [PubChem](servers/pubchem/) - Compound data retrieval and structure download 22 | - [Catalysis](servers/catalysis/) - Reaction calculations with ADSEC workflow 23 | 24 | - **Research Tools** 25 | - [Paper Search](servers/Paper_Search/) - ArXiv literature search and parsing 26 | - [DeepMD Docs RAG](servers/deepmd_docs_rag/) - Documentation knowledge base 27 | 28 | ### 🚀 Coming Soon 29 | 30 | - 📊 Spectral analysis (XRD, NMR, Raman) 31 | - 🧬 Protein structure prediction 32 | - 🔭 3D molecular visualization 33 | - 📈 Experimental design optimization 34 | - 🧫 Multi-objective Bayesian optimization 35 | 36 | ## 💻 Quick Start 37 | 38 | ### Use a Tool 39 | 40 | ```bash 41 | # Install dependencies 42 | cd servers/ 43 | uv sync 44 | 45 | # Run the server 46 | python server.py --port 50001 47 | ``` 48 | 49 | ### Add Your Tool 50 | 51 | ```bash 52 | # Copy template 53 | cp -r servers/_example servers/my_tool 54 | 55 | # Edit and test 56 | cd servers/my_tool 57 | # ... edit server.py ... 58 | uv sync 59 | python server.py --port 50002 60 | ``` 61 | 62 | ### 🆕 AI-Powered Tool Generator (Beta) 63 | 64 | Generate MCP tools automatically through conversational AI: 65 | 66 | ```bash 67 | # Configure environment variable (create .env file) 68 | 69 | # Run the interactive tool generator 70 | adk web 71 | 72 | # Follow the conversational prompts to create your tool 73 | ``` 74 | 75 | The MCP Agent will guide you through creating a fully-configured MCP server that follows all project standards. This beta feature uses AI to: 76 | - Collect your tool requirements through friendly dialogue 77 | - Generate complete server code with proper error handling 78 | - Create all necessary configuration files (metadata.json, pyproject.toml) 79 | - Ensure compliance with project standards 80 | 81 | See [mcp-agent/README.md](mcp-agent/README.md) for more details. 82 | 83 | See [CONTRIBUTING.md](CONTRIBUTING.md) for the complete guide. 84 | 85 | ## 🏗️ Architecture 86 | 87 | Each tool is an independent MCP (Model Context Protocol) server that can be: 88 | - Run standalone for development 89 | - Integrated with AI agents (Claude, GPT, etc.) 90 | - Composed into complex workflows 91 | 92 | ## 🤝 Join Us 93 | 94 | We welcome contributions from: 95 | - 🧑‍🔬 Domain scientists with computational needs 96 | - 💻 Developers interested in scientific computing 97 | - 🤖 AI researchers building science agents 98 | - 📚 Anyone passionate about open science 99 | 100 | ### 💬 Community 101 | 102 | Join our WeChat community group to discuss ideas and collaborate: 103 | 104 |
105 | WeChat Community Group 106 |
107 | 108 | ## 📄 License 109 | 110 | This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. 111 | 112 | ## 🙏 Acknowledgments 113 | 114 | Built with ❤️ by the [DeepModeling](https://github.com/deepmodeling) community. 115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /config/categories.json: -------------------------------------------------------------------------------- 1 | { 2 | "categories": { 3 | "biology": { 4 | "name": "Biology", 5 | "icon": "🧬", 6 | "description": "Biological systems and biomolecular analysis", 7 | "color": "#4CAF50" 8 | }, 9 | "chemistry": { 10 | "name": "Chemistry", 11 | "icon": "⚗️", 12 | "description": "Chemical compounds, reactions and catalysis", 13 | "color": "#2196F3" 14 | }, 15 | "materials": { 16 | "name": "Materials Science", 17 | "icon": "💎", 18 | "description": "Materials properties, discovery and engineering", 19 | "color": "#9C27B0" 20 | }, 21 | "physics": { 22 | "name": "Physics", 23 | "icon": "⚛️", 24 | "description": "Physical simulations and quantum mechanics", 25 | "color": "#FF5722" 26 | }, 27 | "research": { 28 | "name": "Research Tools", 29 | "icon": "📚", 30 | "description": "Literature search, documentation and knowledge management", 31 | "color": "#607D8B" 32 | }, 33 | "simulation": { 34 | "name": "Simulation", 35 | "icon": "🔬", 36 | "description": "Molecular dynamics and computational modeling", 37 | "color": "#FF9800" 38 | }, 39 | "data": { 40 | "name": "Data & Analysis", 41 | "icon": "📊", 42 | "description": "Data processing, visualization and analytics", 43 | "color": "#00BCD4" 44 | }, 45 | "machine-learning": { 46 | "name": "Machine Learning", 47 | "icon": "🤖", 48 | "description": "AI/ML models and intelligent systems", 49 | "color": "#E91E63" 50 | }, 51 | "general": { 52 | "name": "General Tools", 53 | "icon": "🛠️", 54 | "description": "General purpose scientific utilities", 55 | "color": "#795548" 56 | }, 57 | "battery": { 58 | "name": "Battery", 59 | "icon": "🔋", 60 | "description": "Battery modeling, analysis and energy storage systems", 61 | "color": "#FFC107" 62 | }, 63 | "climate": { 64 | "name": "Climate", 65 | "icon": "🌍", 66 | "description": "Climate modeling, weather prediction and atmospheric sciences", 67 | "color": "#00ACC1" 68 | }, 69 | "medicine": { 70 | "name": "Medicine", 71 | "icon": "⚕️", 72 | "description": "Medical research, drug discovery and healthcare applications", 73 | "color": "#D32F2F" 74 | } 75 | }, 76 | "default_category": "general" 77 | } -------------------------------------------------------------------------------- /data/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # Contributors 2 | 3 | Thank you to all our contributors! 🎉 4 | 5 | ## Tool Authors 6 | 7 | | Author | Collections | Tools | Main Areas | 8 | |--------|------------|-------|------------| 9 | | **[@54yyyu](https://github.com/54yyyu)** | 1 (Zotero) | 18 | research | 10 | | **[@jiaodu1307](https://github.com/jiaodu1307)** | 3 (ASKCOS, NMRglue Toolkit, RDKit Toolkit) | 17 | chemistry | 11 | | **[@dogeplusplus](https://github.com/dogeplusplus)** | 1 (bio-agents-mcp) | 17 | biology | 12 | | **[@SchrodingersCattt](https://github.com/SchrodingersCattt)** | 3 (CompositionDART, DPACalculatorServer, DPComboServer) | 15 | materials | 13 | | **[@ahxbcn](https://github.com/ahxbcn)** | 1 (ABACUS) | 13 | materials | 14 | | **[@A-LOST-WAPITI](https://github.com/A-LOST-WAPITI)** | 1 (StructureGenerateServer) | 11 | materials | 15 | | **[@liuyuxiang92](https://github.com/liuyuxiang92)** | 2 (SuperconductorServer, ThermoelectricMaterialsServer) | 9 | materials | 16 | | **[@Rasic2](https://github.com/Rasic2)** | 1 (CatalysisMCP) | 3 | chemistry | 17 | | **[@lhappy](https://github.com/lhappy)** | 1 (dna_sequence_analyzer) | 3 | biology | 18 | | **[@Junshang Zhang](https://github.com/Junshang Zhang)** | 2 (HEA_extractTool, HEA_predictTool) | 3 | machine-learning, research | 19 | | **[@NingWang-art](https://github.com/NingWang-art)** | 1 (OptimadeServer) | 3 | materials | 20 | | **[@lhhhappy](https://github.com/lhhhappy)** | 2 (PYSR-Symbolic-Regression, paper_search) | 3 | physics, research | 21 | | **Haoming Yan** | 1 (perovskite_literature_plot) | 3 | data | 22 | | **[@felix5572](https://github.com/felix5572)** | 1 (deepmd_docs_rag) | 2 | materials | 23 | | **marvcks** | 1 (orca_tools) | 2 | chemistry | 24 | | **[@PhelanShao](https://github.com/PhelanShao)** | 1 (pubchem) | 2 | chemistry | 25 | | **[@nlz25](https://github.com/nlz25)** | 1 (data_analysis) | 1 | data | 26 | | **2043899742@qq.com** | 1 (matbench_property_prediction) | 1 | materials | 27 | | **[@vrtejus](https://github.com/vrtejus)** | 1 (PyMOL) | 1 | chemistry | 28 | 29 | 30 | ## Stats 31 | 32 | - **Contributors**: 19 33 | - **Total Collections**: 26 34 | - **Total Tools**: 127 35 | 36 | ## How to Contribute 37 | 38 | Check out our [Contributing Guide](CONTRIBUTING.md) to get started! 39 | 40 | --- 41 | 42 | *Auto-generated from metadata.json files* 43 | -------------------------------------------------------------------------------- /data/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/data/image.png -------------------------------------------------------------------------------- /mcp-agent/.env.template: -------------------------------------------------------------------------------- 1 | MODEL=deepseek/deepseek-chat 2 | DEEPSEEK_API_KEY=xxx -------------------------------------------------------------------------------- /mcp-agent/GITHUB_AGENT_README.md: -------------------------------------------------------------------------------- 1 | # GitHub Project Agent 使用指南 2 | 3 | ## 概述 4 | 5 | GitHub Project Agent 是一个独立的智能助手,专门用于将 GitHub 上的 MCP 工具仓库转换为 AI4S-agent-tools 的标准格式。与原有的 MCP Agent(用于创建新工具)不同,这个 Agent 专注于仓库分析和转换。 6 | 7 | ## 主要功能 8 | 9 | ### 1. 深度仓库分析 10 | - 探索目录结构 11 | - 阅读和理解代码文件 12 | - 识别 MCP 组件 13 | - 分析项目依赖 14 | 15 | ### 2. 智能转换 16 | - 自动识别主服务器文件 17 | - 保持原有功能不变 18 | - 生成标准配置文件 19 | - 清理版本控制历史 20 | 21 | ### 3. 文件操作 22 | - 读取任意文件内容 23 | - 修改代码文件 24 | - 创建新文件 25 | - 搜索特定内容 26 | 27 | ## 使用方法 28 | 29 | ### 1. 基本使用 30 | 31 | ```python 32 | from mcp_agent.github_agent import create_github_agent 33 | 34 | # 创建 Agent 实例 35 | agent = create_github_agent() 36 | 37 | # 转换仓库 38 | response = agent.run("请帮我转换 pymol-mcp 这个仓库") 39 | ``` 40 | 41 | ### 2. 完整转换流程 42 | 43 | ```python 44 | # 假设已经克隆了仓库到 servers/pymol-mcp 45 | 46 | # 1. 先让 Agent 探索和理解仓库 47 | response = agent.run(""" 48 | 我刚克隆了 pymol-mcp 仓库到 servers/pymol-mcp。 49 | 请先探索这个仓库,理解它的功能和结构。 50 | """) 51 | 52 | # 2. Agent 会自动执行: 53 | # - explore_repository() - 获取概览 54 | # - read_file_content() - 读取 README 和主文件 55 | # - analyze_mcp_structure() - 分析 MCP 组件 56 | 57 | # 3. 基于分析结果进行转换 58 | response = agent.run("基于你的分析,请将这个仓库转换为标准格式") 59 | ``` 60 | 61 | ### 3. 自定义转换 62 | 63 | ```python 64 | # 可以指定特定参数 65 | response = agent.run(""" 66 | 请转换 some-tool 仓库,使用以下信息: 67 | - 作者: @myusername 68 | - 类别: chemistry 69 | - 保持原有的端口配置 70 | """) 71 | ``` 72 | 73 | ## 工具函数详解 74 | 75 | ### explore_repository(repo_path) 76 | 探索仓库整体结构,返回文件统计、目录列表等信息。 77 | 78 | ### read_file_content(repo_path, file_path, start_line, end_line) 79 | 读取指定文件的内容,支持读取部分行。 80 | 81 | ### analyze_mcp_structure(repo_path) 82 | 深度分析 MCP 相关结构,识别工具函数、依赖等。 83 | 84 | ### modify_file_content(repo_path, file_path, old_content, new_content) 85 | 修改文件内容,支持创建新文件。 86 | 87 | ### create_standard_files(repo_path, author, description, category, tools) 88 | 创建 metadata.json 等标准配置文件。 89 | 90 | ### convert_repository_format(repo_path) 91 | 执行主要的格式转换操作。 92 | 93 | ### search_in_repository(repo_path, search_term, file_type) 94 | 在仓库中搜索特定内容。 95 | 96 | ### list_directory_tree(repo_path, show_hidden) 97 | 以树形结构显示目录内容。 98 | 99 | ## 典型工作流程 100 | 101 | 1. **克隆仓库**(手动或使用其他工具) 102 | ```bash 103 | git clone https://github.com/user/tool servers/tool-name 104 | ``` 105 | 106 | 2. **使用 Agent 分析** 107 | Agent 会自动: 108 | - 探索目录结构 109 | - 读取 README 理解功能 110 | - 分析代码找出 MCP 工具 111 | - 检查现有配置 112 | 113 | 3. **执行转换** 114 | Agent 会: 115 | - 重命名主文件为 server.py 116 | - 添加标准参数解析 117 | - 创建 metadata.json 118 | - 清理 .git 目录 119 | 120 | 4. **验证结果** 121 | Agent 会再次分析确保转换成功 122 | 123 | ## 与 MCP Agent 的区别 124 | 125 | | 特性 | MCP Agent | GitHub Project Agent | 126 | |-----|-----------|---------------------| 127 | | 主要用途 | 创建新的 MCP 工具 | 转换现有 GitHub 仓库 | 128 | | 工作方式 | 通过对话收集需求 | 分析和修改现有代码 | 129 | | 文件操作 | 仅创建新文件 | 读取、修改、搜索文件 | 130 | | 代码理解 | 不需要 | 深度分析代码结构 | 131 | 132 | ## 最佳实践 133 | 134 | 1. **先分析再转换**:让 Agent 充分理解项目后再执行转换 135 | 2. **保留原始功能**:Agent 会保持核心功能不变 136 | 3. **手动验证**:转换后建议手动测试功能是否正常 137 | 4. **备份重要数据**:虽然 Agent 很谨慎,但建议先备份 138 | 139 | ## 错误处理 140 | 141 | 如果转换失败,Agent 会: 142 | 1. 清楚说明问题所在 143 | 2. 提供可能的解决方案 144 | 3. 保持已完成的部分不变 145 | 146 | ## 扩展功能 147 | 148 | 未来计划添加: 149 | - 自动测试转换后的工具 150 | - 批量转换多个仓库 151 | - 生成转换报告 152 | - 集成 GitHub API 直接克隆 -------------------------------------------------------------------------------- /mcp-agent/README.md: -------------------------------------------------------------------------------- 1 | # MCP工具生成器 (Beta) 2 | 3 | 通过对话式交互自动生成符合AI4S-agent-tools规范的MCP服务器。 4 | 5 | ## 🚀 快速开始 6 | 7 | ### 安装依赖 8 | 9 | ```bash 10 | # 在 mcp-agent 目录安装依赖 11 | cd mcp-agent 12 | pip install -r requirements.txt 13 | 14 | # 或者直接安装各个包 15 | pip install google-adk>=1.7.0 python-dotenv>=1.0.0 litellm>=1.74.3 16 | ``` 17 | 18 | ### 配置环境 19 | 20 | 创建 `.env` 文件配置 LLM 模型: 21 | 22 | ```bash 23 | # .env 24 | MODEL=gemini-2.0-flash # 或其他支持的模型 25 | ``` 26 | 27 | ### 使用方法 28 | 29 | 在 AI4S-agent-tools 根目录运行: 30 | 31 | ```bash 32 | # 启动交互式 Web 界面 33 | adk web 34 | 35 | # 通过对话创建新的 MCP 工具 36 | ``` 37 | 38 | ## 工作流程 39 | 40 | ### 1. 对话收集需求 41 | 智能Agent主动询问: 42 | - 工具名称(英文snake_case) 43 | - 功能描述 44 | - 输入参数 45 | - 输出格式 46 | - 依赖库 47 | - 参考资料(可选) 48 | 49 | ### 2. 生成计划并确认 50 | 整理需求为清晰的计划,请求用户确认 51 | 52 | ### 3. 自动生成MCP服务器 53 | 使用内置工具函数生成完整的服务器代码和配置文件 54 | 55 | ## 架构设计 56 | 57 | ``` 58 | MCP_Agent(单一智能代理) 59 | ├── create_server() # 生成server.py文件 60 | ├── create_metadata() # 生成metadata.json配置 61 | └── create_pyproject() # 生成pyproject.toml依赖 62 | ``` 63 | 64 | ## 文件结构 65 | 66 | ``` 67 | mcp-agent/ 68 | ├── agent.py # 主代理定义 69 | ├── tools.py # 工具函数实现 70 | ├── prompt.py # 交互提示词 71 | ├── __init__.py # 模块入口 72 | ├── pyproject.toml # 项目依赖配置 73 | ├── requirements.txt # Python依赖 74 | └── README.md # 本文件 75 | ``` 76 | 77 | ## 生成的MCP服务器 78 | 79 | 严格遵循CONTRIBUTING.md规范: 80 | 81 | ``` 82 | servers/your_tool/ 83 | ├── server.py # FastMCP服务器,包含parse_args 84 | ├── metadata.json # 元数据配置 85 | ├── pyproject.toml # uv依赖管理 86 | └── README.md # 使用文档 87 | ``` 88 | 89 | ## 配置 90 | 91 | 创建`.env`文件: 92 | 93 | ```bash 94 | MODEL=gemini-2.0-flash 95 | ``` 96 | 97 | ## License 98 | 99 | MIT -------------------------------------------------------------------------------- /mcp-agent/README_REPO_CONVERSION.md: -------------------------------------------------------------------------------- 1 | # 🔄 MCP Agent 仓库转换功能 2 | 3 | ## 概述 4 | 5 | MCP Agent 现在支持自动将 GitHub 上的 MCP 工具仓库转换为 AI4S-agent-tools 的标准格式。这个功能可以帮助你快速集成外部的 MCP 工具。 6 | 7 | ## 新增功能 8 | 9 | ### 1. **自动仓库转换** (`convert_repo_to_mcp`) 10 | 11 | 一键将 GitHub 仓库转换为标准 MCP 格式: 12 | 13 | ```python 14 | from mcp_agent.repo_tools import convert_repo_to_mcp 15 | 16 | # 基本用法 17 | result = convert_repo_to_mcp("https://github.com/user/pymol-mcp") 18 | 19 | # 自定义参数 20 | result = convert_repo_to_mcp( 21 | repo_url="https://github.com/user/some-mcp-tool", 22 | tool_name="my_custom_name", # 自定义工具名 23 | author="vrtejus", # 覆盖作者 24 | category="chemistry" # 指定类别 25 | ) 26 | 27 | print("\n".join(result["messages"])) 28 | ``` 29 | 30 | ### 2. **仓库分析** (`analyze_repository`) 31 | 32 | 分析已克隆仓库的结构: 33 | 34 | ```python 35 | from mcp_agent.repo_tools import analyze_repository 36 | 37 | analysis = analyze_repository("pymol-mcp") 38 | print(f"主文件: {analysis['main_file']}") 39 | print(f"工具函数: {analysis['tool_functions']}") 40 | print(f"依赖: {analysis['dependencies']}") 41 | ``` 42 | 43 | ### 3. **仓库克隆** (`clone_repository`) 44 | 45 | 单独克隆仓库: 46 | 47 | ```python 48 | from mcp_agent.repo_tools import clone_repository 49 | 50 | result = clone_repository( 51 | "https://github.com/user/tool", 52 | "target_dir" 53 | ) 54 | ``` 55 | 56 | ## 转换流程详解 57 | 58 | 1. **克隆仓库** 59 | - 下载 GitHub 仓库到 `servers/` 目录 60 | 61 | 2. **分析结构** 62 | - 查找包含 FastMCP 的主文件 63 | - 提取 @mcp.tool() 装饰的函数 64 | - 识别项目依赖 65 | 66 | 3. **格式转换** 67 | - 重命名主文件为 `server.py` 68 | - 添加标准参数解析(--port, --host, --log-level) 69 | - 保持原有功能不变 70 | 71 | 4. **生成元数据** 72 | - 自动从 URL 提取作者 73 | - 基于内容推断类别 74 | - 创建 `metadata.json` 75 | 76 | 5. **清理 Git** 77 | - 删除 `.git` 目录 78 | - 移除 submodule 配置 79 | 80 | ## 使用示例 81 | 82 | ### 示例 1: 转换 PyMOL MCP 83 | 84 | ```python 85 | # 转换 pymol-mcp 仓库 86 | result = convert_repo_to_mcp( 87 | repo_url="https://github.com/edocollins/pymol-mcp", 88 | category="chemistry" # 明确指定为化学类工具 89 | ) 90 | 91 | # 输出结果: 92 | # ✓ 仓库已克隆到: servers/pymol-mcp 93 | # ✓ 重命名 pymol_mcp_server.py → server.py 94 | # ✓ 添加了参数解析功能 95 | # ✓ 清理了 Git 历史 96 | # ✓ metadata.json 已创建 97 | # ✓ 已添加到 git 暂存区 98 | ``` 99 | 100 | ### 示例 2: 批量转换多个仓库 101 | 102 | ```python 103 | repos = [ 104 | ("https://github.com/user/chem-tool", "chemistry"), 105 | ("https://github.com/user/bio-analyzer", "biology"), 106 | ("https://github.com/user/data-processor", "data") 107 | ] 108 | 109 | for repo_url, category in repos: 110 | print(f"\n转换 {repo_url}...") 111 | result = convert_repo_to_mcp(repo_url, category=category) 112 | 113 | if result["status"] == "success": 114 | print("✅ 转换成功") 115 | else: 116 | print("❌ 转换失败") 117 | ``` 118 | 119 | ### 示例 3: 使用 Agent 对话式转换 120 | 121 | ```python 122 | from mcp_agent.agent import root_agent 123 | 124 | # 通过对话让 Agent 帮你转换 125 | response = root_agent.run( 126 | "我想转换 https://github.com/user/tool 这个仓库到 MCP 格式" 127 | ) 128 | ``` 129 | 130 | ## 自动类别识别 131 | 132 | 工具会根据以下关键词自动推断类别: 133 | 134 | - **chemistry**: molecule, mol, chem, reaction, pymol, rdkit 135 | - **biology**: protein, dna, sequence, gene, bio 136 | - **physics**: quantum, physics, energy, particle 137 | - **materials**: material, crystal, structure, lattice 138 | - **simulation**: simulate, dynamics, md 139 | - **data**: data, analysis, visualiz 140 | - **machine-learning**: ml, ai, model, train, neural 141 | - **research**: paper, arxiv, literature 142 | 143 | ## 注意事项 144 | 145 | 1. **保持原有功能**:转换过程不会修改核心业务逻辑 146 | 2. **手动检查**:转换后建议手动检查 server.py 确保功能正常 147 | 3. **依赖管理**:可能需要手动调整 pyproject.toml 中的依赖 148 | 4. **测试运行**:转换后使用 `uv run python server.py` 测试 149 | 150 | ## 错误处理 151 | 152 | 如果转换失败,检查: 153 | - 仓库 URL 是否正确 154 | - 仓库是否包含 MCP 相关代码 155 | - 网络连接是否正常 156 | 157 | ## 贡献新功能 158 | 159 | 欢迎贡献更多转换规则!请查看 `repo_tools.py` 了解实现细节。 -------------------------------------------------------------------------------- /mcp-agent/__init__.py: -------------------------------------------------------------------------------- 1 | from .agent import root_agent 2 | from .tools import create_server, create_metadata, create_pyproject 3 | 4 | 5 | __all__ = ['root_agent', 'create_server', 'create_metadata', 'create_pyproject'] -------------------------------------------------------------------------------- /mcp-agent/agent.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | MCP工具生成器 - 通过对话收集需求并生成符合规范的MCP服务器 4 | """ 5 | import os 6 | from dotenv import load_dotenv 7 | from google.adk.agents import LlmAgent 8 | from google.adk.models.lite_llm import LiteLlm 9 | from .tools import create_server, create_metadata, create_pyproject 10 | from .prompt import INSTRUCTION 11 | 12 | load_dotenv(os.path.join(os.path.dirname(__file__), '.env')) 13 | 14 | root_agent = LlmAgent( 15 | name="MCP_Agent", 16 | model=LiteLlm(model=os.getenv('MODEL', 'gemini-2.0-flash')), 17 | description="专业的MCP工具生成助手,帮助科学家快速创建MCP服务器", 18 | instruction=INSTRUCTION, 19 | tools=[create_server, create_metadata, create_pyproject] 20 | ) -------------------------------------------------------------------------------- /mcp-agent/github_agent.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | GitHub Project Agent - 专门用于转换 GitHub 仓库到 AI4S MCP 格式 4 | """ 5 | import os 6 | from dotenv import load_dotenv 7 | from google.adk.agents import LlmAgent 8 | from google.adk.models.lite_llm import LiteLlm 9 | from .github_tools import ( 10 | explore_repository, read_file_content, analyze_mcp_structure, 11 | modify_file_content, create_standard_files, convert_repository_format, 12 | search_in_repository, list_directory_tree 13 | ) 14 | from .github_prompt import GITHUB_AGENT_INSTRUCTION 15 | 16 | load_dotenv(os.path.join(os.path.dirname(__file__), '.env')) 17 | 18 | github_agent = LlmAgent( 19 | name="GitHub_Project_Agent", 20 | model=LiteLlm(model=os.getenv('MODEL', 'gemini-2.0-flash')), 21 | description="专业的 GitHub 仓库转换助手,将 MCP 项目转换为 AI4S 标准格式", 22 | instruction=GITHUB_AGENT_INSTRUCTION, 23 | tools=[ 24 | explore_repository, 25 | read_file_content, 26 | analyze_mcp_structure, 27 | modify_file_content, 28 | create_standard_files, 29 | convert_repository_format, 30 | search_in_repository, 31 | list_directory_tree 32 | ] 33 | ) 34 | 35 | def create_github_agent(): 36 | """创建并返回 GitHub Project Agent 实例""" 37 | return github_agent -------------------------------------------------------------------------------- /mcp-agent/github_prompt.py: -------------------------------------------------------------------------------- 1 | """ 2 | GitHub Project Agent 的提示词系统 3 | """ 4 | 5 | GITHUB_AGENT_INSTRUCTION = """ 6 | 你是一个专业的 GitHub 仓库转换助手,专门负责将 GitHub 上的 MCP 工具仓库转换为 AI4S-agent-tools 的标准格式。 7 | 8 | ## 你的主要任务 9 | 10 | 1. **深入理解仓库**:通过探索目录结构、阅读关键文件(特别是 README、主程序文件、配置文件),全面理解项目的功能和结构。 11 | 12 | 2. **智能转换**:将仓库转换为 AI4S 标准格式,同时保持原有功能完全不变。 13 | 14 | 3. **谨慎操作**:只修改必要的部分,不要改变核心业务逻辑。 15 | 16 | ## 工作流程 17 | 18 | ### 第一步:探索和理解(重要!) 19 | 当用户提供仓库路径时,你应该: 20 | 21 | 1. 使用 `explore_repository` 获取整体结构概览 22 | 2. 使用 `list_directory_tree` 查看详细的目录树 23 | 3. 使用 `read_file_content` 阅读关键文件: 24 | - README.md - 理解项目功能和使用方法 25 | - 主 Python 文件 - 理解代码结构 26 | - 配置文件 - 理解依赖和设置 27 | 4. 使用 `analyze_mcp_structure` 深度分析 MCP 组件 28 | 29 | ### 第二步:制定转换计划 30 | 基于你的理解,制定清晰的转换计划: 31 | 32 | 1. 识别主服务器文件(需要重命名为 server.py) 33 | 2. 列出发现的所有 @mcp.tool() 装饰的函数 34 | 3. 确定需要添加的标准组件(如参数解析) 35 | 4. 推断合适的类别和描述 36 | 37 | ### 第三步:执行转换 38 | 按照计划执行转换: 39 | 40 | 1. 如果主文件不是 server.py,进行重命名 41 | 2. 检查是否需要添加参数解析功能: 42 | ```python 43 | def parse_args(): 44 | parser = argparse.ArgumentParser(description="...") 45 | parser.add_argument('--port', type=int, default=50001) 46 | parser.add_argument('--host', default='0.0.0.0') 47 | parser.add_argument('--log-level', default='INFO') 48 | return parser.parse_args() 49 | ``` 50 | 3. 创建 metadata.json 51 | 4. 清理 .git 目录(如果存在) 52 | 53 | ### 第四步:验证结果 54 | 转换完成后: 55 | 56 | 1. 再次使用 `analyze_mcp_structure` 确认所有组件就位 57 | 2. 使用 `read_file_content` 检查关键修改 58 | 3. 报告转换结果和任何潜在问题 59 | 60 | ## 重要原则 61 | 62 | 1. **保持功能不变**:绝对不要修改工具函数的业务逻辑 63 | 2. **最小化修改**:只做必要的格式调整 64 | 3. **智能推断**:根据代码内容智能推断类别 65 | 4. **详细反馈**:向用户清楚地说明每个操作 66 | 67 | ## 类别推断规则 68 | 69 | 根据以下关键词推断类别: 70 | - chemistry: molecule, mol, chem, reaction, pymol, rdkit 71 | - biology: protein, dna, sequence, gene, bio 72 | - physics: quantum, physics, energy 73 | - materials: material, crystal, structure 74 | - data: data, analysis, visualiz 75 | - machine-learning: ml, ai, model, neural 76 | 77 | ## 交互示例 78 | 79 | 用户:请转换 pymol-mcp 这个仓库 80 | 81 | 你的回应流程: 82 | 1. "让我先探索一下 pymol-mcp 的结构..." 83 | - 使用 explore_repository 和 list_directory_tree 84 | 2. "我来阅读主要文件以理解项目..." 85 | - 读取 README.md、主 Python 文件 86 | 3. "基于我的分析,这是一个 [描述]。我发现了以下 MCP 工具函数:[列表]" 87 | 4. "我将执行以下转换:[具体步骤]" 88 | 5. "转换完成![总结结果]" 89 | 90 | ## 错误处理 91 | 92 | 如果遇到问题: 93 | 1. 清楚地说明问题所在 94 | 2. 提供可能的解决方案 95 | 3. 询问用户如何处理 96 | 97 | 记住:你的目标是让转换过程智能、准确、透明。 98 | """ -------------------------------------------------------------------------------- /mcp-agent/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "mcp-tool-generator" 3 | version = "0.1.0" 4 | description = "Automatic MCP server generator for AI4S-agent-tools" 5 | requires-python = ">=3.10" 6 | dependencies = [ 7 | "google-adk>=1.7.0", 8 | "python-dotenv>=1.0.0", 9 | "litellm>=1.74.3" 10 | ] 11 | 12 | -------------------------------------------------------------------------------- /mcp-agent/requirements.txt: -------------------------------------------------------------------------------- 1 | google-adk>=1.7.0 2 | python-dotenv>=1.0.0 3 | litellm>=1.74.3 -------------------------------------------------------------------------------- /servers/ABACUS-tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/ABACUS-tools/__init__.py -------------------------------------------------------------------------------- /servers/ABACUS-tools/datasets/NiO.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "This example is calculating the band gap of NiO using APNS-v1 pseudopotential and orbital bundle. This material is a typical magnetic material. The magnetic moment of Ni atoms are in antiferromangetics form. The band gap are calculated using PBE+U with Ueff= 7 eV for Ni 3d orbital.", 4 | "input": { 5 | "basis_type": "lcao", 6 | "calculation": "scf", 7 | "dft_plus_u": "1", 8 | "ecutwfc": "100", 9 | "hubbard_u": "7.0 0.0", 10 | "ks_solver": "genelpa", 11 | "kspacing": "0.14", 12 | "mixing_beta": "0.2", 13 | "mixing_beta_mag": "0.8", 14 | "mixing_gg0": "1", 15 | "mixing_ndim": "30", 16 | "mixing_type": "broyden", 17 | "nspin": "2", 18 | "onsite_radius": "3.0", 19 | "orbital_corr": "2 -1", 20 | "out_bandgap": "1", 21 | "out_chg": "-1", 22 | "out_mul": "1", 23 | "scf_nmax": "300", 24 | "scf_thr": "1e-6", 25 | "smearing_method": "gauss", 26 | "smearing_sigma": "0.01", 27 | "symmetry": "1" 28 | }, 29 | "stru": "ATOMIC_SPECIES\nNi 58.6934 Ni_ONCV_PBE-1.2.upf upf201\nO 15.9994 O.upf upf201\n\nNUMERICAL_ORBITAL\nNi_gga_8au_100Ry_4s2p2d1f.orb\nO_gga_6au_100Ry_2s2p1d.orb\n\nLATTICE_CONSTANT\n1.8897260000\n\nLATTICE_VECTORS\n 4.1632639461 2.0729584133 2.0729584133\n 2.0729584133 4.1632639461 2.0729584133\n 2.0729584133 2.0729584133 4.1632639461\n\nATOMIC_POSITIONS\nDirect\n\nNi #label\n0.0000 #magnetism\n2 #number of atoms\n 0.0000000000 0.0000000000 0.0000000000 m 1 1 1 mag 1.3047\n 0.5000000000 0.5000000000 0.5000000000 m 1 1 1 mag -1.3047\n\nO #label\n0.0000 #magnetism\n2 #number of atoms\n 0.2500000000 0.2500000000 0.2500000000 m 1 1 1 mag -0.0000\n 0.7500000000 0.7500000000 0.7500000000 m 1 1 1 mag -0.0000\n", 30 | "pp_path": "APNS-v1", 31 | "orb_path": "APNS-v1" 32 | } 33 | ] -------------------------------------------------------------------------------- /servers/ABACUS-tools/datasets/README_dataset.md: -------------------------------------------------------------------------------- 1 | ## ABOUT this dataset 2 | 3 | This is a material dataset planned to use by ABACUS agent tools. ABACUS agent tools will use structure and input in this dataset as a start to do ABACUS calculation. 4 | 5 | To contribute to this dataset, simply execute `create_data.py` in a prepared ABACUS job directory, and paste content in the generated `{suffix}-data.json` to the main dataset file `datatset.json`. 6 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/datasets/create_data.py: -------------------------------------------------------------------------------- 1 | """ 2 | Collect data from an ABACUS job and dump to json format compatible with whole dataset 3 | """ 4 | import json 5 | from abacustest.lib_prepare.abacus import ReadInput 6 | 7 | input_params = ReadInput("INPUT") 8 | 9 | stru_file_content = [] 10 | with open("STRU") as fin: 11 | for lines in fin: 12 | lines = lines.strip() 13 | if lines != '': 14 | stru_file_content.append(lines) 15 | 16 | data = { 17 | 'description': None, 18 | 'input': input_params, 19 | 'stru': stru_file_content, 20 | 'pp': None, 21 | 'orb': None 22 | } 23 | 24 | if 'suffix' in input_params: 25 | suffix = input_params['suffix'] 26 | else: 27 | suffix = 'ABACUS' 28 | 29 | with open(f"{suffix}-data.json", "w") as fin: 30 | json.dump(data, fin, indent=4) 31 | 32 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/datasets/dataset.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "This example is calculating the band gap of NiO using APNS-v1 pseudopotential and orbital bundle. This material is a typical magnetic material. The magnetic moment of Ni atoms are in antiferromangetics form. The band gap are calculated using PBE+U with Ueff= 7 eV for Ni 3d orbital.", 4 | "input": { 5 | "suffix": "NiO", 6 | "ntype": 2, 7 | "calculation": "scf", 8 | "ecutwfc": 100, 9 | "scf_thr": 1e-07, 10 | "scf_nmax": 200, 11 | "smearing_method": "gaussian", 12 | "smearing_sigma": 0.01, 13 | "mixing_type": "broyden", 14 | "mixing_beta": 0.2, 15 | "mixing_gg0": 1.5, 16 | "ks_solver": "genelpa", 17 | "basis_type": "lcao", 18 | "gamma_only": 0, 19 | "symmetry": 1, 20 | "nspin": 2, 21 | "dft_plus_u": 1, 22 | "orbital_corr": "2 -1", 23 | "hubbard_u": "7.0 0.0", 24 | "out_mul": 1, 25 | "out_bandgap": 1, 26 | "kspacing": 0.1 27 | }, 28 | "stru": [ 29 | "ATOMIC_SPECIES", 30 | "Ni 58.6934 Ni_ONCV_PBE-1.2.upf upf201", 31 | "O 15.9994 O.upf upf201", 32 | "NUMERICAL_ORBITAL", 33 | "Ni_gga_8au_100Ry_4s2p2d1f.orb", 34 | "O_gga_6au_100Ry_2s2p1d.orb", 35 | "LATTICE_CONSTANT", 36 | "1.8897260000", 37 | "LATTICE_VECTORS", 38 | "4.1632639461 2.0729584133 2.0729584133", 39 | "2.0729584133 4.1632639461 2.0729584133", 40 | "2.0729584133 2.0729584133 4.1632639461", 41 | "ATOMIC_POSITIONS", 42 | "Direct", 43 | "Ni #label", 44 | "0.0000 #magnetism", 45 | "2 #number of atoms", 46 | "0.0000000000 0.0000000000 0.0000000000 m 1 1 1 mag 1.3047", 47 | "0.5000000000 0.5000000000 0.5000000000 m 1 1 1 mag -1.3047", 48 | "O #label", 49 | "0.0000 #magnetism", 50 | "2 #number of atoms", 51 | "0.2500000000 0.2500000000 0.2500000000 m 1 1 1 mag -0.0000", 52 | "0.7500000000 0.7500000000 0.7500000000 m 1 1 1 mag -0.0000" 53 | ], 54 | "pp": "APNS-v1", 55 | "orb": "APNS-v1" 56 | } 57 | ] -------------------------------------------------------------------------------- /servers/ABACUS-tools/examples/generate_bulk_structure.txt: -------------------------------------------------------------------------------- 1 | User: 2 | 请帮我分别准备Cr的BCC/FCC/HCP和diamon的结构,晶胞参数为2 A. 3 | 4 | 5 | Answer: 6 | 我已经为您生成了Cr的四种晶体结构文件,晶胞参数均为2 Å。以下是详细信息: 7 | 8 | 1. BCC结构 9 | 结构文件路径: /tmp/abacusagent/20250620115538/2025-06-20-12:01:05.392545/Cr_bcc.cif 10 | 晶胞参数: 11 | 第一向量: [-1.0, 1.0, 1.0] 12 | 第二向量: [1.0, -1.0, 1.0] 13 | 第三向量: [1.0, 1.0, -1.0] 14 | 原子坐标: [0.0, 0.0, 0.0] 15 | 2. FCC结构 16 | 结构文件路径: /tmp/abacusagent/20250620115538/2025-06-20-12:01:05.398128/Cr_fcc.cif 17 | 晶胞参数: 18 | 第一向量: [0.0, 1.0, 1.0] 19 | 第二向量: [1.0, 0.0, 1.0] 20 | 第三向量: [1.0, 1.0, 0.0] 21 | 原子坐标: [0.0, 0.0, 0.0] 22 | 3. HCP结构 23 | 结构文件路径: /tmp/abacusagent/20250620115538/2025-06-20-12:01:05.402771/Cr_hcp.cif 24 | 晶胞参数: 25 | 第一向量: [2.0, 0.0, 0.0] 26 | 第二向量: [-1.0, 1.7320508075688772, 0.0] 27 | 第三向量: [0.0, 0.0, 3.266] 28 | 原子坐标: 29 | [0.0, 0.0, 0.0] 30 | [0.0, 1.1547005383792515, 1.633] 31 | 4. Diamond结构 32 | 结构文件路径: /tmp/abacusagent/20250620115538/2025-06-20-12:01:05.408241/Cr_diamond.cif 33 | 晶胞参数: 34 | 第一向量: [0.0, 1.0, 1.0] 35 | 第二向量: [1.0, 0.0, 1.0] 36 | 第三向量: [1.0, 1.0, 0.0] 37 | 原子坐标: 38 | [0.0, 0.0, 0.0] 39 | [0.5, 0.5, 0.5] 40 | 您可以根据需要使用这些文件进行后续计算或分析。如果需要进一步操作,请告诉我! -------------------------------------------------------------------------------- /servers/ABACUS-tools/examples/my_agent/__init__.py: -------------------------------------------------------------------------------- 1 | from . import agent 2 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "ABACUS": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/ABACUS-tools", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "ABACUS", 17 | "description": "First principles calculations bridge for AI models - ABACUS computational jobs", 18 | "author": "@ahxbcn", 19 | "category": "materials" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/ABACUS-tools/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ABACUS", 3 | "description": "First principles calculations bridge for AI models - ABACUS computational jobs", 4 | "author": "@ahxbcn", 5 | "category": "materials" 6 | } 7 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools>=45", "setuptools_scm>=6.2"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | [project] 6 | name = "abacusagent" 7 | dynamic = ["version"] 8 | description = "Abacus agent" 9 | requires-python = ">=3.11" 10 | 11 | [project.scripts] 12 | abacusagent = "abacusagent.main:main" 13 | 14 | [tool.setuptools] 15 | package-dir = { "abacusagent" = "src/abacusagent" } 16 | 17 | [tool.setuptools_scm] 18 | 19 | [tool.setuptools.packages.find] 20 | where = ["src"] 21 | include = ["abacusagent*"] 22 | exclude = ["tests*", "docs*", "examples*"] 23 | 24 | [tool.pytest.ini_options] 25 | pythonpath = ["src"] 26 | testpaths = ["tests"] 27 | addopts = "-v" 28 | 29 | [project.optional-dependencies] 30 | dev = ["mcp>=1.9.0", 31 | "abacustest", 32 | "science-agent-sdk" 33 | ] 34 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | ABACUS MCP Server - Bridge between AI models and first principles calculations. 4 | Provides tools for ABACUS computational jobs including input preparation, job submission, and analysis. 5 | """ 6 | import sys 7 | import os 8 | from pathlib import Path 9 | import argparse 10 | from mcp.server.fastmcp import FastMCP 11 | 12 | # Import ABACUS-specific modules 13 | sys.path.append(str(Path(__file__).resolve().parent)) 14 | from src.abacusagent.main import load_tools 15 | from src.abacusagent.env import set_envs 16 | 17 | def parse_args(): 18 | """Parse command line arguments for MCP server.""" 19 | parser = argparse.ArgumentParser(description="ABACUS MCP Server") 20 | parser.add_argument('--port', type=int, default=50001, help='Server port (default: 50001)') 21 | parser.add_argument('--host', default='0.0.0.0', help='Server host (default: 0.0.0.0)') 22 | parser.add_argument('--log-level', default='INFO', 23 | choices=['DEBUG', 'INFO', 'WARNING', 'ERROR'], 24 | help='Logging level (default: INFO)') 25 | try: 26 | args = parser.parse_args() 27 | except SystemExit: 28 | class Args: 29 | port = 50001 30 | host = '0.0.0.0' 31 | log_level = 'INFO' 32 | args = Args() 33 | return args 34 | 35 | 36 | args = parse_args() 37 | mcp = FastMCP("ABACUS", host=args.host, port=args.port) 38 | 39 | 40 | load_tools() 41 | 42 | if __name__ == "__main__": 43 | set_envs() 44 | # Get transport type from environment variable, default to SSE 45 | transport_type = os.getenv('MCP_TRANSPORT', 'sse') 46 | mcp.run(transport=transport_type) 47 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/src/abacusagent/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/ABACUS-tools/src/abacusagent/__init__.py -------------------------------------------------------------------------------- /servers/ABACUS-tools/src/abacusagent/init_mcp.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | port = os.environ.get("ABACUSAGENT_PORT", "50001") 4 | host = os.environ.get("ABACUSAGENT_HOST", "0.0.0.0") 5 | model = os.environ.get("ABACUSAGENT_MODEL", "fastmcp") 6 | 7 | if model == "dp": 8 | from dp.agent.server import CalculationMCPServer 9 | mcp = CalculationMCPServer("ABACUSAGENT", port=port, host=host) 10 | elif model == "fastmcp": 11 | from mcp.server.fastmcp import FastMCP 12 | mcp = FastMCP("ABACUSAGENT", port=port, host=host) 13 | elif model == "test": # For unit test of models 14 | class MCP: 15 | def tool(self): 16 | def decorator(func): 17 | return func 18 | return decorator 19 | mcp = MCP() 20 | else: 21 | print("Please set the environment variable ABACUSAGENT_MODEL to dp, fastmcp or test.") 22 | raise ValueError("Invalid ABACUSAGENT_MODEL. Please set it to dp, fastmcp or test.") -------------------------------------------------------------------------------- /servers/ABACUS-tools/src/abacusagent/main.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | import importlib 3 | import os 4 | import argparse 5 | 6 | from importlib.metadata import version 7 | __version__ = version("abacusagent") 8 | 9 | def load_tools(): 10 | """ 11 | Load all tools from the abacusagent package. 12 | """ 13 | module_dir = Path(__file__).parent / "modules" 14 | 15 | for py_file in module_dir.glob("*.py"): 16 | if py_file.name.startswith("_") or py_file.stem in ["utils", "comm"]: 17 | continue # skipt __init__.py and utils.py 18 | 19 | module_name = f"abacusagent.modules.{py_file.stem}" 20 | try: 21 | module = importlib.import_module(module_name) 22 | print(f"✅ Successfully loaded: {module_name}") 23 | except Exception as e: 24 | print(f"⚠️ Failed to load {module_name}: {str(e)}") 25 | 26 | 27 | def parse_args(): 28 | """ 29 | Parse command line arguments. 30 | """ 31 | parser = argparse.ArgumentParser(description="AbacusAgent Command Line Interface") 32 | 33 | parser.add_argument( 34 | "--transport", 35 | type=str, 36 | default=None, 37 | choices=["sse", "streamable-http"], 38 | help="Transport protocol to use (default: sse), choices: sse, streamable-http" 39 | ) 40 | parser.add_argument( 41 | "--model", 42 | type=str, 43 | default=None, 44 | choices=["fastmcp", "test", "dp"], 45 | help="Model to use (default: dp), choices: fastmcp, test, dp" 46 | ) 47 | parser.add_argument( 48 | "--port", 49 | type=int, 50 | default=None, 51 | help="Port to run the MCP server on (default: 50001)" 52 | ) 53 | parser.add_argument( 54 | "--host", 55 | type=str, 56 | default=None, 57 | help="Host to run the MCP server on (default: localhost)" 58 | ) 59 | 60 | args = parser.parse_args() 61 | 62 | return args 63 | 64 | def print_address(): 65 | """ 66 | Print the address of the MCP server based on environment variables. 67 | """ 68 | address = f"{os.environ['ABACUSAGENT_HOST']}:{os.environ['ABACUSAGENT_PORT']}" 69 | if os.environ["ABACUSAGENT_TRANSPORT"] == "sse": 70 | print("Address:", address + "/sse") 71 | elif os.environ["ABACUSAGENT_TRANSPORT"] == "streamable-http": 72 | print("Address:", address + "/mcp") 73 | else: 74 | raise ValueError("Invalid transport protocol specified. Use 'sse' or 'streamable-http'.") 75 | 76 | def print_version(): 77 | """ 78 | Print the version of the AbacusAgent. 79 | """ 80 | print(f"\nAbacusAgentTools Version: {__version__}") 81 | print("For more information, visit: https://github.com/deepmodeling/ABACUS-agent-tools\n") 82 | 83 | def main(): 84 | """ 85 | Main function to run the MCP tool. 86 | """ 87 | print_version() 88 | args = parse_args() 89 | 90 | from abacusagent.env import set_envs, create_workpath 91 | set_envs( 92 | transport_input=args.transport, 93 | model_input=args.model, 94 | port_input=args.port, 95 | host_input=args.host) 96 | create_workpath() 97 | 98 | from abacusagent.init_mcp import mcp 99 | load_tools() 100 | 101 | print_address() 102 | mcp.run(transport=os.environ["ABACUSAGENT_TRANSPORT"]) 103 | 104 | if __name__ == "__main__": 105 | main() 106 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/src/abacusagent/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/ABACUS-tools/src/abacusagent/modules/__init__.py -------------------------------------------------------------------------------- /servers/ABACUS-tools/src/abacusagent/modules/deeptb_tool.py: -------------------------------------------------------------------------------- 1 | import os 2 | import json 3 | from typing import Optional, Literal, Dict, Any, TypedDict 4 | from pathlib import Path 5 | from abacusagent.init_mcp import mcp 6 | 7 | class ConfigResult(TypedDict): 8 | config_path: str 9 | 10 | @mcp.tool() 11 | def generate_deeptb_config( 12 | material: Literal["Si"] = "Si", 13 | ) -> ConfigResult: 14 | """ 15 | 生成用于 DeePTB 模型训练的配置文件。 16 | 17 | 参数: 18 | config_output_path: 输出的配置 JSON 文件路径。 19 | material: 材料类型,目前仅支持 "Si"。 20 | 21 | 返回: 22 | 包含配置文件路径的字典。 23 | 24 | 抛出: 25 | RuntimeError: 写入配置文件失败。 26 | """ 27 | 28 | config_output_path = "deeptb_config.json" 29 | 30 | config = { 31 | "common_options": { 32 | "seed": 12342, 33 | "basis": { 34 | "Si": "2s2p1d" 35 | }, 36 | "device": "cuda", 37 | "dtype": "float32", 38 | "overlap": True 39 | }, 40 | "model_options": { 41 | "embedding": { 42 | "method": "slem", 43 | "r_max": { 44 | "Si": 7.1 45 | }, 46 | "irreps_hidden": "32x0e+32x1o+16x2e+8x3o+8x4e+4x5o", 47 | "n_layers": 3, 48 | "n_radial_basis": 18, 49 | "env_embed_multiplicity": 10, 50 | "avg_num_neighbors": 51, 51 | "latent_dim": 64, 52 | "latent_channels": [32], 53 | "tp_radial_emb": True, 54 | "tp_radial_channels": [32], 55 | "PolynomialCutoff_p": 6, 56 | "cutoff_type": "polynomial", 57 | "res_update": True, 58 | "res_update_ratios": 0.5, 59 | "res_update_ratios_learnable": False 60 | }, 61 | "prediction": { 62 | "method": "e3tb", 63 | "scales_trainable": False, 64 | "shifts_trainable": False, 65 | "neurons": [64, 64] 66 | } 67 | }, 68 | "train_options": { 69 | "num_epoch": 1000, 70 | "batch_size": 2, 71 | "optimizer": { 72 | "lr": 0.005, 73 | "type": "Adam" 74 | }, 75 | "lr_scheduler": { 76 | "type": "rop", 77 | "factor": 0.8, 78 | "patience": 50, 79 | "min_lr": 1e-6 80 | }, 81 | "loss_options": { 82 | "train": {"method": "hamil_abs"} 83 | }, 84 | "save_freq": 1000, 85 | "validation_freq": 10, 86 | "display_freq": 1, 87 | "use_tensorboard": True 88 | }, 89 | "data_options": { 90 | "train": { 91 | "type": "DefaultDataset", 92 | "root": "you data path", 93 | "prefix": "Si64", 94 | "get_Hamiltonian": True, 95 | "get_eigenvalues": False, 96 | "get_overlap": True, 97 | "get_DM": False 98 | } 99 | } 100 | } 101 | 102 | try: 103 | with open(config_output_path, "w") as f: 104 | json.dump(config, f, indent=4) 105 | except Exception as e: 106 | raise RuntimeError(f"写入配置文件失败: {e}") 107 | 108 | return {"config_path": str(Path(config_output_path).absolute())} 109 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/src/abacusagent/modules/util/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/ABACUS-tools/src/abacusagent/modules/util/__init__.py -------------------------------------------------------------------------------- /servers/ABACUS-tools/src/abacusagent/modules/util/pyatb.py: -------------------------------------------------------------------------------- 1 | """ 2 | Use Pyatb to do property calculation. 3 | """ 4 | import os 5 | from pathlib import Path 6 | from typing import Dict, Any, Literal 7 | from abacusagent.modules.util.comm import ( 8 | generate_work_path, 9 | link_abacusjob, 10 | run_abacus, 11 | has_chgfile, 12 | has_pyatb_matrix_files 13 | ) 14 | 15 | from abacustest.lib_prepare.abacus import ReadInput, WriteInput, AbacusStru 16 | from abacustest.lib_collectdata.collectdata import RESULT 17 | 18 | 19 | def property_calculation_scf( 20 | abacus_inputs_path: Path, 21 | mode: Literal["nscf", "pyatb", "auto"] = "auto", 22 | ): 23 | """Perform the SCF calculation for property calculations like DOS or band structure. 24 | 25 | Args: 26 | abacus_inputs_path (Path): Path to the ABACUS input files. 27 | mode (Literal["nscf", "pyatb", "auto"]): Mode of operation, default is "auto". 28 | nscf: first run SCF with out_chg=1, then run nscf with init_chg=file. 29 | pyatb: run SCF with out_mat_r and out_mat_hs2 = 1, then calculate properties using Pyatb. 30 | auto: automatically determine the mode based on the input parameters. If basis is LCAO, use "pyatb", otherwise use "nscf". 31 | 32 | Returns: 33 | Dict[str, Any]: A dictionary containing the work path, normal end status, SCF steps, convergence status, and energies. 34 | """ 35 | 36 | input_param = ReadInput(os.path.join(abacus_inputs_path, 'INPUT')) 37 | basis_type = input_param.get("basis_type", "pw") 38 | if mode == "auto": 39 | if basis_type.lower() == "lcao": 40 | mode = "pyatb" 41 | else: 42 | mode = "nscf" 43 | 44 | if basis_type == "pw" and mode == "pyatb": 45 | raise ValueError("Pyatb mode is not supported for PW basis. Please use 'nscf' mode instead.") 46 | 47 | if (mode == "nscf" and has_chgfile(abacus_inputs_path)) or (mode == "pyatb" and has_pyatb_matrix_files(abacus_inputs_path)): 48 | print("Charge or matrix files already exist, skipping SCF calculation.") 49 | work_path = abacus_inputs_path 50 | else: 51 | work_path = generate_work_path() 52 | link_abacusjob(src=abacus_inputs_path, 53 | dst=work_path, 54 | copy_files=["INPUT"]) 55 | if mode == "nscf": 56 | input_param["calculation"] = "scf" 57 | input_param["out_chg"] = 1 58 | elif mode == "pyatb": 59 | input_param["calculation"] = "scf" 60 | input_param["out_mat_r"] = 1 61 | input_param["out_mat_hs2"] = 1 62 | else: 63 | raise ValueError(f"Invalid mode: {mode}. Use 'nscf', 'pyatb', or 'auto'.") 64 | 65 | WriteInput(input_param, os.path.join(work_path, 'INPUT')) 66 | run_abacus(work_path, input_param.get("suffix", "ABACUS")) 67 | 68 | rs = RESULT(path=work_path, fmt="abacus") 69 | 70 | return { 71 | "work_path": Path(work_path).absolute(), 72 | "normal_end": rs["normal_end"], 73 | "scf_steps": rs["scf_steps"], 74 | "converge": rs["converge"], 75 | "energies": rs["energies"], 76 | "mode": mode 77 | } 78 | 79 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/INPUT_LiFePO4_old: -------------------------------------------------------------------------------- 1 | INPUT_PARAMETERS 2 | suffix abacus 3 | ntype 4 4 | pseudo_dir ./ 5 | orbital_dir ./ 6 | calculation scf 7 | ecutwfc 100 8 | scf_thr 1e-07 9 | scf_nmax 200 10 | smearing_method gaussian 11 | smearing_sigma 0.001 12 | mixing_type pulay 13 | mixing_beta 0.2 14 | mixing_gg0 1.5 15 | ks_solver genelpa 16 | basis_type lcao 17 | gamma_only 0 18 | symmetry 0 19 | nspin 2 20 | out_mul 1 21 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/INPUT_ref: -------------------------------------------------------------------------------- 1 | INPUT_PARAMETERS 2 | suffix abacus 3 | ntype 7 4 | pseudo_dir ./ 5 | orbital_dir ./ 6 | nspin 1 7 | out_chg 0 8 | ecutwfc 100 9 | scf_thr 1e-6 10 | basis_type lcao 11 | calculation scf 12 | cal_force 1 13 | 14 | smearing_method mp 15 | smearing_sigma 0.01 16 | mixing_beta 0.2 17 | mixing_gg0 1.5 18 | 19 | gamma_only true 20 | 21 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/POSCAR: -------------------------------------------------------------------------------- 1 | Ga4As4 2 | 1.000 3 | 5.75018 0.0 0.0 4 | 0.0 5.75018 0.0 5 | 0.0 0.0 5.75018 6 | Ga As 7 | 4 4 8 | Direct 9 | 0.0000000 0.0000000 0.0000000 #Ga 10 | 0.0000000 0.5000000 0.5000000 #Ga 11 | 0.5000000 0.0000000 0.5000000 #Ga 12 | 0.5000000 0.5000000 0.0000000 #Ga 13 | 0.2500000 0.2500000 0.2500000 #As 14 | 0.2500000 0.7500000 0.7500000 #As 15 | 0.7500000 0.2500000 0.7500000 #As 16 | 0.7500000 0.7500000 0.2500000 #As 17 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/STRU: -------------------------------------------------------------------------------- 1 | ATOMIC_SPECIES 2 | Ga 69.723 ./Ga_ONCV_PBE-1.0.upf 3 | As 74.922 ./As_ONCV_PBE-1.0.upf 4 | 5 | NUMERICAL_ORBITAL 6 | ./Ga_gga_9au_100Ry_2s2p2d.orb 7 | ./As_gga_8au_100Ry_2s2p1d.orb 8 | 9 | LATTICE_CONSTANT 10 | 1.889716 11 | 12 | LATTICE_VECTORS 13 | 5.75018 0.00000 0.00000 14 | 0.00000 5.75018 0.00000 15 | 0.00000 0.00000 5.75018 16 | 17 | ATOMIC_POSITIONS 18 | Direct 19 | 20 | Ga 21 | 0.0 22 | 4 23 | 0.0000000 0.0000000 0.0000000 1 1 1 24 | 0.0000000 0.5000000 0.5000000 1 1 1 25 | 0.5000000 0.0000000 0.5000000 1 1 1 26 | 0.5000000 0.5000000 0.0000000 1 1 1 27 | 28 | As 29 | 0.0 30 | 4 31 | 0.2500000 0.2500000 0.2500000 1 1 1 32 | 0.2500000 0.7500000 0.7500000 1 1 1 33 | 0.7500000 0.2500000 0.7500000 1 1 1 34 | 0.7500000 0.7500000 0.2500000 1 1 1 35 | 36 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/STRU_LiFePO4: -------------------------------------------------------------------------------- 1 | ATOMIC_SPECIES 2 | Fe 55.8450 Fe_ONCV_PBE-1.0.upf 3 | Li 6.9400 Li_ONCV_PBE-1.0.upf 4 | P 30.9738 P_ONCV_PBE-1.0.upf 5 | O 15.9990 O_ONCV_PBE-1.0.upf 6 | 7 | NUMERICAL_ORBITAL 8 | Fe_gga_8au_100Ry_4s2p2d1f.orb 9 | Li_gga_7au_100Ry_4s1p.orb 10 | P_gga_8au_100Ry_2s2p1d.orb 11 | O_gga_7au_100Ry_2s2p1d.orb 12 | 13 | LATTICE_CONSTANT 14 | 1.8897261258369282 15 | 16 | LATTICE_VECTORS 17 | 10.3377000000 0.0000000000 0.0000000000 18 | 0.0000000000 6.0112000000 0.0000000000 19 | 0.0000000000 0.0000000000 4.6950000000 20 | 21 | ATOMIC_POSITIONS 22 | Direct 23 | 24 | Fe 25 | 0 26 | 4 27 | 0.28220000 0.25000000 0.97380000 mag -4.19 28 | 0.21780000 0.75000000 0.47380000 mag 4.19 29 | 0.78220000 0.25000000 0.52620000 mag -4.19 30 | 0.71780000 0.75000000 0.02620000 mag 4.19 31 | 32 | Li 33 | 0 34 | 4 35 | 0.00000000 0.00000000 0.00000000 mag 0.00 36 | 0.50000000 0.00000000 0.50000000 mag 0.00 37 | 0.50000000 0.50000000 0.50000000 mag 0.00 38 | 0.00000000 0.50000000 0.00000000 mag 0.00 39 | 40 | P 41 | 0 42 | 4 43 | 0.09500000 0.25000000 0.41800000 mag 0.00 44 | 0.40500000 0.75000000 0.91800000 mag 0.00 45 | 0.59500000 0.25000000 0.08200000 mag 0.00 46 | 0.90500000 0.75000000 0.58200000 mag 0.00 47 | 48 | O 49 | 0 50 | 16 51 | 0.09713000 0.25000000 0.74280000 mag 0.00 52 | 0.40287000 0.75000000 0.24280000 mag 0.00 53 | 0.59713000 0.25000000 0.75720000 mag 0.00 54 | 0.90287000 0.75000000 0.25720000 mag 0.00 55 | 0.45730000 0.25000000 0.20670000 mag 0.00 56 | 0.04270000 0.75000000 0.70670000 mag 0.00 57 | 0.95730000 0.25000000 0.29330000 mag 0.00 58 | 0.54270000 0.75000000 0.79330000 mag 0.00 59 | 0.16600000 0.04640000 0.28510000 mag 0.00 60 | 0.33400000 0.95360000 0.78510000 mag 0.00 61 | 0.33400000 0.54640000 0.78510000 mag 0.00 62 | 0.16600000 0.45360000 0.28510000 mag 0.00 63 | 0.66600000 0.45360000 0.21490000 mag 0.00 64 | 0.83400000 0.54640000 0.71490000 mag 0.00 65 | 0.83400000 0.95360000 0.71490000 mag 0.00 66 | 0.66600000 0.04640000 0.21490000 mag 0.00 67 | 68 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/STRU_NiO_fixatom: -------------------------------------------------------------------------------- 1 | ATOMIC_SPECIES 2 | Ni 58.693400 Ni_ONCV_PBE-1.0.upf 3 | O 15.999400 O_ONCV_PBE-1.0.upf 4 | 5 | NUMERICAL_ORBITAL 6 | Ni_gga_8au_100Ry_2s2p1d.orb 7 | O_gga_8au_100Ry_2s2p1d.orb 8 | 9 | LATTICE_CONSTANT 10 | 1.889726 11 | 12 | LATTICE_VECTORS 13 | 4.17000000000 2.08500000000 2.08500000000 14 | 2.08500000000 4.17000000000 2.08500000000 15 | 2.08500000000 2.08500000000 4.17000000000 16 | 17 | ATOMIC_POSITIONS 18 | Direct 19 | 20 | Ni 21 | 0.000000 22 | 2 23 | 0.00000000000 0.00000000000 0.00000000000 0 0 1 mag 2.00000000 24 | 0.50000000000 0.50000000000 0.50000000000 1 1 1 mag -2.00000000 25 | 26 | O 27 | 0.000000 28 | 2 29 | 0.25000000000 0.25000000000 0.25000000000 0 0 0 mag 0.00000000 30 | 0.75000000000 0.75000000000 0.75000000000 1 0 1 mag 0.00000000 31 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/STRU_NiO_ref: -------------------------------------------------------------------------------- 1 | ATOMIC_SPECIES 2 | Ni 58.693400 Ni_ONCV_PBE-1.2.upf 3 | O 15.999400 O_ONCV_PBE-1.2.upf 4 | 5 | NUMERICAL_ORBITAL 6 | Ni_gga_10au_6s3p3d2f.orb 7 | O_gga_10au_3s3p2d.orb 8 | 9 | LATTICE_CONSTANT 10 | 1.889726 11 | 12 | LATTICE_VECTORS 13 | 4.17000000000 2.08500000000 2.08500000000 14 | 2.08500000000 4.17000000000 2.08500000000 15 | 2.08500000000 2.08500000000 4.17000000000 16 | 17 | ATOMIC_POSITIONS 18 | Direct 19 | 20 | Ni 21 | 0.000000 22 | 2 23 | 0.00000000000 0.00000000000 0.00000000000 mag 2.0 24 | 0.50000000000 0.50000000000 0.50000000000 mag 2.0 25 | 26 | O 27 | 0.000000 28 | 2 29 | 0.25000000000 0.25000000000 0.25000000000 mag 0.0 30 | 0.75000000000 0.75000000000 0.75000000000 mag 0.0 31 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/Si-sp/INPUT: -------------------------------------------------------------------------------- 1 | INPUT_PARAMETERS 2 | suffix Si 3 | ntype 1 4 | pseudo_dir ./ 5 | orbital_dir ./ 6 | nspin 1 7 | ecutwfc 100 8 | scf_thr 1e-5 9 | basis_type lcao 10 | calculation scf 11 | 12 | smearing_method gaussian 13 | smearing_sigma 0.00001 14 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/Si-sp/KPT: -------------------------------------------------------------------------------- 1 | K_POINTS 2 | 0 3 | Gamma 4 | 1 1 1 0 0 0 5 | 6 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/Si-sp/STDOUTER: -------------------------------------------------------------------------------- 1 | OMP: Warning #182: OMP_STACKSIZE: ignored because KMP_STACKSIZE has been defined 2 | Info: Local MPI proc number: 1,OpenMP thread number: 6,Total thread number: 6,Local thread limit: 12 3 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/Si-sp/STRU: -------------------------------------------------------------------------------- 1 | ATOMIC_SPECIES 2 | Si 28.085 Si_ONCV_PBE-1.0.upf 3 | 4 | NUMERICAL_ORBITAL 5 | Si_gga_6au_100Ry_2s2p1d.orb 6 | 7 | LATTICE_CONSTANT 8 | 1.889726 9 | 10 | LATTICE_VECTORS 11 | 2.736138380000 0.000000000000 0.000000000000 12 | 1.368069190000 2.369565345350 0.000000000000 13 | 1.368069190000 0.789855115117 2.234047632215 14 | 15 | ATOMIC_POSITIONS 16 | Direct 17 | 18 | Si 19 | 0.000 20 | 1 21 | 0.000000000000 0.000000000000 0.000000000000 1 1 1 mag 0.0 22 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/Si-sp/metrics-ref.json: -------------------------------------------------------------------------------- 1 | { 2 | "normal_end": true, 3 | "natom": 1, 4 | "ibzk": 1, 5 | "nelec": 4.0, 6 | "nbands": 12, 7 | "scf_steps": 5, 8 | "energy_per_atom": -87.99299519239383 9 | } 10 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/orb/As_gga_8au_100Ry_2s2p1d.orb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/ABACUS-tools/tests/abacus/orb/As_gga_8au_100Ry_2s2p1d.orb -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/orb/Ga_gga_9au_100Ry_2s2p2d.orb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/ABACUS-tools/tests/abacus/orb/Ga_gga_9au_100Ry_2s2p2d.orb -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/pp/As_ONCV_PBE-1.0.upf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/ABACUS-tools/tests/abacus/pp/As_ONCV_PBE-1.0.upf -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/abacus/pp/Ga_ONCV_PBE-1.0.upf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/ABACUS-tools/tests/abacus/pp/Ga_ONCV_PBE-1.0.upf -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/plot_dos/INPUT: -------------------------------------------------------------------------------- 1 | INPUT_PARAMETERS 2 | suffix diamond 3 | ntype 1 4 | nbands 20 5 | calculation scf 6 | basis_type lcao 7 | ecutwfc 20 8 | symmetry 1 9 | scf_nmax 20 10 | scf_thr 1e-08 11 | kspacing 0.3 12 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/plot_dos/OUT.diamond/Orbital: -------------------------------------------------------------------------------- 1 | #io spec l m z sym 2 | 0 Si 0 0 1 s 3 | 0 Si 1 0 1 pz 4 | 0 Si 1 1 1 px 5 | 0 Si 1 2 1 py 6 | 1 Si 0 0 1 s 7 | 1 Si 1 0 1 pz 8 | 1 Si 1 1 1 px 9 | 1 Si 1 2 1 py 10 | 11 | 12 | #io =Orbital index in supercell 13 | #spec =Atomic species label 14 | #l =Angular mumentum quantum number 15 | #m =Magnetic quantum number 16 | #z =Zeta index of orbital 17 | #sym =Symmetry name of real orbital 18 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/plot_dos/OUT.diamond/running_nscf.log: -------------------------------------------------------------------------------- 1 | Fermi energy is 1.152161452994920 Rydberg 2 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/plot_dos/OUT.diamond/running_scf.log: -------------------------------------------------------------------------------- 1 | LCAO ALGORITHM --------------- ION= 1 ELEC= 6-------------------------------- 2 | 3 | Density error is 6.98739120242e-09 4 | ---------------------------------------------------------- 5 | Energy Rydberg eV 6 | ---------------------------------------------------------- 7 | E_KohnSham -16.5018351242 -224.5189851462 8 | E_KS(sigma->0) -16.5013382290 -224.5122245391 9 | E_Harris -16.5018351256 -224.5189851654 10 | E_band 5.1093636609 69.5164589417 11 | E_one_elec 12.1830211418 165.7585063829 12 | E_Hartree 0.0364250930 0.4955888153 13 | E_xc -6.7111500313 -91.3098805591 14 | E_Ewald -22.0091375372 -299.4496785711 15 | E_entropy(-TS) -0.0009937906 -0.0135212142 16 | E_descf 0.0000000000 0.0000000000 17 | E_exx 0.0000000000 0.0000000000 18 | E_Fermi 1.1521614530 15.6759607767 19 | ---------------------------------------------------------- 20 | 21 | 22 | charge density convergence is achieved 23 | final etot is -224.51898515 eV 24 | EFERMI = 15.675960777 eV 25 | 26 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/plot_dos/STRU: -------------------------------------------------------------------------------- 1 | ATOMIC_SPECIES 2 | Si 28 Si.upf 3 | 4 | NUMERICAL_ORBITAL 5 | Si_gga_6au_100Ry_2s2p1d.orb 6 | 7 | LATTICE_CONSTANT 8 | 1.889726 9 | 10 | LATTICE_VECTORS 11 | 2.8 0.00000000000 0.00000000000 12 | 0.00000000000 2.8 0.00000000000 13 | 0.00000000000 0.00000000000 2.8 14 | 15 | ATOMIC_POSITIONS 16 | Direct 17 | 18 | Si 19 | 0.000000 20 | 2 21 | 0.00000000000 0.00000000000 0.00000000000 1 1 1 22 | 0.5 0.5 0.5 1 1 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /servers/ABACUS-tools/tests/test_dos.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import os, sys, glob 3 | from pathlib import Path 4 | os.environ["ABACUSAGENT_MODEL"] = "test" 5 | 6 | from abacusagent.modules.dos import plot_dos_pdos as mkplots 7 | 8 | class TestPlotDos(unittest.TestCase): 9 | def setUp(self): 10 | self.data_dir = Path(__file__).parent / "plot_dos" 11 | 12 | 13 | def tearDown(self): 14 | for pngfile in glob.glob(os.path.join(self.data_dir, "*.png")): 15 | os.remove(pngfile) 16 | 17 | def test_run_dos(self): 18 | """ 19 | Test the run_dos function with a valid input. 20 | """ 21 | 22 | # ignore the screen output 23 | sys.stdout = open(os.devnull, 'w') 24 | 25 | # Call the run_dos function 26 | results_test = mkplots(self.data_dir,self.data_dir, dpi=20) 27 | results_ref = [Path(self.data_dir) / "DOS.png", 28 | Path(self.data_dir) / "Si1_pdos.png", 29 | Path(self.data_dir) / "Si2_pdos.png"] 30 | 31 | self.assertListEqual([Path(p) for p in results_test], results_ref) 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /servers/ASKCOS/README.md: -------------------------------------------------------------------------------- 1 | # ASKCOS MCP Server 2 | 3 | This is an MCP server that interfaces with ASKCOS for computer-aided synthesis planning and retrosynthesis analysis. 4 | 5 | ## Key Features 6 | 7 | 1. **Retrosynthesis Planning**: Analyze synthetic routes for target molecules 8 | 2. **Synthesis Route Analysis**: Evaluate and compare different synthetic pathways 9 | 3. **Reaction Prediction**: Predict chemical reactions and their outcomes 10 | 4. **ASKCOS API Integration**: Seamless connection to ASKCOS backend services 11 | 12 | ## Prerequisites 13 | 14 | Before using this tool, you need to have an ASKCOS instance running. Please refer to the [ASKCOS documentation](https://askcos-docs.mit.edu/) for deployment instructions. 15 | 16 | ## Usage 17 | 18 | ```bash 19 | # Install dependencies 20 | uv sync 21 | 22 | # Set ASKCOS API URL (required) 23 | export ASKCOS_API_URL="http://your-askcos-instance:9100" 24 | 25 | # Run server 26 | python server.py --port 50001 27 | 28 | # Run with custom host 29 | python server.py --host localhost --port 50001 30 | 31 | # Enable debug logging 32 | python server.py --port 50001 --log-level DEBUG 33 | ``` 34 | 35 | ## Configuration 36 | 37 | 1. Set the `ASKCOS_API_URL` environment variable to point to your ASKCOS instance 38 | 2. Ensure your ASKCOS instance is running and accessible 39 | 3. Install the required dependencies using `uv sync` 40 | 4. Test the connection to your ASKCOS API 41 | 5. Run the MCP server 42 | 43 | ## Structure 44 | 45 | ``` 46 | ASKCOS/ 47 | ├── server.py # ASKCOS MCP server implementation 48 | ├── metadata.json # Tool metadata for registry 49 | ├── pyproject.toml # Python dependencies 50 | ├── README.md # Tool documentation 51 | └── ASKCOS.md # ASKCOS integration guide 52 | ``` 53 | 54 | ## Available Tools 55 | 56 | ### retrosynthesis_planning 57 | Performs retrosynthesis planning for a given molecule SMILES string. 58 | 59 | **Parameters:** 60 | - `smiles` (string): The SMILES representation of the target molecule 61 | - `max_depth` (integer, optional): Maximum depth for the synthesis tree 62 | 63 | **Returns:** 64 | - Synthesis plan with reaction steps and intermediates 65 | 66 | ### synthesis_route_analysis 67 | Analyzes and evaluates different synthetic routes for a target molecule. 68 | 69 | **Parameters:** 70 | - `smiles` (string): The SMILES representation of the target molecule 71 | - `routes` (array, optional): Specific routes to analyze 72 | 73 | **Returns:** 74 | - Analysis results with route rankings and feasibility scores 75 | 76 | ### reaction_prediction 77 | Predicts possible reactions for given reactants. 78 | 79 | **Parameters:** 80 | - `reactants` (array): List of reactant SMILES strings 81 | - `conditions` (object, optional): Reaction conditions 82 | 83 | **Returns:** 84 | - Predicted reaction products and pathways 85 | 86 | ## Environment Variables 87 | 88 | - `ASKCOS_API_URL`: URL of your ASKCOS instance (required) 89 | - `ASKCOS_USERNAME`: Username for ASKCOS authentication (optional) 90 | - `ASKCOS_PASSWORD`: Password for ASKCOS authentication (optional) 91 | 92 | ## Troubleshooting 93 | 94 | - Ensure your ASKCOS instance is running and accessible 95 | - Check that the API URL is correct and includes the port (usually 9100) 96 | - Verify that your ASKCOS instance has the required models loaded 97 | - Check the server logs for detailed error messages 98 | 99 | ## References 100 | 101 | - [ASKCOS Documentation](https://askcos-docs.mit.edu/) 102 | - [ASKCOS GitHub Repository](https://github.com/ASKCOS/askcos-core) 103 | - [AI4S-agent-tools Documentation](../../README.md) -------------------------------------------------------------------------------- /servers/ASKCOS/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "askcos": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/ASKCOS", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio", 14 | "ASKCOS_API_URL": "http://localhost:8080/askcos/api" 15 | }, 16 | "metadata": { 17 | "name": "ASKCOS", 18 | "description": "Computer-aided synthesis planning tool for retrosynthesis analysis", 19 | "author": "@jiaodu", 20 | "category": "chemistry" 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /servers/ASKCOS/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ASKCOS", 3 | "description": "Computer-aided synthesis planning tool for retrosynthesis analysis", 4 | "author": "@jiaodu1307", 5 | "category": "chemistry", 6 | "transport": ["sse", "stdio"], 7 | "tools": ["retrosynthesis_planning", "synthesis_route_analysis", "reaction_prediction"] 8 | } 9 | -------------------------------------------------------------------------------- /servers/ASKCOS/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "askcos-mcp-server" 3 | version = "0.1.0" 4 | description = "ASKCOS MCP server for computer-aided synthesis planning" 5 | authors = [ 6 | { name = "jiaodu" } 7 | ] 8 | readme = "README.md" 9 | requires-python = ">=3.10" 10 | dependencies = [ 11 | "mcp", 12 | "fastmcp>=2.3.0", 13 | "requests>=2.25.0", 14 | "numpy", 15 | ] 16 | 17 | [project.optional-dependencies] 18 | rdkit = ["rdkit>=2022.9.1"] 19 | 20 | [project.scripts] 21 | askcos-mcp = "server:main" 22 | 23 | [build-system] 24 | requires = ["setuptools>=61.0"] 25 | build-backend = "setuptools.build_meta" 26 | -------------------------------------------------------------------------------- /servers/CompositionDART/constant/atomic_mass.json: -------------------------------------------------------------------------------- 1 | { 2 | "H": 1.008, 3 | "He": 4.003, 4 | "Li": 6.94, 5 | "Be": 9.012, 6 | "B": 10.81, 7 | "C": 12.011, 8 | "N": 14.007, 9 | "O": 15.999, 10 | "F": 18.998, 11 | "Ne": 20.180, 12 | "Na": 22.990, 13 | "Mg": 24.305, 14 | "Al": 26.982, 15 | "Si": 28.085, 16 | "P": 30.974, 17 | "S": 32.06, 18 | "Cl": 35.45, 19 | "Ar": 39.948, 20 | "K": 39.098, 21 | "Ca": 40.078, 22 | "Sc": 44.956, 23 | "Ti": 47.867, 24 | "V": 50.942, 25 | "Cr": 51.996, 26 | "Mn": 54.938, 27 | "Fe": 55.845, 28 | "Co": 58.933, 29 | "Ni": 58.693, 30 | "Cu": 63.546, 31 | "Zn": 65.38, 32 | "Ga": 69.723, 33 | "Ge": 72.630, 34 | "As": 74.922, 35 | "Se": 78.971, 36 | "Br": 79.904, 37 | "Kr": 83.798, 38 | "Rb": 85.468, 39 | "Sr": 87.62, 40 | "Y": 88.906, 41 | "Zr": 91.224, 42 | "Nb": 92.906, 43 | "Mo": 95.95, 44 | "Tc": 98.0, 45 | "Ru": 101.07, 46 | "Rh": 102.906, 47 | "Pd": 106.42, 48 | "Ag": 107.868, 49 | "Cd": 112.414, 50 | "In": 114.818, 51 | "Sn": 118.710, 52 | "Sb": 121.760, 53 | "Te": 127.60, 54 | "I": 126.904, 55 | "Xe": 131.293, 56 | "Cs": 132.905, 57 | "Ba": 137.327, 58 | "La": 138.905, 59 | "Ce": 140.116, 60 | "Pr": 140.908, 61 | "Nd": 144.242, 62 | "Pm": 146.0, 63 | "Sm": 150.36, 64 | "Eu": 151.964, 65 | "Gd": 157.25, 66 | "Tb": 158.925, 67 | "Dy": 162.500, 68 | "Ho": 164.930, 69 | "Er": 167.259, 70 | "Tm": 168.934, 71 | "Yb": 173.055, 72 | "Lu": 174.967, 73 | "Hf": 178.49, 74 | "Ta": 180.948, 75 | "W": 183.84, 76 | "Re": 186.207, 77 | "Os": 190.23, 78 | "Ir": 192.217, 79 | "Pt": 195.085, 80 | "Au": 196.967, 81 | "Hg": 200.592, 82 | "Tl": 204.383, 83 | "Pb": 207.2, 84 | "Bi": 208.980, 85 | "Po": 208.982, 86 | "At": 209.987, 87 | "Rn": 222.018, 88 | "Fr": 223.0, 89 | "Ra": 226.025, 90 | "Ac": 227.028, 91 | "Th": 232.038, 92 | "Pa": 231.036, 93 | "U": 238.029, 94 | "Np": 237.048, 95 | "Pu": 244.0, 96 | "Am": 243.0, 97 | "Cm": 247.0, 98 | "Bk": 247.0, 99 | "Cf": 251.0, 100 | "Es": 252.0, 101 | "Fm": 257.0, 102 | "Md": 258.0, 103 | "No": 259.0, 104 | "Lr": 262.0, 105 | "Rf": 267.0, 106 | "Db": 268.0, 107 | "Sg": 269.0, 108 | "Bh": 270.0, 109 | "Hs": 269.0, 110 | "Mt": 278.0, 111 | "Ds": 281.0, 112 | "Rg": 281.0, 113 | "Cn": 285.0, 114 | "Nh": 286.0, 115 | "Fl": 289.0, 116 | "Mc": 290.0, 117 | "Lv": 293.0, 118 | "Ts": 294.0, 119 | "Og": 294.0 120 | } -------------------------------------------------------------------------------- /servers/CompositionDART/constant/densities.json: -------------------------------------------------------------------------------- 1 | { 2 | "H": 89.88, 3 | "He": 178.60000000000002, 4 | "Li": 534.0, 5 | "Be": 1850.0, 6 | "B": 2080.0, 7 | "C": 1821.0, 8 | "N": 1251.0, 9 | "O": 1429.0, 10 | "F": 1696.0, 11 | "Ne": 900.2, 12 | "Na": 968.0, 13 | "Mg": 1738.0, 14 | "Al": 2700.0, 15 | "Si": 2329.0, 16 | "P": 1823.0, 17 | "S": 2070.0, 18 | "Cl": 3200.0, 19 | "Ar": 1784.0, 20 | "K": 862.0, 21 | "Ca": 1550.0, 22 | "Sc": 2985.0, 23 | "Ti": 4506.0, 24 | "V": 6000, 25 | "Cr": 7190.0, 26 | "Mn": 7210.0, 27 | "Fe": 7874.0, 28 | "Co": 8900.0, 29 | "Ni": 8908.0, 30 | "Cu": 8960.0, 31 | "Zn": 7140.0, 32 | "Ga": 5910.0, 33 | "Ge": 5323.0, 34 | "As": 5727.0, 35 | "Se": 4810.0, 36 | "Br": 3102.7999999999997, 37 | "Kr": 3749.0, 38 | "Rb": 1532.0, 39 | "Sr": 2640.0, 40 | "Y": 4472.0, 41 | "Zr": 6520.0, 42 | "Nb": 8570.0, 43 | "Mo": 10280.0, 44 | "Tc": 11000, 45 | "Ru": 12450.0, 46 | "Rh": 12410.0, 47 | "Pd": 12023.0, 48 | "Ag": 10490.0, 49 | "Cd": 8650.0, 50 | "In": 7310.0, 51 | "Sn": 7365.0, 52 | "Sb": 6697.0, 53 | "Te": 6240.0, 54 | "I": 4933.0, 55 | "Xe": 5894.0, 56 | "Cs": 1930.0, 57 | "Ba": 3510.0, 58 | "La": 6162.0, 59 | "Ce": 6770.0, 60 | "Pr": 6770.0, 61 | "Nd": 7010.0, 62 | "Pm": 7260.0, 63 | "Sm": 7520.0, 64 | "Eu": 5264.0, 65 | "Gd": 7900.0, 66 | "Tb": 8230.0, 67 | "Dy": 8540.0, 68 | "Ho": 8790.0, 69 | "Er": 9066.0, 70 | "Tm": 9320.0, 71 | "Yb": 6900.0, 72 | "Lu": 9841.0, 73 | "Hf": 13310.0, 74 | "Ta": 16690.0, 75 | "W": 19250.0, 76 | "Re": 21020.0, 77 | "Os": 22590.0, 78 | "Ir": 22560.0, 79 | "Pt": 21450.0, 80 | "Au": 19300.0, 81 | "Hg": 13534.0, 82 | "Tl": 11850.0, 83 | "Pb": 11340.0, 84 | "Bi": 9780.0, 85 | "Po": 9196.0, 86 | "At": 6350.0, 87 | "Rn": 9730.0, 88 | "Fr": 1870.0, 89 | "Ra": 5500.0, 90 | "Ac": 10000, 91 | "Th": 11724.0, 92 | "Pa": 15370.0, 93 | "U": 19100.0, 94 | "Np": 20450.0, 95 | "Pu": 19816.0, 96 | "Am": 12000, 97 | "Cm": 13510.0, 98 | "Bk": 14780.0, 99 | "Cf": 15100.0, 100 | "Es": 8840.0, 101 | "Rf": 23200.0, 102 | "Db": 29300.0, 103 | "Sg": 35000, 104 | "Bh": 37100.0, 105 | "Hs": 40700.0, 106 | "Mt": 37400.0, 107 | "Ds": 34800.0, 108 | "Rg": 28700.0, 109 | "Cn": 14000.0, 110 | "Nh": 16000, 111 | "Fl": 14000, 112 | "Mc": 13500.0, 113 | "Lv": 12900.0, 114 | "Ts": 7170.0, 115 | "Og": 4950.0, 116 | "Uue": 3000 117 | } -------------------------------------------------------------------------------- /servers/CompositionDART/constant/mk_metal_densities.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | ptable = 'ptable.json' 4 | with open(ptable, 'r') as f: 5 | ptable_dict = json.load(f) 6 | elements_info = ptable_dict['elements'] 7 | density_dict = {} 8 | for ee in elements_info: 9 | if ee['density'] is None or ee['symbol'] is None: 10 | continue 11 | symbol = ee['symbol'] 12 | density = ee['density'] * 1000 13 | density_dict[symbol] = density 14 | 15 | print(f"{symbol} {density}") 16 | 17 | with open('densities.json', 'w') as f: 18 | json.dump(density_dict, f) 19 | -------------------------------------------------------------------------------- /servers/CompositionDART/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "CompositionDART": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/CompositionDART", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "CompositionDART", 17 | "description": "Composition Optimization via DPA-based Adaptive Refinement Targeting (DART) for materials discovery.", 18 | "author": "@SchrodingersCattt", 19 | "category": "materials" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/CompositionDART/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CompositionDART", 3 | "description": "Composition Optimization via DPA-based Adaptive Refinement Targeting (DART) for materials discovery.", 4 | "author": "@SchrodingersCattt", 5 | "category": "materials" 6 | } -------------------------------------------------------------------------------- /servers/CompositionDART/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "dart" 3 | version = "0.1.0" 4 | description = "Deep Potential Agent for atomistic simulation" 5 | readme = "README.md" 6 | requires-python = ">=3.10,<3.12" 7 | 8 | dependencies = [ 9 | "tqdm", 10 | "requests>=2.32.3", 11 | "flask>=3.1.1", 12 | "scipy>=1.12.0", 13 | "ase>=3.22.1", 14 | "seekpath>=2.0.1", 15 | "torchaudio", 16 | "torchvision", 17 | "tensorflow==2.19.0", 18 | "deepmd-kit==3.1.0", 19 | "numpy==1.26.4", 20 | "dpdata", 21 | "phonopy", 22 | "pymatgen", 23 | "spglib", 24 | "matplotlib", 25 | "typing-extensions", 26 | "pyyaml", 27 | "bohr-agent-sdk" 28 | ] -------------------------------------------------------------------------------- /servers/CompositionDART/struct_template/bcc-Cr_mp-90_conventional_standard.cif: -------------------------------------------------------------------------------- 1 | # generated using pymatgen 2 | data_Cr 3 | _symmetry_space_group_name_H-M 'P 1' 4 | _cell_length_a 2.87402526 5 | _cell_length_b 2.87402526 6 | _cell_length_c 2.87402526 7 | _cell_angle_alpha 90.00000000 8 | _cell_angle_beta 90.00000000 9 | _cell_angle_gamma 90.00000000 10 | _symmetry_Int_Tables_number 1 11 | _chemical_formula_structural Cr 12 | _chemical_formula_sum Cr2 13 | _cell_volume 23.73950953 14 | _cell_formula_units_Z 2 15 | loop_ 16 | _symmetry_equiv_pos_site_id 17 | _symmetry_equiv_pos_as_xyz 18 | 1 'x, y, z' 19 | loop_ 20 | _atom_site_type_symbol 21 | _atom_site_label 22 | _atom_site_symmetry_multiplicity 23 | _atom_site_fract_x 24 | _atom_site_fract_y 25 | _atom_site_fract_z 26 | _atom_site_occupancy 27 | Cr Cr0 1 0.00000000 0.00000000 0.00000000 1 28 | Cr Cr1 1 0.50000000 0.50000000 0.50000000 1 29 | -------------------------------------------------------------------------------- /servers/CompositionDART/struct_template/bcc-Fe_mp-13_conventional_standard.cif: -------------------------------------------------------------------------------- 1 | # generated using pymatgen 2 | data_Fe 3 | _symmetry_space_group_name_H-M 'P 1' 4 | _cell_length_a 2.84005168 5 | _cell_length_b 2.84005168 6 | _cell_length_c 2.84005168 7 | _cell_angle_alpha 90.00000000 8 | _cell_angle_beta 90.00000000 9 | _cell_angle_gamma 90.00000000 10 | _symmetry_Int_Tables_number 1 11 | _chemical_formula_structural Fe 12 | _chemical_formula_sum Fe2 13 | _cell_volume 22.90755445 14 | _cell_formula_units_Z 2 15 | loop_ 16 | _symmetry_equiv_pos_site_id 17 | _symmetry_equiv_pos_as_xyz 18 | 1 'x, y, z' 19 | loop_ 20 | _atom_site_type_symbol 21 | _atom_site_label 22 | _atom_site_symmetry_multiplicity 23 | _atom_site_fract_x 24 | _atom_site_fract_y 25 | _atom_site_fract_z 26 | _atom_site_occupancy 27 | Fe Fe0 1 0.00000000 0.00000000 0.00000000 1 28 | Fe Fe1 1 0.50000000 0.50000000 0.50000000 1 29 | -------------------------------------------------------------------------------- /servers/CompositionDART/struct_template/bcc-V_mp-146_conventional_standard.cif: -------------------------------------------------------------------------------- 1 | # generated using pymatgen 2 | data_V 3 | _symmetry_space_group_name_H-M 'P 1' 4 | _cell_length_a 2.99254400 5 | _cell_length_b 2.99254400 6 | _cell_length_c 2.99254400 7 | _cell_angle_alpha 90.00000000 8 | _cell_angle_beta 90.00000000 9 | _cell_angle_gamma 90.00000000 10 | _symmetry_Int_Tables_number 1 11 | _chemical_formula_structural V 12 | _chemical_formula_sum V2 13 | _cell_volume 26.79918791 14 | _cell_formula_units_Z 2 15 | loop_ 16 | _symmetry_equiv_pos_site_id 17 | _symmetry_equiv_pos_as_xyz 18 | 1 'x, y, z' 19 | loop_ 20 | _atom_site_type_symbol 21 | _atom_site_label 22 | _atom_site_symmetry_multiplicity 23 | _atom_site_fract_x 24 | _atom_site_fract_y 25 | _atom_site_fract_z 26 | _atom_site_occupancy 27 | V V0 1 0.00000000 0.00000000 0.00000000 1 28 | V V1 1 0.50000000 0.50000000 0.50000000 1 29 | -------------------------------------------------------------------------------- /servers/CompositionDART/struct_template/fcc-Cu_mp-30_conventional_standard.cif: -------------------------------------------------------------------------------- 1 | # generated using pymatgen 2 | data_Cu 3 | _symmetry_space_group_name_H-M 'P 1' 4 | _cell_length_a 3.62126200 5 | _cell_length_b 3.62126200 6 | _cell_length_c 3.62126200 7 | _cell_angle_alpha 90.00000000 8 | _cell_angle_beta 90.00000000 9 | _cell_angle_gamma 90.00000000 10 | _symmetry_Int_Tables_number 1 11 | _chemical_formula_structural Cu 12 | _chemical_formula_sum Cu4 13 | _cell_volume 47.48755856 14 | _cell_formula_units_Z 4 15 | loop_ 16 | _symmetry_equiv_pos_site_id 17 | _symmetry_equiv_pos_as_xyz 18 | 1 'x, y, z' 19 | loop_ 20 | _atom_site_type_symbol 21 | _atom_site_label 22 | _atom_site_symmetry_multiplicity 23 | _atom_site_fract_x 24 | _atom_site_fract_y 25 | _atom_site_fract_z 26 | _atom_site_occupancy 27 | Cu Cu0 1 0.00000000 0.00000000 0.00000000 1 28 | Cu Cu1 1 0.00000000 0.50000000 0.50000000 1 29 | Cu Cu2 1 0.50000000 0.00000000 0.50000000 1 30 | Cu Cu3 1 0.50000000 0.50000000 0.00000000 1 31 | -------------------------------------------------------------------------------- /servers/CompositionDART/struct_template/fcc-Ni_mp-23_conventional_standard.cif: -------------------------------------------------------------------------------- 1 | # generated using pymatgen 2 | data_Ni 3 | _symmetry_space_group_name_H-M 'P 1' 4 | _cell_length_a 3.50579800 5 | _cell_length_b 3.50579800 6 | _cell_length_c 3.50579800 7 | _cell_angle_alpha 90.00000000 8 | _cell_angle_beta 90.00000000 9 | _cell_angle_gamma 90.00000000 10 | _symmetry_Int_Tables_number 1 11 | _chemical_formula_structural Ni 12 | _chemical_formula_sum Ni4 13 | _cell_volume 43.08842967 14 | _cell_formula_units_Z 4 15 | loop_ 16 | _symmetry_equiv_pos_site_id 17 | _symmetry_equiv_pos_as_xyz 18 | 1 'x, y, z' 19 | loop_ 20 | _atom_site_type_symbol 21 | _atom_site_label 22 | _atom_site_symmetry_multiplicity 23 | _atom_site_fract_x 24 | _atom_site_fract_y 25 | _atom_site_fract_z 26 | _atom_site_occupancy 27 | Ni Ni0 1 0.00000000 0.00000000 0.00000000 1 28 | Ni Ni1 1 0.00000000 0.50000000 0.50000000 1 29 | Ni Ni2 1 0.50000000 0.00000000 0.50000000 1 30 | Ni Ni3 1 0.50000000 0.50000000 0.00000000 1 31 | -------------------------------------------------------------------------------- /servers/CompositionDART/struct_template/hcp-Co_mp-54_conventional_standard.cif: -------------------------------------------------------------------------------- 1 | # generated using pymatgen 2 | data_Co 3 | _symmetry_space_group_name_H-M 'P 1' 4 | _cell_length_a 2.50078380 5 | _cell_length_b 2.50078380 6 | _cell_length_c 4.03333100 7 | _cell_angle_alpha 90.00000000 8 | _cell_angle_beta 90.00000000 9 | _cell_angle_gamma 120.00000000 10 | _symmetry_Int_Tables_number 1 11 | _chemical_formula_structural Co 12 | _chemical_formula_sum Co2 13 | _cell_volume 21.84473542 14 | _cell_formula_units_Z 2 15 | loop_ 16 | _symmetry_equiv_pos_site_id 17 | _symmetry_equiv_pos_as_xyz 18 | 1 'x, y, z' 19 | loop_ 20 | _atom_site_type_symbol 21 | _atom_site_label 22 | _atom_site_symmetry_multiplicity 23 | _atom_site_fract_x 24 | _atom_site_fract_y 25 | _atom_site_fract_z 26 | _atom_site_occupancy 27 | Co Co0 1 0.66666667 0.33333333 0.75000000 1 28 | Co Co1 1 0.33333333 0.66666667 0.25000000 1 29 | -------------------------------------------------------------------------------- /servers/DPACalculator/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "DPACalculatorServer": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/DPACalculator", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "DPACalculatorServer", 17 | "description": "Deep Potential Agent for atomistic simulation", 18 | "author": "@SchrodingersCattt", 19 | "category": "materials" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/DPACalculator/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DPACalculatorServer", 3 | "description": "Deep Potential Agent for atomistic simulation", 4 | "author": "@SchrodingersCattt", 5 | "category": "materials" 6 | } -------------------------------------------------------------------------------- /servers/DPACalculator/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "dpa" 3 | version = "0.1.0" 4 | description = "Deep Potential Agent for atomistic simulation" 5 | readme = "README.md" 6 | requires-python = ">=3.10,<3.12" 7 | 8 | dependencies = [ 9 | "requests>=2.32.3", 10 | "flask>=3.1.1", 11 | "scipy>=1.12.0", 12 | "ase>=3.22.1", 13 | "seekpath>=2.0.1", 14 | "torchaudio", 15 | "torchvision", 16 | "tensorflow==2.15.0", 17 | "deepmd-kit==3.1.0", 18 | "numpy==1.26.4", 19 | "dpdata", 20 | "phonopy", 21 | "pymatgen", 22 | "spglib", 23 | "matplotlib", 24 | "typing-extensions", 25 | "pyyaml", 26 | "science-agent-sdk" 27 | ] -------------------------------------------------------------------------------- /servers/DPCombo/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "DPComboServer": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/DPCombo", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "DPComboServer", 17 | "description": "A Server for DP model training/finetuning/inference and dataset manipulation.", 18 | "author": "@SchrodingersCattt", 19 | "category": "materials" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/DPCombo/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DPComboServer", 3 | "description": "A Server for DP model training/finetuning/inference and dataset manipulation.", 4 | "author": "@SchrodingersCattt", 5 | "category": "materials" 6 | } -------------------------------------------------------------------------------- /servers/DPCombo/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "dpa" 3 | version = "0.1.0" 4 | description = "Server for DPA training, evaluation and dataset processing" 5 | readme = "README.md" 6 | requires-python = ">=3.10,<3.12" 7 | 8 | dependencies = [ 9 | "requests>=2.32.3", 10 | "flask>=3.1.1", 11 | "scipy>=1.12.0", 12 | "ase>=3.22.1", 13 | "seekpath>=2.0.1", 14 | "tensorflow==2.19.0", 15 | "torchaudio", 16 | "torchvision", 17 | "deepmd-kit==3.1.0", 18 | "numpy==1.26.4", 19 | "dpdata", 20 | "pymatgen", 21 | "spglib", 22 | "matplotlib", 23 | "typing-extensions", 24 | "pyyaml", 25 | "bohr-agent-sdk" 26 | ] -------------------------------------------------------------------------------- /servers/HEA_paper_extract/README.md: -------------------------------------------------------------------------------- 1 | # HEA_extractTool 2 | extract structural data of HEA materials from searched or given publications 3 | ## Key Features 4 | Search_paper 5 | input : 6 | user_query, example: High entropy alloy 7 | search_type: title, author of all (for keywords) 8 | max_results: int, expected number of results 9 | output : saved path of the downloaded pdf files 10 | 11 | HEA_data_extract 12 | input : 13 | manuscript: path to the pdf file of a paper 14 | out_dir: output directory, default 'results' 15 | output : 16 | if the manuscript doesn't include any HEA materials research, return"No, the author did not study the phase structure and properties of High Entropy alloys" 17 | otherwise, return the path to the extracted csv file 18 | 19 | ## Usage 20 | 21 | ```bash 22 | # Install dependencies 23 | uv sync 24 | 25 | # Run server 26 | python src/server.py --port 50001 27 | 28 | # Run with custom host 29 | python src/server.py --host localhost --port 50001 30 | 31 | # Enable debug logging 32 | python src/server.py --port 50001 --log-level DEBUG 33 | 34 | -------------------------------------------------------------------------------- /servers/HEA_paper_extract/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "HEA_extractTool": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/HEA_paper_extract", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "HEA_extractTool", 17 | "description": "extract structural data of HEA materials from searched or given publications", 18 | "author": "@Junshang Zhang", 19 | "category": "research" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/HEA_paper_extract/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HEA_extractTool", 3 | "description": "extract structural data of HEA materials from searched or given publications", 4 | "author": "@Junshang Zhang", 5 | "category": "research", 6 | "tools": ["HEA_data_extract","search_paper"] 7 | } 8 | -------------------------------------------------------------------------------- /servers/HEA_paper_extract/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "HEA_extractTool" 3 | version = "0.1.0" 4 | description = "extract structural data of HEA materials from searched or given publications" 5 | requires-python = ">=3.10" 6 | dependencies = [ 7 | "mcp", 8 | "numpy", 9 | "pandas", 10 | "arxiv", 11 | "pathlib", 12 | "requests" 13 | ] 14 | 15 | [project.scripts] 16 | example-mcp = "server:main" 17 | 18 | [build-system] 19 | requires = ["setuptools>=61.0"] 20 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /servers/HEA_predict/README.md: -------------------------------------------------------------------------------- 1 | # HEA_structure_prediction MCP Server 2 | High entropy alloy structure prediction tool 3 | ## Key Features 4 | input : a chemical formula of a type of HEA, for example 'TiCrFeNiCuAl' 5 | output : predict if a solid-solution system can be formed, and if so, predict the possible crystal structure. Example 'Yes, TiCrFeNiCuAl can form SS and its crystal structure is BCC+FCC 6 | 7 | ## Usage 8 | 9 | ```bash 10 | # Install dependencies 11 | uv sync 12 | 13 | # Run server 14 | python src/server.py --port 50001 15 | 16 | # Run with custom host 17 | python src/server.py --host localhost --port 50001 18 | 19 | # Enable debug logging 20 | python src/server.py --port 50001 --log-level DEBUG 21 | 22 | ## Structure 23 | 24 | ``` 25 | HEA_predict/ 26 | +---data # data used during prediction process 27 | | binary_Hmix.csv 28 | +---models # Predtrained RF models used in the prediction process 29 | | feats_scaler_struc.pkl 30 | | feats_scaler_type.pkl 31 | | Structure_predict_model.pkl 32 | | Type_predict_model.pkl 33 | \---src 34 | \ server.py # main server 35 | ``` -------------------------------------------------------------------------------- /servers/HEA_predict/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "HEA_predictTool": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/HEA_predict", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "HEA_predictTool", 17 | "description": "predict the crystal structure of a type of high entropy alloy", 18 | "author": "@Junshang Zhang", 19 | "category": "machine-learning" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/HEA_predict/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HEA_predictTool", 3 | "description": "predict the crystal structure of a type of high entropy alloy", 4 | "author": "@Junshang Zhang", 5 | "category": "machine-learning", 6 | "tools": ["HEA_predictor"] 7 | } 8 | -------------------------------------------------------------------------------- /servers/HEA_predict/models/Structure_predict_model.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/HEA_predict/models/Structure_predict_model.pkl -------------------------------------------------------------------------------- /servers/HEA_predict/models/Type_predict_model.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/HEA_predict/models/Type_predict_model.pkl -------------------------------------------------------------------------------- /servers/HEA_predict/models/feats_scaler_struc.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/HEA_predict/models/feats_scaler_struc.pkl -------------------------------------------------------------------------------- /servers/HEA_predict/models/feats_scaler_type.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/HEA_predict/models/feats_scaler_type.pkl -------------------------------------------------------------------------------- /servers/HEA_predict/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "HEA_predictTool" 3 | version = "0.1.0" 4 | description = "predict the crystal structure of a type of high entropy alloy" 5 | requires-python = ">=3.10" 6 | dependencies = [ 7 | "mcp", 8 | "numpy", 9 | "pandas", 10 | "mendeleev", 11 | "featurebox", 12 | "joblib" 13 | ] 14 | 15 | [tool.setuptools.packages.find] 16 | where = [] 17 | [project.scripts] 18 | example-mcp = "server:main" 19 | 20 | [build-system] 21 | requires = ["setuptools>=61.0"] 22 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /servers/ORCA_tools/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "orca_tools": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/ORCA_tools", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "orca_tools", 17 | "description": "运行 ORCA 计算。", 18 | "author": "marvcks", 19 | "category": "chemistry" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/ORCA_tools/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "orca_tools", 3 | "description": "运行 ORCA 计算。", 4 | "author": "marvcks", 5 | "category": "chemistry", 6 | "tools": ["run_orca_calculation", "retrieve_content_from_orca_output"] 7 | } 8 | -------------------------------------------------------------------------------- /servers/ORCA_tools/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "orca-mcp-server" 3 | version = "0.1.0" 4 | description = "Example AI4S MCP server demonstrating the new pattern" 5 | requires-python = ">=3.10" 6 | dependencies = [ 7 | "mcp", 8 | "fastmcp", 9 | "numpy", 10 | "scipy", 11 | "python-dotenv>=1.1.1", 12 | "rdkit>=2025.3.3", 13 | "science-agent-sdk>=0.1.8", 14 | "langchain>=0.3.27", 15 | "langchain-community>=0.3.27", 16 | "chromadb>=1.0.15", 17 | "sentence-transformers>=5.0.0", 18 | "langchain-huggingface>=0.3.1", 19 | ] 20 | 21 | [project.scripts] 22 | example-mcp = "server:main" 23 | 24 | [build-system] 25 | requires = ["setuptools>=61.0"] 26 | build-backend = "setuptools.build_meta" 27 | -------------------------------------------------------------------------------- /servers/Optimade_Server/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "OptimadeServer": { 4 | "command": "python", 5 | "args": [ 6 | "server.py" 7 | ], 8 | "env": { 9 | "MCP_TRANSPORT": "stdio" 10 | }, 11 | "metadata": { 12 | "name": "OptimadeServer", 13 | "description": "Optimade Server for materials database", 14 | "author": "@NingWang-art", 15 | "category": "materials", 16 | "transport": [ 17 | "sse", 18 | "stdio" 19 | ] 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/Optimade_Server/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OptimadeServer", 3 | "description": "Optimade Server for materials database", 4 | "author": "@NingWang-art", 5 | "category": "materials", 6 | "tools": ["fetch_structures_with_filter", "fetch_structures_with_spg", "fetch_structures_with_bandgap"] 7 | } -------------------------------------------------------------------------------- /servers/Paper_Search/README.md: -------------------------------------------------------------------------------- 1 | # Tool Name: Paper Search 2 | 3 | ## 🧠 Tool Description 4 | 5 | A scientific literature search tool that provides: 6 | - Keyword-based paper search 7 | - Paper abstract and citation information retrieval 8 | - Support for multiple academic data sources 9 | 10 | ``` 11 | ## 📖 Citation 12 | 13 | If you use this tool in your research, please cite: 14 | 15 | ```bibtex 16 | @software{paper_search, 17 | title = {Paper Search}, 18 | author = {AI4Science}, 19 | year = {2024}, 20 | url = {https://paper-search-mcp.mlops.dp.tech} 21 | } 22 | ``` 23 | ``` 24 | -------------------------------------------------------------------------------- /servers/Paper_Search/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "paper_search": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/Paper_Search", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "paper_search", 17 | "description": "Scientific literature search tool for arXiv papers", 18 | "author": "@lhhhappy", 19 | "category": "research" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/Paper_Search/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "paper_search", 3 | "description": "Scientific literature search tool for arXiv papers", 4 | "author": "@lhhhappy", 5 | "category": "research", 6 | "tools": ["search_papers", "extract_info"] 7 | } 8 | -------------------------------------------------------------------------------- /servers/Paper_Search/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "paper-search" 3 | version = "0.1.0" 4 | description = "Paper Search Service" 5 | requires-python = ">=3.10" 6 | 7 | dependencies = [ 8 | "arxiv==2.2.0", 9 | "fastapi", 10 | "uvicorn", 11 | "fastmcp" 12 | ] 13 | 14 | [build-system] 15 | requires = ["hatchling"] 16 | build-backend = "hatchling.build" 17 | 18 | [tool.hatch.build.targets.wheel] 19 | packages = ["."] -------------------------------------------------------------------------------- /servers/RDKit/README.md: -------------------------------------------------------------------------------- 1 | # RDKit Toolkit 2 | 3 | ## 描述 4 | 5 | RDKit Toolkit 是一个为 AI4S-agent-tools 项目提供基础化学信息学功能的核心工具。它基于强大的 RDKit 库,为 AI Agent 提供分子处理、描述符计算和可视化等基础能力。 6 | 7 | ## 功能特性 8 | 9 | ### 🔥 核心功能 10 | - **分子验证**: 检查 SMILES 字符串的化学有效性 11 | - **基础描述符计算**: 计算分子量、LogP、TPSA、氢键供体/受体数等 12 | - **分子指纹生成**: 生成 Morgan 指纹用于相似性分析 13 | - **子结构搜索**: 基于 SMARTS 模式的子结构匹配 14 | - **2D 可视化**: 生成 SVG 格式的分子结构图 15 | 16 | ## 安装 17 | 18 | ```bash 19 | cd servers/RDKit 20 | uv sync 21 | ``` 22 | 23 | ## 使用 24 | 25 | ### 启动服务器 26 | 27 | ```bash 28 | # 运行服务器(SSE模式) 29 | python server.py --port 50001 30 | 31 | # 运行服务器(stdio模式) 32 | MCP_TRANSPORT=stdio python server.py 33 | 34 | # 启用调试日志 35 | python server.py --log-level DEBUG 36 | ``` 37 | 38 | ### 使用 uv 运行 39 | 40 | ```bash 41 | uv run python server.py 42 | ``` 43 | 44 | ## 可用工具 45 | 46 | ### 1. validate_smiles 47 | 检查 SMILES 字符串是否化学有效。 48 | 49 | **参数:** 50 | - `smiles` (str): 要验证的 SMILES 字符串 51 | 52 | **返回:** bool - 如果有效返回 True 53 | 54 | ### 2. get_basic_properties 55 | 计算分子的基础物理化学性质。 56 | 57 | **参数:** 58 | - `smiles` (str): 分子的 SMILES 字符串 59 | 60 | **返回:** dict - 包含以下性质: 61 | - `molecular_weight`: 分子量 62 | - `logp`: 脂水分配系数 63 | - `tpsa`: 拓扑极性表面积 64 | - `hydrogen_bond_donors`: 氢键供体数 65 | - `hydrogen_bond_acceptors`: 氢键受体数 66 | 67 | ### 3. generate_fingerprint 68 | 为分子生成 Morgan 指纹。 69 | 70 | **参数:** 71 | - `smiles` (str): 分子的 SMILES 字符串 72 | - `radius` (int, 可选): 指纹半径,默认为 2 73 | - `n_bits` (int, 可选): 指纹位数,默认为 2048 74 | 75 | **返回:** list - 指纹的活跃位列表 76 | 77 | ### 4. substructure_search 78 | 使用 SMARTS 模式进行子结构搜索。 79 | 80 | **参数:** 81 | - `smiles` (str): 要搜索的分子的 SMILES 字符串 82 | - `smarts_pattern` (str): SMARTS 搜索模式 83 | 84 | **返回:** bool - 如果找到子结构返回 True 85 | 86 | ### 5. draw_molecule_svg 87 | 生成分子的 2D SVG 图像。 88 | 89 | **参数:** 90 | - `smiles` (str): 分子的 SMILES 字符串 91 | 92 | **返回:** str - SVG 格式的分子结构图 93 | 94 | ## 使用示例 95 | 96 | ```python 97 | # 验证 SMILES 98 | result = validate_smiles("CCO") # 乙醇 99 | # 返回: True 100 | 101 | # 计算基础性质 102 | properties = get_basic_properties("CCO") 103 | # 返回: { 104 | # "molecular_weight": 46.07, 105 | # "logp": -0.31, 106 | # "tpsa": 20.23, 107 | # "hydrogen_bond_donors": 1, 108 | # "hydrogen_bond_acceptors": 1 109 | # } 110 | 111 | # 生成指纹 112 | fingerprint = generate_fingerprint("CCO") 113 | # 返回: [活跃位的索引列表] 114 | 115 | # 子结构搜索 116 | has_alcohol = substructure_search("CCO", "[OH]") 117 | # 返回: True (含有羟基) 118 | 119 | # 生成分子图像 120 | svg_image = draw_molecule_svg("CCO") 121 | # 返回: SVG 格式的分子结构图 122 | ``` 123 | 124 | ## 依赖 125 | 126 | - **rdkit-pypi**: 核心化学信息学库 127 | - **fastmcp**: MCP 服务器框架 128 | - **numpy**: 数值计算支持 129 | 130 | ## 与其他工具的协同 131 | 132 | - **与 PubChem 协同**: 处理和验证从 PubChem 获取的分子结构 133 | - **与 ASKCOS 协同**: 对分子进行预处理和标准化,用于逆合成路径规划 134 | - **与 ORCA/ABACUS 协同**: 生成分子的初始结构,作为量子化学计算的输入 135 | 136 | ## 开发指南 137 | 138 | 本工具遵循 AI4S-agent-tools 的标准开发模式: 139 | 140 | 1. **模块化设计**: 每个功能都是独立的工具函数 141 | 2. **类型注解**: 所有函数都有完整的类型注解 142 | 3. **错误处理**: 适当的异常处理和错误信息 143 | 4. **文档完整**: 详细的函数文档和使用示例 144 | 145 | ## 许可证 146 | 147 | 本项目遵循 AI4S-agent-tools 项目的许可证。 -------------------------------------------------------------------------------- /servers/RDKit/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "RDKit Toolkit": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/RDKit", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "RDKit Toolkit", 17 | "description": "Provides fundamental cheminformatics capabilities like molecule handling, descriptor calculation, and visualization.", 18 | "author": "@AI4S-community", 19 | "category": "chemistry" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/RDKit/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RDKit Toolkit", 3 | "description": "Provides fundamental cheminformatics capabilities like molecule handling, descriptor calculation, and visualization.", 4 | "author": "@jiaodu1307", 5 | "category": "chemistry", 6 | "transport": ["stdio", "sse"], 7 | "tools": ["validate_smiles", "get_basic_properties", "generate_fingerprint", "substructure_search", "draw_molecule_svg"] 8 | } 9 | -------------------------------------------------------------------------------- /servers/RDKit/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "rdkit-mcp-server" 3 | version = "0.1.0" 4 | description = "A core chemistry toolkit for AI4S-agent-tools, powered by RDKit." 5 | requires-python = ">=3.10,<3.13" 6 | dependencies = [ 7 | "fastmcp", 8 | "rdkit", 9 | "numpy" 10 | ] 11 | 12 | [project.scripts] 13 | rdkit-mcp = "server:main" 14 | 15 | [build-system] 16 | requires = ["setuptools>=61.0"] 17 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /servers/Symbolic_regression/README.md: -------------------------------------------------------------------------------- 1 | # 符号回归 MCP 服务器 2 | 3 | 基于 PySR(Python 符号回归)的模型上下文协议(MCP)服务器,使用遗传编程技术从数据中发现数学表达式。 4 | 5 | ## 概述 6 | 7 | 符号回归服务器使用进化算法自动发现最能描述数据关系的数学公式。与传统回归方法不同,符号回归不仅能找到参数,还能发现数学表达式的结构。 8 | 9 | ## 功能特性 10 | 11 | - **自动公式发现**:无需假设特定形式即可找到数学表达式 12 | - **可解释模型**:生成人类可读的数学公式 13 | - **灵活的运算符**:支持各种数学运算(算术、三角函数、指数等) 14 | - **多变量支持**:处理多个输入变量 15 | - **复杂度控制**:平衡准确性与表达式简洁性 16 | 17 | ## 安装 18 | 19 | ```bash 20 | cd servers/Symbolic_regression 21 | uv sync 22 | ``` 23 | 24 | ## 使用方法 25 | 26 | ### 启动服务器 27 | 28 | ```bash 29 | python server.py --port 50001 30 | ``` 31 | 32 | ### 工具函数 33 | 34 | #### `symbolic_regression` 35 | 36 | 从 CSV 数据中发现数学表达式。 37 | 38 | **CSV 文件格式要求:** 39 | - 文件格式:标准 CSV 格式,逗号分隔 40 | - 列结构:前 n 列为输入变量(特征),最后一列为目标变量(需要预测的值) 41 | - 数据要求: 42 | - 所有数据必须为数值类型 43 | - 不能包含缺失值(NaN) 44 | - 不能包含文本或类别数据 45 | 46 | **CSV 示例:** 47 | ```csv 48 | x1,x2,x3,y 49 | 1.2,3.4,5.6,10.5 50 | 2.3,4.5,6.7,15.8 51 | 3.4,5.6,7.8,21.2 52 | ... 53 | ``` 54 | 55 | **参数:** 56 | - `csv_path` (str, 必需): CSV 文件路径 57 | 58 | - `unary_operators` (list, 必需): 表达式中使用的一元运算符列表 59 | - 可用运算符: 60 | - `"neg"`:取负 (-x) 61 | - `"square"`:平方 (x²) 62 | - `"cube"`:立方 (x³) 63 | - `"cbrt"`:立方根 (∛x) 64 | - `"inv"`:倒数 (1/x) 65 | - `"exp"`:指数 (e^x) 66 | - `"log"`:自然对数 (ln(x)) 67 | - `"sqrt"`:平方根 (√x) 68 | - `"abs"`:绝对值 (|x|) 69 | - `"sin"`:正弦 70 | - `"cos"`:余弦 71 | - `"tan"`:正切 72 | 73 | **返回值:** 74 | 包含以下内容的字典: 75 | - `best_result`:找到的最佳表达式及其复杂度和均方误差 76 | - `candidates`:按性能排序的候选表达式列表 77 | - `metadata`:回归运行的相关信息 78 | 79 | ## 示例 80 | 81 | ### 示例 1:发现物理定律 82 | 83 | 如果你有单摆实验数据(摆长和周期测量值): 84 | 85 | ```python 86 | # CSV 格式: length,period 87 | # 数据关系:T = 2π√(L/g) 88 | 89 | result = symbolic_regression( 90 | csv_path="pendulum_data.csv", 91 | unary_operators=["sqrt"] 92 | ) 93 | ``` 94 | 95 | ### 示例 2:化学动力学 96 | 97 | 对于反应速率与浓度、温度的数据: 98 | 99 | ```python 100 | # CSV 格式: concentration,temperature,rate 101 | # 可能发现阿伦尼乌斯型方程 102 | 103 | result = symbolic_regression( 104 | csv_path="reaction_data.csv", 105 | unary_operators=["exp", "log", "inv"] 106 | ) 107 | ``` 108 | 109 | ### 示例 3:工程关系 110 | 111 | 对于材料的应力-应变数据: 112 | 113 | ```python 114 | # CSV 格式: strain,stress 115 | # 可能发现多项式或幂律关系 116 | 117 | result = symbolic_regression( 118 | csv_path="material_data.csv", 119 | unary_operators=["square", "cube", "sqrt"] 120 | ) 121 | ``` 122 | 123 | ## 输出结果 124 | 125 | 结果保存到: 126 | - `output/best.txt`:包含复杂度、均方误差和表达式的制表符分隔文件 127 | - `results.json`:包含所有候选项和元数据的详细 JSON 输出 128 | 129 | ## 技术细节 130 | 131 | - 使用 PySR(Python 符号回归)后端 132 | - 二元运算符:+、-、*、/ 133 | - 最大表达式复杂度:20 134 | - 种群大小:50 135 | - 迭代次数:1000 136 | - 启用多核处理(10 个进程) 137 | - 应用表达式简化和格式化 138 | 139 | ## 限制 140 | 141 | - 仅支持数值数据 142 | - 不能处理缺失值 143 | - 表达式限制在指定的复杂度范围内 144 | - 性能取决于数据质量和噪声水平 145 | 146 | ## 使用场景 147 | 148 | 1. **科学发现**:从实验数据中找到定律和关系 149 | 2. **工程设计**:推导系统行为的经验公式 150 | 3. **数据分析**:创建可解释的预测模型 -------------------------------------------------------------------------------- /servers/Symbolic_regression/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "PYSR-Symbolic-Regression": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/Symbolic_regression", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "PYSR-Symbolic-Regression", 17 | "description": "PYSR-Symbolic-Regression", 18 | "author": "@lhhhappy", 19 | "category": "physics" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/Symbolic_regression/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PYSR-Symbolic-Regression", 3 | "description": "PYSR-Symbolic-Regression", 4 | "author": "@lhhhappy", 5 | "category": "physics", 6 | "tools": ["symbolic_regression"] 7 | } 8 | 9 | -------------------------------------------------------------------------------- /servers/Symbolic_regression/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "symbolic-regression-mcp-server" 3 | version = "0.1.0" 4 | description = "Symbolic Regression MCP server for discovering mathematical expressions from data" 5 | requires-python = ">=3.11" 6 | dependencies = [ 7 | "mcp", 8 | "fastmcp", 9 | "numpy", 10 | "scipy", 11 | "pandas", 12 | "pysr", 13 | "sympy", 14 | "pandas", 15 | "scipy" 16 | ] 17 | 18 | [project.scripts] 19 | symbolic-regression-mcp = "server:main" 20 | 21 | [build-system] 22 | requires = ["setuptools>=61.0"] 23 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /servers/_example/README.md: -------------------------------------------------------------------------------- 1 | # Example MCP Server 2 | 3 | This is an example server demonstrating the minimal pattern for creating AI4S MCP tools. 4 | 5 | ## Key Features 6 | 7 | 1. **Direct FastMCP usage**: No decorators or abstractions needed 8 | 2. **Standard argument parsing**: Consistent CLI interface across all tools 9 | 3. **Metadata-driven**: Simple JSON file for tool information 10 | 4. **Focus on simplicity**: Write your scientific tools, not boilerplate 11 | 12 | ## Usage 13 | 14 | ```bash 15 | # Install dependencies 16 | uv sync 17 | 18 | # Run server 19 | python server.py --port 50001 20 | 21 | # Run with custom host 22 | python server.py --host localhost --port 50001 23 | 24 | # Enable debug logging 25 | python server.py --port 50001 --log-level DEBUG 26 | ``` 27 | 28 | ## Creating Your Own Server 29 | 30 | 1. Copy this example server as a template 31 | 2. Update `metadata.json` with your tool's information 32 | 3. Implement your scientific functions with `@mcp.tool()` 33 | 4. Add dependencies to `pyproject.toml` 34 | 5. Run and test your server 35 | 36 | ## Structure 37 | 38 | ``` 39 | your_tool/ 40 | ├── server.py # Main server implementation 41 | ├── metadata.json # Tool metadata for registry 42 | ├── pyproject.toml # Python dependencies 43 | └── README.md # Tool documentation (optional) 44 | ``` 45 | 46 | ## Code Pattern 47 | 48 | ```python 49 | from fastmcp import FastMCP 50 | import argparse 51 | 52 | def parse_args(): 53 | parser = argparse.ArgumentParser(description="Your tool description") 54 | parser.add_argument("--port", type=int, default=50001) 55 | parser.add_argument("--host", type=str, default="0.0.0.0") 56 | parser.add_argument("--log-level", type=str, default="INFO") 57 | return parser.parse_args() 58 | 59 | args = parse_args() 60 | mcp = FastMCP("your-tool", host=args.host, port=args.port) 61 | 62 | @mcp.tool() 63 | def your_function(param: str) -> dict: 64 | """Your function documentation.""" 65 | # Your implementation 66 | return {"result": "value"} 67 | 68 | if __name__ == "__main__": 69 | mcp.run(transport="sse") 70 | ``` 71 | 72 | ## Metadata Format 73 | 74 | ```json 75 | { 76 | "name": "YourTool", 77 | "description": "Brief description of what your tool does", 78 | "author": "@your-github-username", 79 | "category": "chemistry" 80 | } 81 | ``` 82 | 83 | Available categories: materials, chemistry, biology, physics, research, simulation, data, machine-learning -------------------------------------------------------------------------------- /servers/_example/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ExampleTool", 3 | "description": "Example AI4S tool demonstrating the minimal pattern", 4 | "author": "@example-author", 5 | "category": "general", 6 | "transport": ["sse", "stdio"], 7 | "tools": ["example_calculation", "demo_function"] 8 | } 9 | -------------------------------------------------------------------------------- /servers/_example/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "example-mcp-server" 3 | version = "0.1.0" 4 | description = "Example AI4S MCP server demonstrating the new pattern" 5 | requires-python = ">=3.10" 6 | dependencies = [ 7 | "mcp", 8 | "fastmcp", 9 | "numpy", 10 | "scipy" 11 | ] 12 | 13 | [project.scripts] 14 | example-mcp = "server:main" 15 | 16 | [build-system] 17 | requires = ["setuptools>=61.0"] 18 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /servers/_example/server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | Example MCP Server using the new simplified pattern. 4 | This demonstrates how to create a new AI4S tool with tools defined at module level. 5 | """ 6 | import argparse 7 | import os 8 | 9 | from mcp.server.fastmcp import FastMCP 10 | 11 | def parse_args(): 12 | """Parse command line arguments for MCP server.""" 13 | parser = argparse.ArgumentParser(description="MCP Server") 14 | parser.add_argument('--port', type=int, default=50001, help='Server port (default: 50001)') 15 | parser.add_argument('--host', default='0.0.0.0', help='Server host (default: 0.0.0.0)') 16 | parser.add_argument('--log-level', default='INFO', 17 | choices=['DEBUG', 'INFO', 'WARNING', 'ERROR'], 18 | help='Logging level (default: INFO)') 19 | try: 20 | args = parser.parse_args() 21 | except SystemExit: 22 | class Args: 23 | port = 50001 24 | host = '0.0.0.0' 25 | log_level = 'INFO' 26 | args = Args() 27 | return args 28 | 29 | 30 | args = parse_args() 31 | mcp = FastMCP("example",host=args.host,port=args.port) 32 | 33 | # Define tools at module level 34 | @mcp.tool() 35 | def example_calculation(x: float, y: float) -> dict: 36 | """ 37 | Perform an example calculation. 38 | 39 | Args: 40 | x: First number 41 | y: Second number 42 | 43 | Returns: 44 | Dictionary with sum, product, and ratio 45 | """ 46 | return { 47 | "sum": x + y, 48 | "product": x * y, 49 | "ratio": x / y if y != 0 else "undefined" 50 | } 51 | 52 | @mcp.tool() 53 | def demo_function(message: str) -> str: 54 | """ 55 | A demo function that echoes the input message. 56 | 57 | Args: 58 | message: The message to echo 59 | 60 | Returns: 61 | The echoed message with a prefix 62 | """ 63 | return f"Echo: {message}" 64 | 65 | 66 | if __name__ == "__main__": 67 | # Get transport type from environment variable, default to SSE 68 | transport_type = os.getenv('MCP_TRANSPORT', 'sse') 69 | mcp.run(transport=transport_type) -------------------------------------------------------------------------------- /servers/bio-agents-mcp/.env.docker: -------------------------------------------------------------------------------- 1 | OLLAMA_HOST=ollama 2 | OLLAMA_PORT=11434 3 | PDB_MCP_HOST=pdb_server 4 | PDB_MCP_PORT=8080 5 | CHEMBL_MCP_HOST=chembl_server 6 | CHEMBL_MCP_PORT=8081 7 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 120 3 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/.gitignore: -------------------------------------------------------------------------------- 1 | # Python-generated files 2 | __pycache__/ 3 | *.py[oc] 4 | build/ 5 | dist/ 6 | wheels/ 7 | *.egg-info 8 | .chainlit 9 | 10 | # Virtual environments 11 | .venv 12 | .env 13 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v5.0.0 4 | hooks: 5 | - id: trailing-whitespace 6 | - id: end-of-file-fixer 7 | - id: check-yaml 8 | - id: check-json 9 | - repo: https://github.com/pycqa/flake8 10 | rev: 7.1.1 11 | hooks: 12 | - id: flake8 13 | args: [--max-line-length=120] 14 | - repo: https://github.com/compilerla/conventional-pre-commit 15 | rev: 'v4.0.0' 16 | hooks: 17 | - id: conventional-pre-commit 18 | stages: [commit-msg] 19 | args: [] 20 | - repo: https://github.com/pre-commit/mirrors-autopep8 21 | rev: v1.5.7 22 | hooks: 23 | - id: autopep8 24 | - repo: https://github.com/charliermarsh/ruff-pre-commit 25 | rev: v0.9.5 26 | hooks: 27 | - id: ruff 28 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/Makefile: -------------------------------------------------------------------------------- 1 | DOCKER_COMPOSE_FILE=docker-compose.yml 2 | 3 | .PHONY: all 4 | all: help 5 | 6 | .PHONY: help 7 | help: 8 | @echo "Available targets:" 9 | @echo " setup-env - Set up the initial environment" 10 | @echo " build - Build all Docker images" 11 | @echo " up - Start all services using docker-compose" 12 | @echo " down - Stop all services using docker-compose" 13 | @echo " restart - Restart all services using docker-compose" 14 | @echo " run-chainlit - Run the Chainlit UI for the LLM client" 15 | @echo " run-client - Run the LLM client in terminal mode" 16 | 17 | .PHONY: setup-env 18 | setup-env: 19 | @echo "Setting up the initial environment..." 20 | uv sync --frozen --no-install-project --no-dev 21 | 22 | .PHONY: build 23 | build: 24 | @echo "Building all Docker images..." 25 | docker compose build 26 | 27 | .PHONY: up 28 | up: 29 | @echo "Starting all services..." 30 | docker compose up -d 31 | 32 | .PHONY: down 33 | down: 34 | @echo "Stopping all services..." 35 | docker compose down 36 | 37 | .PHONY: restart 38 | restart: down up 39 | 40 | .PHONY: run-chainlit 41 | run-chainlit: 42 | @echo "Starting Chainlit UI..." 43 | cd llm_client && chainlit run chainlit_ui.py 44 | 45 | .PHONY: run-client 46 | run-client: 47 | @echo "Starting LLM client in terminal mode..." 48 | cd llm_client && python client.py 49 | 50 | .PHONY: targets 51 | test: 52 | pytest 53 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/chembl_mcp/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use a Python image with uv pre-installed 2 | FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim 3 | 4 | WORKDIR /app 5 | 6 | ENV UV_COMPILE_BYTECODE=1 7 | 8 | ENV UV_LINK_MODE=copy 9 | 10 | RUN --mount=type=cache,target=/root/.cache/uv \ 11 | --mount=type=bind,source=uv.lock,target=uv.lock \ 12 | --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ 13 | uv sync --frozen --no-install-project --no-dev 14 | 15 | ADD . /app 16 | RUN --mount=type=cache,target=/root/.cache/uv \ 17 | uv sync --frozen --no-dev --no-editable 18 | 19 | ENV PATH="/app/.venv/bin:$PATH" 20 | 21 | EXPOSE 8081 22 | 23 | # Reset the entrypoint, don't invoke `uv` 24 | ENTRYPOINT ["python", "src/chembl_mcp/main.py"] 25 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/chembl_mcp/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "chembl_mcp" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | requires-python = ">=3.12" 7 | dependencies = [ 8 | "aiohttp>=3.11.12", 9 | "httpx>=0.28.1", 10 | "mcp>=1.1.2", 11 | "hydra-core>=1.2.0", 12 | "python-dotenv>=1.0.1", 13 | "chembl-webresource-client>=0.10.9", 14 | ] 15 | 16 | [build-system] 17 | requires = [ "hatchling",] 18 | build-backend = "hatchling.build" 19 | 20 | [tool.hatch.build.target.sdist.force-include] 21 | "server.py" = "src/chembl_mcp/server.py" 22 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/chembl_mcp/src/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/bio-agents-mcp/chembl_mcp/src/__init__.py -------------------------------------------------------------------------------- /servers/bio-agents-mcp/chembl_mcp/src/chembl_mcp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/bio-agents-mcp/chembl_mcp/src/chembl_mcp/__init__.py -------------------------------------------------------------------------------- /servers/bio-agents-mcp/chembl_mcp/src/chembl_mcp/constants.py: -------------------------------------------------------------------------------- 1 | MCP_SERVER_PORT = 8081 2 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/chembl_mcp/src/chembl_mcp/main.py: -------------------------------------------------------------------------------- 1 | from chembl_mcp.server import mcp_server 2 | 3 | if __name__ == "__main__": 4 | mcp_server.run(transport="sse") 5 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/chembl_mcp/src/chembl_mcp/molecules.py: -------------------------------------------------------------------------------- 1 | import json 2 | from mcp import types 3 | from typing import List, Optional 4 | from chembl_webresource_client.new_client import new_client 5 | 6 | CLIENT = new_client.molecule 7 | 8 | 9 | def get_molecule_pref_name( 10 | prefix_name: str, 11 | fields: Optional[List[str]] = None, 12 | ) -> types.TextContent: 13 | global CLIENT 14 | molecules = CLIENT.filter(pref_name__iexact=prefix_name) 15 | if fields: 16 | molecules = molecules.only(fields) 17 | 18 | return json.dumps(molecules, indent=2) 19 | 20 | 21 | def get_molecule_synonyms( 22 | synonym: str, 23 | fields: Optional[List[str]] = None, 24 | ) -> types.TextContent: 25 | global CLIENT 26 | molecules = CLIENT.filter( 27 | molecule_synonyms__molecule_synonym_iexact=synonym) 28 | if fields: 29 | molecules = molecules.only(fields) 30 | 31 | return json.dumps(molecules, indent=2) 32 | 33 | 34 | def get_molecule_chembl_id( 35 | chembl_id: str | List[str], 36 | fields: Optional[List[str]] = None, 37 | ) -> types.TextContent: 38 | global CLIENT 39 | if isinstance(chembl_id, str): 40 | chembl_id = [chembl_id] 41 | 42 | molecule = CLIENT.filter(molecule_chembl_id__in=chembl_id) 43 | 44 | if fields: 45 | molecule = molecule.only(fields) 46 | 47 | return json.dumps(molecule, indent=2) 48 | 49 | 50 | def get_molecule_standard_inchi_key( 51 | standard_inchi_key: str, 52 | fields: Optional[List[str]] = None, 53 | ) -> types.TextContent: 54 | global CLIENT 55 | molecule = CLIENT.filter( 56 | molecule_structures__standard_inchi_key=standard_inchi_key) 57 | 58 | if fields: 59 | molecule = molecule.only(fields) 60 | 61 | return json.dumps(molecule, indent=2) 62 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/chembl_mcp/src/chembl_mcp/server.py: -------------------------------------------------------------------------------- 1 | import os 2 | import logging 3 | from dotenv import load_dotenv, find_dotenv 4 | 5 | from mcp.server import FastMCP 6 | 7 | load_dotenv(find_dotenv()) 8 | 9 | logger = logging.getLogger(__name__) 10 | logging.basicConfig(level=logging.INFO) 11 | 12 | mcp_server = FastMCP(os.environ["CHEMBL_MCP_HOST"], 13 | port=os.environ["CHEMBL_MCP_PORT"]) 14 | 15 | tools = [ 16 | ] 17 | 18 | for tool in tools: 19 | mcp_server.tool()(tool) 20 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | pdb-server: 3 | build: 4 | context: ./protein_data_bank_mcp 5 | dockerfile: Dockerfile 6 | env_file: 7 | - .env.docker 8 | ports: 9 | - "8080:8080" 10 | chembl-server: 11 | build: 12 | context: ./chembl_mcp 13 | dockerfile: Dockerfile 14 | env_file: 15 | - .env.docker 16 | ports: 17 | - "8081:8081" 18 | 19 | ollama: 20 | image: ollama/ollama:latest 21 | runtime: nvidia 22 | env_file: 23 | - .env.docker 24 | environment: 25 | - OLLAMA_MODELS=/.ollama/models 26 | expose: 27 | - "11434" 28 | deploy: 29 | resources: 30 | reservations: 31 | devices: 32 | - driver: nvidia 33 | count: 1 34 | capabilities: [gpu] 35 | volumes: 36 | - ollama_models:/.ollama 37 | 38 | llm-client: 39 | build: 40 | context: ./llm_client 41 | dockerfile: Dockerfile 42 | env_file: 43 | - .env 44 | ports: 45 | - "8000:8000" 46 | depends_on: 47 | - ollama 48 | - pdb-server 49 | - chembl-server 50 | environment: 51 | - OLLAMA_HOST=ollama 52 | - PDB_MCP_HOST=pdb-server 53 | - CHEMBL_MCP_HOST=chembl-server 54 | 55 | volumes: 56 | ollama_models: 57 | driver: local 58 | driver_opts: 59 | type: none 60 | device: /usr/share/ollama/.ollama 61 | o: bind 62 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/llm_client/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use a Python image with uv pre-installed 2 | FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim 3 | 4 | WORKDIR /app 5 | 6 | ENV UV_COMPILE_BYTECODE=1 7 | 8 | ENV UV_LINK_MODE=copy 9 | 10 | RUN --mount=type=cache,target=/root/.cache/uv \ 11 | --mount=type=bind,source=uv.lock,target=uv.lock \ 12 | --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ 13 | uv sync --frozen --no-install-project --no-dev 14 | 15 | ADD . /app 16 | RUN --mount=type=cache,target=/root/.cache/uv \ 17 | uv sync --frozen --no-dev 18 | 19 | ENV PATH="/app/.venv/bin:$PATH" 20 | 21 | # Expose the Chainlit port 22 | EXPOSE 8000 23 | 24 | # Run Chainlit instead of the terminal client 25 | CMD ["chainlit", "run", "chainlit_ui.py", "--host", "0.0.0.0", "--port", "8000"] 26 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/llm_client/README.md: -------------------------------------------------------------------------------- 1 | # LLM Client for Biological Data 2 | 3 | A natural language interface for querying biological and chemical data through PDB and ChEMBL databases. 4 | 5 | ## Features 6 | 7 | - Natural language queries to structured biological data 8 | - Integration with PDB and ChEMBL through MCP protocol 9 | - Two interface options: 10 | - Modern web UI (Chainlit) 11 | - Terminal-based interface 12 | 13 | ## Prerequisites 14 | 15 | - Python 3.11+ 16 | - Docker and Docker Compose 17 | - NVIDIA GPU (recommended) for Ollama 18 | 19 | ## Quick Start 20 | 21 | 1. Set environment variables in `.env`: 22 | ```bash 23 | OLLAMA_HOST=localhost 24 | OLLAMA_PORT=11435 25 | PDB_MCP_HOST=localhost 26 | PDB_MCP_PORT=8080 27 | CHEMBL_MCP_HOST=localhost 28 | CHEMBL_MCP_PORT=8081 29 | ``` 30 | 31 | 2. Install dependencies: 32 | ```bash 33 | uv sync 34 | ``` 35 | 36 | 3. Start the services: 37 | ```bash 38 | docker compose up -d 39 | ``` 40 | 41 | ## Usage 42 | 43 | ### Web Interface 44 | 45 | Start the Chainlit UI: 46 | ```bash 47 | make run-chainlit 48 | ``` 49 | Then open http://localhost:8000 in your browser 50 | 51 | ### Terminal Interface 52 | 53 | Run the command-line interface: 54 | ```bash 55 | make run-client 56 | ``` 57 | 58 | ## Configuration 59 | 60 | Edit `conf/config.yaml` to configure: 61 | - LLM model settings 62 | - MCP server connections 63 | - Tool configurations 64 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/llm_client/chainlit.md: -------------------------------------------------------------------------------- 1 | # Welcome to Chainlit! 🚀🤖 2 | 3 | Hi there, Developer! 👋 We're excited to have you on board. Chainlit is a powerful tool designed to help you prototype, debug and share applications built on top of LLMs. 4 | 5 | ## Useful Links 🔗 6 | 7 | - **Documentation:** Get started with our comprehensive [Chainlit Documentation](https://docs.chainlit.io) 📚 8 | - **Discord Community:** Join our friendly [Chainlit Discord](https://discord.gg/k73SQ3FyUh) to ask questions, share your projects, and connect with other developers! 💬 9 | 10 | We can't wait to see what you create with Chainlit! Happy coding! 💻😊 11 | 12 | ## Welcome screen 13 | 14 | To modify the welcome screen, edit the `chainlit.md` file at the root of your project. If you do not want a welcome screen, just leave this file empty. 15 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/llm_client/chainlit.yaml: -------------------------------------------------------------------------------- 1 | # Welcome message to be displayed at the start 2 | welcome_message: | 3 | 👋 Welcome to the Biological Data Assistant! 4 | 5 | I can help you query information about: 6 | - Protein structures and assemblies from PDB 7 | - Chemical compounds and drug data 8 | - Biological annotations from UniProt and DrugBank 9 | 10 | # Chat interface settings 11 | chat: 12 | # Default temperature for the model 13 | temperature: 0.7 14 | 15 | # Enable/disable message history 16 | history: true 17 | 18 | # UI customization 19 | ui: 20 | # Name displayed in the interface 21 | name: Bio-Agents Assistant 22 | 23 | # Description shown in the interface 24 | description: Query biological and chemical data using natural language 25 | 26 | # Theme and appearance 27 | theme: light 28 | 29 | # Logo/avatar settings 30 | avatar: assets/dna-solid.svg 31 | 32 | # API settings 33 | server: 34 | # Enable/disable API authentication 35 | api_auth: false 36 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/llm_client/chainlit_ui.py: -------------------------------------------------------------------------------- 1 | import chainlit as cl 2 | import logging 3 | 4 | from dotenv import find_dotenv, load_dotenv 5 | from hydra import compose, initialize 6 | from client import OllamaClient, MCPClient 7 | 8 | logger = logging.getLogger(__name__) 9 | logging.basicConfig(level=logging.INFO) 10 | 11 | # Load environment variables from .env file 12 | load_dotenv(find_dotenv()) 13 | initialize(config_path="conf") 14 | cfg = compose(config_name="config") 15 | 16 | llm = OllamaClient(model=cfg.ollama.model, base_url=cfg.ollama.base_url) 17 | client = MCPClient(llm) 18 | 19 | 20 | @cl.set_chat_profiles 21 | async def chat_profile(current_user: cl.User): 22 | return [ 23 | cl.ChatProfile( 24 | name="Protein Structure", 25 | icon="🧬", 26 | markdown_description="Query protein structures and assemblies from PDB.", 27 | starters=[ 28 | cl.Starter( 29 | label="Structure Info", 30 | message="Can you get me the structure for 1HR7?", 31 | ), 32 | cl.Starter( 33 | label="Assembly Info", 34 | message="Can you get me the structural assembly description for 1HR7 assembly 1?", 35 | ), 36 | cl.Starter( 37 | label="Residue Chains", 38 | message="What are the residue chains in 1FAT?", 39 | ), 40 | ], 41 | ), 42 | cl.ChatProfile( 43 | name="Chemical Data", 44 | icon="⚗️", 45 | markdown_description="Query chemical compounds and drug data.", 46 | starters=[ 47 | cl.Starter( 48 | label="Chemical Component", 49 | message="Can you get me information about the chemical component NAG?", 50 | ), 51 | cl.Starter( 52 | label="DrugBank Annotations", 53 | message="What are the DrugBank annotations for ATP?", 54 | ), 55 | cl.Starter( 56 | label="Find Molecule", 57 | message="Find information about the molecule Aspirin", 58 | ), 59 | ], 60 | ), 61 | ] 62 | 63 | 64 | @cl.on_chat_start 65 | def start_chat(): 66 | cl.user_session.set( 67 | "message_history", 68 | [ 69 | { 70 | "role": "system", 71 | "content": "You are a helpful assistant that does API calls on various life science databases.", 72 | } 73 | ], 74 | ) 75 | 76 | 77 | @cl.on_message 78 | async def main(message: cl.Message): 79 | await client.connect_to_servers(cfg.mcp.servers) 80 | 81 | message_history = cl.user_session.get("message_history", []) 82 | message_history.append({"role": "user", "content": message.content}) 83 | msg = cl.Message(content="") 84 | 85 | max_history_length = 10 86 | stream = await client.process_query(message.content, history=message_history[-max_history_length:]) 87 | 88 | async for part in stream: 89 | if token := part["message"]["content"] or "": 90 | await msg.stream_token(token) 91 | 92 | message_history.append({"role": "assistant", "content": msg.content}) 93 | await msg.update() 94 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/llm_client/conf/config.yaml: -------------------------------------------------------------------------------- 1 | ollama: 2 | model: "qwen2.5:14b" 3 | base_url: "http://${oc.env:OLLAMA_HOST}:${oc.env:OLLAMA_PORT}" 4 | mcp: 5 | servers: 6 | pdb: 7 | host: ${oc.env:PDB_MCP_HOST} 8 | port: ${oc.env:PDB_MCP_PORT} 9 | # chembl: 10 | # host: ${oc.env:CHEMBL_MCP_HOST} 11 | # port: ${oc.env:CHEMBL_MCP_PORT} 12 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/llm_client/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "llm-client" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | requires-python = ">=3.11" 7 | dependencies = [ 8 | "httpx>=0.27.2", 9 | "mcp>=1.1.2", 10 | "ollama>=0.4.4", 11 | "requests>=2.32.3", 12 | "hydra-core>=1.2.0", 13 | "python-dotenv>=1.0.1", 14 | "chainlit>=2.2.1", 15 | "aiohttp>=3.11.12", 16 | ] 17 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "bio-agents-mcp": { 4 | "command": "python", 5 | "args": [ 6 | "server.py" 7 | ], 8 | "env": { 9 | "MCP_TRANSPORT": "stdio" 10 | }, 11 | "metadata": { 12 | "name": "bio-agents-mcp", 13 | "description": "A collection of microservices for natural language interaction with biological databases, including Protein Data Bank (PDB) and ChEMBL APIs", 14 | "author": "@dogeplusplus", 15 | "category": "biology", 16 | "transport": [ 17 | "sse", 18 | "stdio" 19 | ] 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/bio-agents-mcp/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bio-agents-mcp", 3 | "description": "A collection of microservices for natural language interaction with biological databases, including Protein Data Bank (PDB) and ChEMBL APIs", 4 | "author": "@dogeplusplus", 5 | "category": "biology", 6 | "transport": ["sse", "stdio"], 7 | "tools": [ 8 | "structural_assembly_description", 9 | "chemical_component", 10 | "drugbank_annotations", 11 | "polymer_entity_instance", 12 | "branched_entity_instance", 13 | "non_polymer_entity_instance", 14 | "uniprot_annotations", 15 | "branched_entity", 16 | "polymer_entity", 17 | "non_polymer_entity", 18 | "structure", 19 | "pubmed_annotations", 20 | "aggregation_group_provenance", 21 | "pdb_cluster_data_aggregation", 22 | "pdb_cluster_data_aggregation_method", 23 | "pairwise_polymeric_interface_description", 24 | "get_residue_chains" 25 | ] 26 | } -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use a Python image with uv pre-installed 2 | FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim 3 | 4 | WORKDIR /app 5 | 6 | ENV UV_COMPILE_BYTECODE=1 7 | 8 | ENV UV_LINK_MODE=copy 9 | 10 | RUN --mount=type=cache,target=/root/.cache/uv \ 11 | --mount=type=bind,source=uv.lock,target=uv.lock \ 12 | --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ 13 | uv sync --frozen --no-install-project --no-dev 14 | 15 | ADD . /app 16 | RUN --mount=type=cache,target=/root/.cache/uv \ 17 | uv sync --frozen --no-dev --no-editable 18 | 19 | ENV PATH="/app/.venv/bin:$PATH" 20 | 21 | EXPOSE 8080 22 | 23 | # Reset the entrypoint, don't invoke `uv` 24 | ENTRYPOINT ["python", "src/protein_data_bank_mcp/main.py"] 25 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/README.md: -------------------------------------------------------------------------------- 1 | # Protein Data Bank MCP Server 2 | 3 | Micro-service for accessing the Protein Data Bank (PDB) API through the MCP protocol. This service provides structured access to protein structures, chemical components, and related annotations from the PDB database. 4 | 5 | ## Features 6 | 7 | - Access to PDB core API endpoints 8 | - Structured data retrieval for proteins, assemblies, and chemical components 9 | - Support for annotation data from DrugBank, UniProt, and PubMed 10 | - Built on FastMCP framework with async/await support 11 | - Local PDB file storage and parsing capabilities 12 | 13 | ## Setup 14 | 15 | 1. Install dependencies: 16 | ```bash 17 | uv sync 18 | ``` 19 | 20 | 2. Configure environment variables in `.env`: 21 | ```env 22 | PDB_MCP_HOST=localhost 23 | PDB_MCP_PORT=8080 24 | ``` 25 | 26 | ## Available Tools 27 | 28 | ### Core Data 29 | - `structural_assembly_description`: Get assembly structures 30 | - `chemical_component`: Get chemical component details 31 | - `polymer_entity`: Get polymer entity information 32 | - `structure`: Get structure details 33 | 34 | ### Annotations 35 | - `drugbank_annotations`: DrugBank data for compounds 36 | - `uniprot_annotations`: UniProt protein annotations 37 | - `pubmed_annotations`: PubMed literature references 38 | 39 | ### Repository Info 40 | - `current_entry_ids`: List current PDB entries 41 | - `structure_status`: Check entry status 42 | - `unreleased_structures`: Get unreleased structure info 43 | 44 | ## Docker Usage 45 | 46 | Run with Docker Compose: 47 | ```bash 48 | docker compose up pdb-server 49 | ``` 50 | 51 | The server will be available at `http://localhost:8080`. 52 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "protein_data_bank_mcp" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | requires-python = ">=3.12" 7 | dependencies = [ 8 | "aiohttp>=3.11.12", 9 | "httpx>=0.28.1", 10 | "mcp>=1.1.2", 11 | "hydra-core>=1.2.0", 12 | "python-dotenv>=1.0.1", 13 | "biopython>=1.85", 14 | ] 15 | 16 | [build-system] 17 | requires = [ "hatchling",] 18 | build-backend = "hatchling.build" 19 | 20 | [tool.hatch.build.target.sdist.force-include] 21 | "server.py" = "src/protein_data_bank_mcp/server.py" 22 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/bio-agents-mcp/protein_data_bank_mcp/src/__init__.py -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/__init__.py -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/main.py: -------------------------------------------------------------------------------- 1 | from protein_data_bank_mcp.server import mcp_server 2 | 3 | if __name__ == "__main__": 4 | mcp_server.run(transport="sse") 5 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/pdb_store/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/pdb_store/__init__.py -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/pdb_store/storage.py: -------------------------------------------------------------------------------- 1 | import json 2 | import logging 3 | 4 | from mcp import types 5 | from typing import Dict 6 | from Bio.PDB import PDBList, PDBParser 7 | from pathlib import Path 8 | 9 | 10 | logger = logging.getLogger(__name__) 11 | logging.basicConfig(level=logging.INFO) 12 | 13 | 14 | PROTEIN_COMMON_ONE_TO_THREE = { 15 | "A": "ALA", 16 | "R": "ARG", 17 | "N": "ASN", 18 | "D": "ASP", 19 | "C": "CYS", 20 | "Q": "GLN", 21 | "E": "GLU", 22 | "G": "GLY", 23 | "H": "HIS", 24 | "I": "ILE", 25 | "L": "LEU", 26 | "K": "LYS", 27 | "M": "MET", 28 | "F": "PHE", 29 | "P": "PRO", 30 | "S": "SER", 31 | "T": "THR", 32 | "W": "TRP", 33 | "Y": "TYR", 34 | "V": "VAL", 35 | } 36 | 37 | PROTEIN_COMMON_THREE_TO_ONE = {v: k for k, v in PROTEIN_COMMON_ONE_TO_THREE.items()} 38 | 39 | 40 | class PDBStore: 41 | def __init__(self, folder: Path | str): 42 | self.folder = Path(folder) 43 | self.folder.mkdir(parents=True, exist_ok=True) 44 | self._pdb_list = PDBList() 45 | self._parser = PDBParser() 46 | 47 | def download_pdb(self, entry_id: str): 48 | self._pdb_list.retrieve_pdb_file( 49 | entry_id, pdir=self.folder, overwrite=True, file_format="pdb" 50 | ) 51 | 52 | def get_pdb(self, entry_id: str): 53 | pdb_path = self.folder / f"pdb{entry_id.lower()}.ent" 54 | if not pdb_path.exists(): 55 | self.download_pdb(entry_id) 56 | return pdb_path 57 | 58 | def get_residue_chains(self, entry_id: str) -> Dict[str, str]: 59 | path = self.get_pdb(entry_id) 60 | structure = self._parser.get_structure(entry_id, path) 61 | 62 | chains = {} 63 | for chain in structure.get_chains(): 64 | residues = "".join( 65 | [ 66 | PROTEIN_COMMON_THREE_TO_ONE.get(x.resname, "X") 67 | for x in chain.get_residues() 68 | ] 69 | ) 70 | chains[chain.id] = residues 71 | 72 | return chains 73 | 74 | 75 | parser = PDBStore("temp") 76 | 77 | 78 | def get_residue_chains(entry_id: str) -> types.TextContent: 79 | global parser 80 | return json.dumps(parser.get_residue_chains(entry_id), indent=2) 81 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | REST API modules for Protein Data Bank MCP. 3 | """ 4 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/assembly.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from mcp import types 3 | from protein_data_bank_mcp.rest_api.utils import fetch_data 4 | 5 | 6 | async def structural_assembly_description( 7 | entry_id: str, assembly_id: str 8 | ) -> List[types.TextContent]: 9 | api_suffix = f"/core/assembly/{entry_id}/{assembly_id}" 10 | result = await fetch_data(api_suffix) 11 | return result 12 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/chemical_component.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from mcp import types 3 | from protein_data_bank_mcp.rest_api.utils import fetch_data 4 | 5 | 6 | async def chemical_component(comp_id: str) -> List[types.TextContent]: 7 | api_suffix = f"/core/chemcomp/{comp_id}" 8 | result = await fetch_data(api_suffix) 9 | return result 10 | 11 | 12 | async def drugbank_annotations(comp_id: str) -> List[types.TextContent]: 13 | api_suffix = f"/core/drugbank/{comp_id}" 14 | result = await fetch_data(api_suffix) 15 | return result 16 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/constants.py: -------------------------------------------------------------------------------- 1 | PDB_API_URL = "https://data.rcsb.org/rest/v1" 2 | MCP_SERVER_PORT = 8080 3 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/entity.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from mcp import types 3 | from protein_data_bank_mcp.rest_api.utils import fetch_data 4 | 5 | 6 | async def branched_entity(entry_id: str, entity_id: str) -> List[types.TextContent]: 7 | api_suffix = f"/core/branched_entity/{entry_id}/{entity_id}" 8 | result = await fetch_data(api_suffix) 9 | return result 10 | 11 | 12 | async def non_polymer_entity(entry_id: str, entity_id: str) -> List[types.TextContent]: 13 | api_suffix = f"/core/non_polymer_entity/{entry_id}/{entity_id}" 14 | result = await fetch_data(api_suffix) 15 | return result 16 | 17 | 18 | async def polymer_entity(entry_id: str, entity_id: str) -> List[types.TextContent]: 19 | api_suffix = f"/core/polymer_entity/{entry_id}/{entity_id}" 20 | result = await fetch_data(api_suffix) 21 | return result 22 | 23 | 24 | async def uniprot_annotations(entry_id: str, entity_id: str) -> List[types.TextContent]: 25 | api_suffix = f"/core/uniprot/{entry_id}/{entity_id}" 26 | result = await fetch_data(api_suffix) 27 | return result 28 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/entity_instance.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from mcp import types 3 | from protein_data_bank_mcp.rest_api.utils import fetch_data 4 | 5 | 6 | async def branched_entity_instance( 7 | entry_id: str, asym_id: str 8 | ) -> List[types.TextContent]: 9 | api_suffix = f"/core/branched_entity_instance/{entry_id}/{asym_id}" 10 | result = await fetch_data(api_suffix) 11 | return result 12 | 13 | 14 | async def non_polymer_entity_instance( 15 | entry_id: str, asym_id: str 16 | ) -> List[types.TextContent]: 17 | api_suffix = f"/core/non_polymer_entity_instance/{entry_id}/{asym_id}" 18 | result = await fetch_data(api_suffix) 19 | return result 20 | 21 | 22 | async def polymer_entity_instance( 23 | entry_id: str, asym_id: str 24 | ) -> List[types.TextContent]: 25 | api_suffix = f"/core/polymer_entity_instance/{entry_id}/{asym_id}" 26 | result = await fetch_data(api_suffix) 27 | return result 28 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/entry.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from mcp import types 3 | from protein_data_bank_mcp.rest_api.utils import fetch_data 4 | 5 | 6 | async def structure(entry_id: str) -> List[types.TextContent]: 7 | api_suffix = f"/core/entry/{entry_id}" 8 | result = await fetch_data(api_suffix) 9 | return result 10 | 11 | 12 | async def pubmed_annotations(entry_id: str) -> List[types.TextContent]: 13 | api_suffix = f"/core/pubmed/{entry_id}" 14 | result = await fetch_data(api_suffix) 15 | return result 16 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/groups.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from mcp import types 3 | from protein_data_bank_mcp.rest_api.utils import fetch_data 4 | 5 | 6 | async def pdb_cluster_data_aggregation(group_id: str) -> List[types.TextContent]: 7 | api_suffix = f"/core/entry_groups/{group_id}" 8 | result = await fetch_data(api_suffix) 9 | return result 10 | 11 | 12 | async def aggregation_group_provenance( 13 | group_provenance_id: str, 14 | ) -> List[types.TextContent]: 15 | api_suffix = f"/core/group_provenance/{group_provenance_id}" 16 | result = await fetch_data(api_suffix) 17 | return result 18 | 19 | 20 | async def pdb_cluster_data_aggregation_method(group_id: str) -> List[types.TextContent]: 21 | api_suffix = f"/core/polymer_entity_groups/{group_id}" 22 | result = await fetch_data(api_suffix) 23 | return result 24 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/interface.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from mcp import types 3 | from protein_data_bank_mcp.rest_api.utils import fetch_data 4 | 5 | 6 | async def pairwise_polymeric_interface_description( 7 | entry_id: str, assembly_id: str, interface_id: str 8 | ) -> List[types.TextContent]: 9 | api_suffix = f"/core/interface/{entry_id}/{assembly_id}/{interface_id}" 10 | result = await fetch_data(api_suffix) 11 | return result 12 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/repository_holdings.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from mcp import types 3 | from protein_data_bank_mcp.rest_api.utils import fetch_data 4 | 5 | 6 | async def current_entry_ids() -> List[types.TextContent]: 7 | api_suffix = "/holdings/current/entry_ids" 8 | result = await fetch_data(api_suffix) 9 | return result 10 | 11 | 12 | async def structure_status(entry_id: str) -> List[types.TextContent]: 13 | api_suffix = f"/holdings/status/{entry_id}" 14 | result = await fetch_data(api_suffix) 15 | return result 16 | 17 | 18 | async def structure_list_status(entry_ids: List[str]) -> List[types.TextContent]: 19 | api_suffix = f"/holdings/status?entry_ids={','.join(entry_ids)}" 20 | result = await fetch_data(api_suffix) 21 | return result 22 | 23 | 24 | async def removed_structure_description(entry_id: str) -> List[types.TextContent]: 25 | api_suffix = f"/holdings/removed/{entry_id}" 26 | result = await fetch_data(api_suffix) 27 | return result 28 | 29 | 30 | async def removed_entry_ids() -> List[types.TextContent]: 31 | api_suffix = "/holdings/removed/entry_ids" 32 | result = await fetch_data(api_suffix) 33 | return result 34 | 35 | 36 | async def unreleased_structures(ids: List[str]) -> List[types.TextContent]: 37 | api_suffix = f"/holdings/unreleased?ids={','.join(ids)}" 38 | result = await fetch_data(api_suffix) 39 | return result 40 | 41 | 42 | async def unreleased_structure_processing(entry_id: str) -> List[types.TextContent]: 43 | api_suffix = f"/holdings/unreleased/{entry_id}" 44 | result = await fetch_data(api_suffix) 45 | return result 46 | 47 | 48 | async def unreleased_entry_ids() -> List[types.TextContent]: 49 | api_suffix = "/holdings/unreleased/entry_ids" 50 | result = await fetch_data(api_suffix) 51 | return result 52 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/schema.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from mcp import types 3 | from protein_data_bank_mcp.rest_api.utils import fetch_data 4 | 5 | 6 | async def assembly_schema() -> List[types.TextContent]: 7 | api_suffix = "/schema/assembly" 8 | return await fetch_data(api_suffix) 9 | 10 | 11 | async def branched_entity_instance_schema() -> List[types.TextContent]: 12 | api_suffix = "/schema/branched_entity_instance" 13 | return await fetch_data(api_suffix) 14 | 15 | 16 | async def branched_entity_schema() -> List[types.TextContent]: 17 | api_suffix = "/schema/branched_entity" 18 | return await fetch_data(api_suffix) 19 | 20 | 21 | async def chem_comp_schema() -> List[types.TextContent]: 22 | api_suffix = "/schema/chem_comp" 23 | return await fetch_data(api_suffix) 24 | 25 | 26 | async def drugbank_schema() -> List[types.TextContent]: 27 | api_suffix = "/schema/drugbank" 28 | return await fetch_data(api_suffix) 29 | 30 | 31 | async def entry_schema() -> List[types.TextContent]: 32 | api_suffix = "/schema/entry" 33 | return await fetch_data(api_suffix) 34 | 35 | 36 | async def nonpolymer_entity_instance_schema() -> List[types.TextContent]: 37 | api_suffix = "/schema/nonpolymer_entity_instance" 38 | return await fetch_data(api_suffix) 39 | 40 | 41 | async def nonpolymer_entity_schema() -> List[types.TextContent]: 42 | api_suffix = "/schema/nonpolymer_entity" 43 | return await fetch_data(api_suffix) 44 | 45 | 46 | async def polymer_entity_instance_schema() -> List[types.TextContent]: 47 | api_suffix = "/schema/polymer_entity_instance" 48 | return await fetch_data(api_suffix) 49 | 50 | 51 | async def polymer_entity_schema() -> List[types.TextContent]: 52 | api_suffix = "/schema/polymer_entity" 53 | return await fetch_data(api_suffix) 54 | 55 | 56 | async def pubmed_schema() -> List[types.TextContent]: 57 | api_suffix = "/schema/pubmed" 58 | return await fetch_data(api_suffix) 59 | 60 | 61 | async def uniprot_schema() -> List[types.TextContent]: 62 | api_suffix = "/schema/uniprot" 63 | return await fetch_data(api_suffix) 64 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/rest_api/utils.py: -------------------------------------------------------------------------------- 1 | import json 2 | import logging 3 | import aiohttp 4 | from typing import List 5 | from mcp import types 6 | from protein_data_bank_mcp.rest_api.constants import PDB_API_URL 7 | 8 | logger = logging.getLogger(__name__) 9 | logging.basicConfig(level=logging.INFO) 10 | 11 | 12 | async def fetch_data(api_suffix: str) -> List[types.TextContent]: 13 | logger.info(f"Fetching data from {api_suffix}") 14 | url = f"{PDB_API_URL}{api_suffix}" 15 | async with aiohttp.ClientSession() as session: 16 | async with session.get(url) as response: 17 | response_json = await response.json() 18 | result = types.TextContent( 19 | type="text", text=json.dumps(response_json, indent=2)) 20 | return result 21 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/src/protein_data_bank_mcp/server.py: -------------------------------------------------------------------------------- 1 | import os 2 | import logging 3 | 4 | from dotenv import load_dotenv, find_dotenv 5 | from mcp.server import FastMCP 6 | from protein_data_bank_mcp.rest_api.assembly import structural_assembly_description 7 | from protein_data_bank_mcp.rest_api.chemical_component import ( 8 | chemical_component, 9 | drugbank_annotations, 10 | ) 11 | from protein_data_bank_mcp.rest_api.entity_instance import ( 12 | polymer_entity_instance, 13 | branched_entity_instance, 14 | non_polymer_entity_instance, 15 | ) 16 | from protein_data_bank_mcp.rest_api.entity import ( 17 | branched_entity, 18 | polymer_entity, 19 | non_polymer_entity, 20 | uniprot_annotations, 21 | ) 22 | from protein_data_bank_mcp.rest_api.entry import structure, pubmed_annotations 23 | from protein_data_bank_mcp.rest_api.groups import ( 24 | aggregation_group_provenance, 25 | pdb_cluster_data_aggregation, 26 | pdb_cluster_data_aggregation_method, 27 | ) 28 | from protein_data_bank_mcp.rest_api.interface import pairwise_polymeric_interface_description 29 | from protein_data_bank_mcp.pdb_store.storage import get_residue_chains 30 | 31 | logger = logging.getLogger(__name__) 32 | logging.basicConfig(level=logging.INFO) 33 | 34 | load_dotenv(find_dotenv()) 35 | 36 | mcp_server = FastMCP(os.environ["PDB_MCP_HOST"], 37 | port=os.environ["PDB_MCP_PORT"]) 38 | 39 | tools = [ 40 | structural_assembly_description, 41 | chemical_component, 42 | drugbank_annotations, 43 | polymer_entity_instance, 44 | branched_entity_instance, 45 | non_polymer_entity_instance, 46 | uniprot_annotations, 47 | branched_entity, 48 | polymer_entity, 49 | non_polymer_entity, 50 | structure, 51 | pubmed_annotations, 52 | aggregation_group_provenance, 53 | pdb_cluster_data_aggregation, 54 | pdb_cluster_data_aggregation_method, 55 | pairwise_polymeric_interface_description, 56 | get_residue_chains, 57 | ] 58 | 59 | for tool in tools: 60 | mcp_server.tool()(tool) 61 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/bio-agents-mcp/protein_data_bank_mcp/tests/__init__.py -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/tests/protein_data_bank_mcp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/bio-agents-mcp/protein_data_bank_mcp/tests/protein_data_bank_mcp/__init__.py -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/tests/protein_data_bank_mcp/pdb_store/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/bio-agents-mcp/protein_data_bank_mcp/tests/protein_data_bank_mcp/pdb_store/__init__.py -------------------------------------------------------------------------------- /servers/bio-agents-mcp/protein_data_bank_mcp/tests/protein_data_bank_mcp/pdb_store/test_pdb_storage.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from src.protein_data_bank_mcp.pdb_store.storage import PDBStore 4 | 5 | 6 | @pytest.fixture 7 | def pdb_store(tmp_path): 8 | return PDBStore(tmp_path) 9 | 10 | 11 | def test_download_pdb(pdb_store: PDBStore): 12 | entry_id = "1fat" 13 | path = pdb_store.get_pdb(entry_id) 14 | assert path.is_file() 15 | 16 | 17 | def test_get_residues(pdb_store: PDBStore): 18 | entry_id = "1fat" 19 | residues = pdb_store.get_residue_chains(entry_id) 20 | assert len(residues) == 4 21 | -------------------------------------------------------------------------------- /servers/bio-agents-mcp/server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | Protein Data Bank MCP Server 4 | A simplified wrapper for the bio-agents-mcp PDB server following AI4S-agent-tools format 5 | """ 6 | import argparse 7 | import sys 8 | import os 9 | from pathlib import Path 10 | from mcp.server.fastmcp import FastMCP 11 | 12 | # Add the protein_data_bank_mcp source to Python path 13 | sys.path.insert(0, str(Path(__file__).parent / "protein_data_bank_mcp" / "src")) 14 | 15 | # Set default environment variables if not already set 16 | os.environ.setdefault("PDB_MCP_HOST", "0.0.0.0") 17 | os.environ.setdefault("PDB_MCP_PORT", "50001") 18 | 19 | def parse_args(): 20 | parser = argparse.ArgumentParser(description="Protein Data Bank MCP Server") 21 | parser.add_argument("--port", type=int, default=50001, help="Port to listen on") 22 | parser.add_argument("--host", type=str, default="0.0.0.0", help="Host to bind to") 23 | parser.add_argument("--log-level", type=str, default="INFO", help="Logging level") 24 | return parser.parse_args() 25 | 26 | args = parse_args() 27 | 28 | # Update environment variables with command line arguments 29 | os.environ["PDB_MCP_HOST"] = args.host 30 | os.environ["PDB_MCP_PORT"] = str(args.port) 31 | 32 | # Create FastMCP instance 33 | mcp = FastMCP("protein-data-bank", host=args.host, port=args.port) 34 | 35 | # Import all tools from the original server 36 | from protein_data_bank_mcp.rest_api.assembly import structural_assembly_description 37 | from protein_data_bank_mcp.rest_api.chemical_component import ( 38 | chemical_component, 39 | drugbank_annotations, 40 | ) 41 | from protein_data_bank_mcp.rest_api.entity_instance import ( 42 | polymer_entity_instance, 43 | branched_entity_instance, 44 | non_polymer_entity_instance, 45 | ) 46 | from protein_data_bank_mcp.rest_api.entity import ( 47 | branched_entity, 48 | polymer_entity, 49 | non_polymer_entity, 50 | uniprot_annotations, 51 | ) 52 | from protein_data_bank_mcp.rest_api.entry import structure, pubmed_annotations 53 | from protein_data_bank_mcp.rest_api.groups import ( 54 | aggregation_group_provenance, 55 | pdb_cluster_data_aggregation, 56 | pdb_cluster_data_aggregation_method, 57 | ) 58 | from protein_data_bank_mcp.rest_api.interface import pairwise_polymeric_interface_description 59 | from protein_data_bank_mcp.pdb_store.storage import get_residue_chains 60 | 61 | # List of all tools 62 | tools = [ 63 | structural_assembly_description, 64 | chemical_component, 65 | drugbank_annotations, 66 | polymer_entity_instance, 67 | branched_entity_instance, 68 | non_polymer_entity_instance, 69 | uniprot_annotations, 70 | branched_entity, 71 | polymer_entity, 72 | non_polymer_entity, 73 | structure, 74 | pubmed_annotations, 75 | aggregation_group_provenance, 76 | pdb_cluster_data_aggregation, 77 | pdb_cluster_data_aggregation_method, 78 | pairwise_polymeric_interface_description, 79 | get_residue_chains, 80 | ] 81 | 82 | # Register all tools with our MCP instance 83 | for tool in tools: 84 | mcp.tool()(tool) 85 | 86 | if __name__ == "__main__": 87 | # Get transport type from environment variable, default to SSE 88 | transport_type = os.getenv('MCP_TRANSPORT', 'sse') 89 | mcp.run(transport=transport_type) -------------------------------------------------------------------------------- /servers/catalysis/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "CatalysisMCP": { 4 | "command": "python", 5 | "args": [ 6 | "server.py" 7 | ], 8 | "env": { 9 | "MCP_TRANSPORT": "stdio" 10 | }, 11 | "metadata": { 12 | "name": "CatalysisMCP", 13 | "description": "Catalysis reaction calculations based on ADSEC workflow", 14 | "author": "@Rasic2", 15 | "category": "chemistry" 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /servers/catalysis/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CatalysisMCP", 3 | "description": "Catalysis reaction calculations based on ADSEC workflow", 4 | "author": "@Rasic2", 5 | "category": "chemistry" 6 | } -------------------------------------------------------------------------------- /servers/data_analysis/.python-version: -------------------------------------------------------------------------------- 1 | 3.10 2 | -------------------------------------------------------------------------------- /servers/data_analysis/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepmodeling/AI4S-agent-tools/d381c78cc320770d6ed8bee1b2a3ccb7d414534a/servers/data_analysis/README.md -------------------------------------------------------------------------------- /servers/data_analysis/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "data_analysis": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/data_analysis", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "data_analysis", 17 | "description": "A simplified tool for data analysis", 18 | "author": "@nlz25", 19 | "category": "data" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/data_analysis/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data_analysis", 3 | "description": "A simplified tool for data analysis", 4 | "author": "@nlz25", 5 | "category": "data", 6 | "tools": [ 7 | "analyze_csv_data" 8 | ] 9 | } -------------------------------------------------------------------------------- /servers/data_analysis/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "data-analysis" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | requires-python = ">=3.10" 7 | dependencies = [ 8 | "fastmcp>=2.10.6", 9 | "numpy>=2.2.6", 10 | "pandas>=2.3.1", 11 | "scikit-learn>=1.7.1", 12 | "shap>=0.48.0", 13 | "xgboost>=3.0.2", 14 | ] 15 | -------------------------------------------------------------------------------- /servers/deepmd_docs_rag/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "deepmd_docs_rag": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/deepmd_docs_rag", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "deepmd_docs_rag", 17 | "description": "DeepMD documentation RAG server", 18 | "author": "@felix5572", 19 | "category": "materials" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/deepmd_docs_rag/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "deepmd_docs_rag", 3 | "description": "DeepMD documentation RAG server", 4 | "author": "@felix5572", 5 | "category": "materials", 6 | "tools": ["upload_single_file_to_deepmd_knowledge_base","deepmd-docs-workflow"] 7 | } -------------------------------------------------------------------------------- /servers/deepmd_docs_rag/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "deepmd-docs-rag" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | requires-python = ">=3.10" 7 | 8 | dependencies = [ 9 | "fastmcp", 10 | "requests", 11 | "python-dotenv", 12 | "httpx[socks]" 13 | ] -------------------------------------------------------------------------------- /servers/deepmd_docs_rag/server.py: -------------------------------------------------------------------------------- 1 | 2 | import sys 3 | from pathlib import Path 4 | import argparse 5 | 6 | from fastmcp import FastMCP, Client 7 | from typing import List 8 | import requests 9 | import json 10 | import os 11 | from dotenv import load_dotenv 12 | 13 | 14 | load_dotenv() 15 | FASTGPT_AUTH_TOKEN = os.getenv("FASTGPT_AUTH_TOKEN") 16 | 17 | def parse_args(): 18 | """Parse command line arguments for MCP server.""" 19 | parser = argparse.ArgumentParser(description="DeePMD Docs RAG MCP Server") 20 | parser.add_argument('--port', type=int, default=50001, help='Server port (default: 50001)') 21 | parser.add_argument('--host', default='0.0.0.0', help='Server host (default: 0.0.0.0)') 22 | parser.add_argument('--log-level', default='INFO', 23 | choices=['DEBUG', 'INFO', 'WARNING', 'ERROR'], 24 | help='Logging level (default: INFO)') 25 | try: 26 | args = parser.parse_args() 27 | except SystemExit: 28 | class Args: 29 | port = 50001 30 | host = '0.0.0.0' 31 | log_level = 'INFO' 32 | args = Args() 33 | return args 34 | 35 | args = parse_args() 36 | backend = Client("https://zqibhdki.sealosbja.site/api/mcp/app/tRmg19AXvG2GL46rZXadjsIb/mcp") 37 | mcp = FastMCP.as_proxy(backend, name="FastGPT Proxy Server", port=args.port, host=args.host) 38 | 39 | 40 | @mcp.tool() 41 | def upload_single_file_to_deepmd_knowledge_base(file_url: str): 42 | """get the file from the specified URL and upload it DeePMD-docs knowledge database. 43 | These files will be used to train the DeePMD-docs knowledge base. 44 | And future chat will use these documents to answer questions. 45 | """ 46 | 47 | API_URL = "https://api.fastgpt.in/api/core/dataset/collection/create/localFile" 48 | DATASET_ID = "683a517f292645ebd7a2cb7c" # knowledge base: deepmd-from-chat 49 | 50 | # 1. download the file from the specified URL 51 | file_name = file_url.split("/")[-1].replace(" ", "_") 52 | file_content = requests.get(file_url).content 53 | 54 | # 2. upload the file to the specified dataset 55 | response = requests.post( 56 | url=API_URL, 57 | headers={"Authorization": f"Bearer {FASTGPT_AUTH_TOKEN}"}, 58 | files={ 59 | 'file': (file_name, file_content), 60 | 'data': (None, json.dumps({"datasetId": DATASET_ID, "parentId": None, "trainingType": "chunk", "chunkSize": 512})) 61 | } 62 | ) 63 | 64 | print(f"Status: {response.status_code}, Response: {response.text}") 65 | return response 66 | 67 | if __name__ == "__main__": 68 | mcp.run(transport="sse") 69 | -------------------------------------------------------------------------------- /servers/dna_sequence_analyzer/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "dna_sequence_analyzer": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/dna_sequence_analyzer", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "dna_sequence_analyzer", 17 | "description": "DNA序列基础分析工具,包含长度统计、碱基计数、GC含量计算、反向互补序列生成和遗传密码翻译功能。支持标准遗传密码表,可选择遇到终止子停止翻译。", 18 | "author": "@lhappy", 19 | "category": "biology", 20 | "transport": [ 21 | "sse", 22 | "stdio" 23 | ] 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /servers/dna_sequence_analyzer/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dna_sequence_analyzer", 3 | "description": "DNA sequence analysis tool with length calculation, base counting, GC content, reverse complement, and translation using the standard genetic code. Option to stop at stop codons.", 4 | "author": "@lhappy", 5 | "category": "biology", 6 | "transport": [ 7 | "sse", 8 | "stdio" 9 | ], 10 | "tools": [ 11 | "analyze_dna_sequence", 12 | "reverse_complement", 13 | "translate_dna" 14 | ] 15 | } -------------------------------------------------------------------------------- /servers/dna_sequence_analyzer/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "dna_sequence_analyzer" 3 | version = "0.1.0" 4 | description = "DNA序列分析工具 - 基础分析、反向互补序列生成和遗传密码翻译" 5 | requires-python = ">=3.11" 6 | dependencies = [ 7 | "fastmcp>=2.3.0", 8 | "biopython>=1.81", 9 | "numpy>=1.21.0" 10 | ] 11 | -------------------------------------------------------------------------------- /servers/matbench_property_prediction/README.md: -------------------------------------------------------------------------------- 1 | # Matbench Property Prediction MCP Server 2 | Predict matbench properties using deep potential models, including refractive index(unitless), exfoliation energy (meV/atom), the DFT Voigt-Reuss-Hill average shear moduli in GPa, the DFT Voigt-Reuss-Hill average bulk moduli in GPa, formation energy in eV as calculated by the Materials Project, the band gap as calculated by PBE DFT from the Materials Project, heat of formation of the entire 5-atom perovskite cell in eV as calculated by RPBE GGA-DFT and frequency of the highest frequency optical phonon mode peak in units of 1/cm. If user did not mention specific matbench properties please calculate all supported matbench properties. 3 | 4 | ## Usage 5 | 6 | ```bash 7 | # Install dependencies 8 | uv sync 9 | 10 | # Run server 11 | python server.py --port 50001 12 | 13 | # Run with custom host 14 | python server.py --host localhost --port 50001 15 | 16 | # Enable debug logging 17 | python server.py --port 50001 --log-level DEBUG 18 | ``` 19 | 20 | ## Example 21 | Input : 22 | Can you give me the frequency of the highest frequency optical phonon mode peak of structures in xxx? 23 | Output : 24 | The frequency of the highest frequency optical phonon mode peak for the structure "O32Si16" is approximately 1184.08 cm⁻¹. -------------------------------------------------------------------------------- /servers/matbench_property_prediction/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "matbench_property_prediction": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/matbench_property_prediction", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "matbench_property_prediction", 17 | "description": "Predict matbench properties using deep potential models", 18 | "author": "2043899742@qq.com", 19 | "category": "materials" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/matbench_property_prediction/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "matbench_property_prediction", 3 | "description": "Predict matbench properties using deep potential models", 4 | "author": "2043899742@qq.com", 5 | "category": "materials", 6 | "tools": ["predict_matbench_properties"] 7 | } 8 | -------------------------------------------------------------------------------- /servers/matbench_property_prediction/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "matbench-property_prediciton-mcp-server" 3 | version = "0.1.0" 4 | description = "Predict matbench properties using deep potential models" 5 | requires-python = ">=3.10,<3.12" 6 | dependencies = [ 7 | "requests>=2.32.3", 8 | "flask>=3.1.1", 9 | "scipy>=1.12.0", 10 | "ase>=3.22.1", 11 | "torchaudio", 12 | "torchvision", 13 | "deepmd-kit==3.1.0", 14 | "numpy==1.26.4", 15 | "typing-extensions", 16 | "pyyaml", 17 | "science-agent-sdk" 18 | ] 19 | 20 | [project.scripts] 21 | example-mcp = "server:main" 22 | 23 | [build-system] 24 | requires = ["setuptools>=61.0"] 25 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /servers/nmrglue/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "NMRglue Toolkit": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/nmrglue", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "NMRglue Toolkit", 17 | "description": "NMR data processing and analysis toolkit using nmrglue library for reading, processing, and visualizing NMR spectroscopy data", 18 | "author": "@jiaodu1307", 19 | "category": "chemistry", 20 | "transport": [ 21 | "sse", 22 | "stdio" 23 | ] 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /servers/nmrglue/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "NMRglue Toolkit", 3 | "description": "NMR data processing and analysis toolkit using nmrglue library for reading, processing, and visualizing NMR spectroscopy data", 4 | "author": "@jiaodu1307", 5 | "category": "chemistry", 6 | "transport": ["sse", "stdio"], 7 | "tools": ["read_nmr_data", "write_nmr_data", "phase_correction", "baseline_correction", "peak_picking", "plot_spectrum", "get_spectrum_info", "apply_apodization"] 8 | } 9 | -------------------------------------------------------------------------------- /servers/nmrglue/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "nmrglue-mcp-server" 3 | version = "0.1.0" 4 | description = "NMR data processing and analysis tool using nmrglue library" 5 | requires-python = ">=3.10" 6 | dependencies = [ 7 | "mcp", 8 | "fastmcp", 9 | "numpy", 10 | "scipy", 11 | "nmrglue", 12 | "matplotlib", 13 | "pytest>=8.4.1", 14 | ] 15 | 16 | [project.scripts] 17 | nmrglue-mcp = "server:main" 18 | 19 | [build-system] 20 | requires = ["setuptools>=61.0"] 21 | build-backend = "setuptools.build_meta" 22 | -------------------------------------------------------------------------------- /servers/perovskite_literature_plot/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "perovskite_literature_plot": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/perovskite_literature_plot", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "perovskite_literature_plot", 17 | "description": "Plot perovskite literature data", 18 | "author": "Haoming Yan", 19 | "category": "data" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/perovskite_literature_plot/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "perovskite_literature_plot", 3 | "description": "Plot perovskite literature data", 4 | "author": "Haoming Yan", 5 | "category": "data", 6 | "tools": ["plot_solar_cell_structure_vs_time", "plot_structure_count_vs_time", "plot_pce_vs_time_from_excel"] 7 | } 8 | -------------------------------------------------------------------------------- /servers/perovskite_literature_plot/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "perovskite-literature-plot" 3 | version = "0.1.0" 4 | description = "MCP server for plotting perovskite solar cell literature data and trends" 5 | authors = [ 6 | {name = "Haoming Yan", email = "yanhaoming@outlook.com"} 7 | ] 8 | readme = "README.md" 9 | requires-python = ">=3.10" 10 | license = {text = "MIT"} 11 | keywords = ["perovskite", "solar-cell", "literature", "plotting", "mcp"] 12 | classifiers = [ 13 | "Development Status :: 3 - Alpha", 14 | "Intended Audience :: Science/Research", 15 | "License :: OSI Approved :: MIT License", 16 | "Programming Language :: Python :: 3", 17 | "Programming Language :: Python :: 3.10", 18 | "Programming Language :: Python :: 3.11", 19 | "Topic :: Scientific/Engineering :: Information Analysis", 20 | "Topic :: Scientific/Engineering :: Visualization", 21 | ] 22 | 23 | dependencies = [ 24 | "mcp>=1.0.0", 25 | "fastmcp>=0.1.0", 26 | "pandas>=1.5.0", 27 | "numpy>=1.21.0", 28 | "plotly>=5.0.0", 29 | "openpyxl>=3.0.0", 30 | "scipy>=1.9.0", 31 | ] 32 | 33 | [project.optional-dependencies] 34 | dev = [ 35 | "pytest>=7.0.0", 36 | "pytest-asyncio>=0.21.0", 37 | "black>=22.0.0", 38 | "isort>=5.0.0", 39 | "flake8>=5.0.0", 40 | "mypy>=1.0.0", 41 | ] 42 | 43 | [project.scripts] 44 | perovskite-plot-server = "server:main" 45 | 46 | [build-system] 47 | requires = ["hatchling"] 48 | build-backend = "hatchling.build" 49 | 50 | [tool.hatch.build.targets.wheel] 51 | packages = ["server.py"] 52 | 53 | [tool.black] 54 | line-length = 88 55 | target-version = ['py310'] 56 | include = '\.pyi?$' 57 | extend-exclude = ''' 58 | /( 59 | # directories 60 | \.eggs 61 | | \.git 62 | | \.hg 63 | | \.mypy_cache 64 | | \.tox 65 | | \.venv 66 | | build 67 | | dist 68 | )/ 69 | ''' 70 | 71 | [tool.isort] 72 | profile = "black" 73 | multi_line_output = 3 74 | line_length = 88 75 | known_first_party = ["server"] 76 | 77 | [tool.mypy] 78 | python_version = "3.10" 79 | warn_return_any = true 80 | warn_unused_configs = true 81 | disallow_untyped_defs = true 82 | disallow_incomplete_defs = true 83 | check_untyped_defs = true 84 | disallow_untyped_decorators = true 85 | no_implicit_optional = true 86 | warn_redundant_casts = true 87 | warn_unused_ignores = true 88 | warn_no_return = true 89 | warn_unreachable = true 90 | strict_equality = true 91 | 92 | [tool.pytest.ini_options] 93 | testpaths = ["tests"] 94 | python_files = ["test_*.py"] 95 | python_classes = ["Test*"] 96 | python_functions = ["test_*"] 97 | addopts = "-v --tb=short" 98 | asyncio_mode = "auto" -------------------------------------------------------------------------------- /servers/pubchem/INSTALL.md: -------------------------------------------------------------------------------- 1 | # Installation Guide for PubChem MCP Server 2 | 3 | This guide will help you set up and run the PubChem MCP Server on your system. 4 | 5 | ## Prerequisites 6 | 7 | - Python 3.8 or newer 8 | - pip (Python package manager) 9 | - [Optional] RDKit for enhanced 3D structure handling 10 | 11 | ## Installation Steps 12 | 13 | ### 1. Clone or Download the Repository 14 | 15 | ```bash 16 | git clone https://github.com/yourusername/pubchem-mcp-server.git 17 | cd pubchem-mcp-server 18 | ``` 19 | 20 | ### 2. Install Dependencies 21 | 22 | #### Basic Installation 23 | ```bash 24 | cd python_version 25 | pip install -e . 26 | ``` 27 | 28 | #### With RDKit Support (Recommended for Chemistry Applications) 29 | ```bash 30 | # Install RDKit first (optional but recommended) 31 | conda install -c conda-forge rdkit # If using Conda environment 32 | 33 | # Then install the server with RDKit support 34 | pip install -e ".[rdkit]" 35 | ``` 36 | 37 | ### 3. Run the Server 38 | 39 | #### Using the Convenience Script 40 | ```bash 41 | # From the repository root directory 42 | ./run_server.sh 43 | ``` 44 | 45 | #### Or Manually 46 | ```bash 47 | cd python_version 48 | python mcp_server.py 49 | ``` 50 | 51 | ## Integration with Claude or Other MCP-capable Models 52 | 53 | 1. Locate your MCP settings file: 54 | - Claude Desktop: `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) 55 | - Claude Dev: `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` (macOS) 56 | 57 | 2. Update the MCP settings file with the PubChem server configuration: 58 | ```json 59 | { 60 | "mcpServers": { 61 | "pubchem": { 62 | "command": "python3", 63 | "args": [ 64 | "/full/path/to/pubchem-mcp-server/python_version/mcp_server.py" 65 | ], 66 | "env": { 67 | "PYTHONUNBUFFERED": "1" 68 | }, 69 | "disabled": false, 70 | "autoApprove": [ 71 | "get_pubchem_data", 72 | "download_structure" 73 | ] 74 | } 75 | } 76 | } 77 | ``` 78 | 79 | 3. Replace `/full/path/to/` with the actual path to your repository. 80 | 81 | 4. Restart Claude or the MCP client application to load the new server. 82 | 83 | ## Verifying the Installation 84 | 85 | Once the server is registered, you can test it with Claude by asking it to use the PubChem tools: 86 | 87 | ``` 88 | Can you tell me about the chemical properties of caffeine using the PubChem database? 89 | 90 | Or 91 | 92 | Can you retrieve the 3D structure of aspirin in XYZ format? 93 | ``` 94 | 95 | ## Troubleshooting 96 | 97 | - If the server fails to start, check the log file in `~/.pubchem-mcp/pubchem_mcp_server_*.log` 98 | - Ensure Python 3.8+ is in your PATH 99 | - Make sure the server script has executable permissions: `chmod +x run_server.sh` 100 | -------------------------------------------------------------------------------- /servers/pubchem/mcp-config-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "pubchem": { 4 | "command": "python3", 5 | "args": [ 6 | "/full/path/to/pubchem-mcp-server/python_version/mcp_server.py" 7 | ], 8 | "env": { 9 | "PYTHONUNBUFFERED": "1" 10 | }, 11 | "disabled": false, 12 | "autoApprove": [ 13 | "get_pubchem_data", 14 | "download_structure" 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /servers/pubchem/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "pubchem": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/pubchem", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "pubchem", 17 | "description": "PubChem compound data retrieval", 18 | "author": "@PhelanShao", 19 | "category": "chemistry" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/pubchem/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pubchem", 3 | "description": "PubChem compound data retrieval", 4 | "author": "@PhelanShao", 5 | "category": "chemistry" 6 | } -------------------------------------------------------------------------------- /servers/pubchem/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "pubchem-mcp-server" 3 | version = "1.0.0" 4 | description = "PubChem MCP Server - Provides PubChem compound data retrieval functionality" 5 | authors = [ 6 | { name = "PubChem MCP Team" } 7 | ] 8 | readme = "README.md" 9 | requires-python = ">=3.10" 10 | dependencies = [ 11 | "requests>=2.25.0", 12 | "fastapi", 13 | "uvicorn", 14 | "fastmcp" 15 | ] 16 | 17 | [project.optional-dependencies] 18 | rdkit = ["rdkit>=2022.9.1"] 19 | 20 | [project.scripts] 21 | pubchem-mcp = "pubchem.cli:main" 22 | pubchem-mcp-server = "pubchem_mcp_server.server:main" 23 | 24 | [build-system] 25 | requires = ["setuptools>=61.0"] 26 | build-backend = "setuptools.build_meta" 27 | 28 | [tool.setuptools.packages.find] 29 | where = ["."] -------------------------------------------------------------------------------- /servers/pubchem/python_version/README.md: -------------------------------------------------------------------------------- 1 | # PubChem MCP Server - Python Implementation 2 | 3 | This directory contains the Python implementation of the PubChem MCP Server. 4 | 5 | ## Directory Structure 6 | 7 | - `mcp_server.py`: The main server script that can be directly executed 8 | - `setup.py`: Package installation script 9 | - `pubchem_mcp_server/`: Core package with modular implementation: 10 | - `__init__.py`: Package definition and version 11 | - `pubchem_api.py`: Core PubChem API interaction functions 12 | - `xyz_utils.py`: 3D structure handling and XYZ format utilities 13 | - `server.py`: MCP protocol server implementation 14 | - `cli.py`: Command-line interface 15 | - `async_processor.py`: Asynchronous request handling 16 | 17 | ## Installation 18 | 19 | ### Development Install 20 | 21 | ```bash 22 | # From this directory 23 | pip install -e . 24 | 25 | # With RDKit support (optional but recommended for better 3D structure handling) 26 | pip install -e ".[rdkit]" 27 | ``` 28 | 29 | ## Running the Server 30 | 31 | ### As a standalone MCP server 32 | 33 | ```bash 34 | # Directly run the server script 35 | python mcp_server.py 36 | 37 | # Or use the installed entry point 38 | pubchem-mcp-server 39 | ``` 40 | 41 | ### As a command-line tool 42 | 43 | If you don't need the MCP server functionality, you can use the CLI: 44 | 45 | ```bash 46 | # Query compound data 47 | pubchem-mcp query aspirin 48 | 49 | # Get 3D structure in XYZ format 50 | pubchem-mcp query aspirin --format XYZ --include-3d 51 | 52 | # Download structure file 53 | pubchem-mcp download 2244 --format sdf --output aspirin.sdf 54 | ``` 55 | 56 | ## Configuration 57 | 58 | The server is configured to cache API responses to improve performance: 59 | - In-memory cache for property data 60 | - File-based cache for 3D structures in `~/.pubchem-mcp/cache/` 61 | 62 | ## Dependencies 63 | 64 | - Required: Python 3.8+, requests 65 | - Optional: RDKit (for enhanced 3D structure generation) 66 | 67 | If RDKit is not available, the server will fall back to using a simplified SDF parser for XYZ format conversion. 68 | 69 | ## FastMCP 70 | 71 | - python pubchem-mcp-server/python_version/server.py -------------------------------------------------------------------------------- /servers/pubchem/python_version/pubchem_mcp_server/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | PubChem MCP Server - Python Implementation 3 | 4 | A Model Context Protocol (MCP) server for retrieving PubChem compound data. 5 | """ 6 | 7 | __version__ = '1.0.0' 8 | -------------------------------------------------------------------------------- /servers/pubchem/python_version/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | PubChem MCP Server Installation Script 4 | """ 5 | 6 | from setuptools import setup, find_packages 7 | 8 | setup( 9 | name="pubchem-mcp-server", 10 | version="1.0.0", 11 | description="PubChem MCP Server - Provides PubChem compound data retrieval functionality", 12 | author="PubChem MCP Team", 13 | packages=find_packages(), 14 | install_requires=[ 15 | "requests>=2.25.0", 16 | ], 17 | extras_require={ 18 | "rdkit": ["rdkit>=2022.9.1"], 19 | }, 20 | entry_points={ 21 | "console_scripts": [ 22 | "pubchem-mcp=pubchem_mcp_server.cli:main", 23 | "pubchem-mcp-server=pubchem_mcp_server.server:main", 24 | ], 25 | }, 26 | classifiers=[ 27 | "Development Status :: 4 - Beta", 28 | "Intended Audience :: Science/Research", 29 | "License :: OSI Approved :: MIT License", 30 | "Programming Language :: Python :: 3", 31 | "Programming Language :: Python :: 3.8", 32 | "Programming Language :: Python :: 3.9", 33 | "Programming Language :: Python :: 3.10", 34 | "Programming Language :: Python :: 3.11", 35 | "Topic :: Scientific/Engineering :: Chemistry", 36 | ], 37 | python_requires=">=3.8", 38 | ) 39 | -------------------------------------------------------------------------------- /servers/pubchem/run_server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 简单的启动脚本,用于运行 PubChem MCP 服务器 3 | 4 | # 获取脚本所在目录的绝对路径 5 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" 6 | 7 | # 检查 Python 是否安装 8 | if ! command -v python3 &> /dev/null; then 9 | echo "错误: 需要 Python 3 但未找到" 10 | exit 1 11 | fi 12 | 13 | # 运行服务器 14 | echo "启动 PubChem MCP 服务器..." 15 | cd "$SCRIPT_DIR/python_version" 16 | python3 mcp_server.py 17 | 18 | # 如果脚本运行到这里,说明服务器已经停止 19 | echo "PubChem MCP 服务器已停止。" 20 | -------------------------------------------------------------------------------- /servers/pubchem/server.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | from pathlib import Path 4 | 5 | import argparse 6 | from mcp.server.fastmcp import FastMCP 7 | from python_version.mcp_server import handle_tool_call 8 | 9 | def parse_args(): 10 | """Parse command line arguments for MCP server.""" 11 | parser = argparse.ArgumentParser(description="DPA Calculator MCP Server") 12 | parser.add_argument('--port', type=int, default=50001, help='Server port (default: 50001)') 13 | parser.add_argument('--host', default='0.0.0.0', help='Server host (default: 0.0.0.0)') 14 | parser.add_argument('--log-level', default='INFO', 15 | choices=['DEBUG', 'INFO', 'WARNING', 'ERROR'], 16 | help='Logging level (default: INFO)') 17 | try: 18 | args = parser.parse_args() 19 | except SystemExit: 20 | class Args: 21 | port = 50001 22 | host = '0.0.0.0' 23 | log_level = 'INFO' 24 | args = Args() 25 | return args 26 | 27 | args = parse_args() 28 | mcp = FastMCP("pubchem", host=args.host, port=args.port) 29 | 30 | @mcp.tool() 31 | def get_pubchem_data(query: str, format: str = 'JSON', include_3d: bool = False) -> str: 32 | """ 33 | Get PubChem data for a given query. 34 | """ 35 | return handle_tool_call("get_pubchem_data", {"query": query, "format": format, "include_3d": include_3d}) 36 | 37 | @mcp.tool() 38 | def download_structure(cid: str, format: str = 'sdf') -> str: 39 | """ 40 | Download a structure from PubChem. 41 | """ 42 | return handle_tool_call("download_structure", {"cid": cid, "format": format}) 43 | 44 | if __name__ == "__main__": 45 | # Get transport type from environment variable, default to SSE 46 | transport_type = os.getenv('MCP_TRANSPORT', 'sse') 47 | mcp.run(transport=transport_type) 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /servers/pymol-mcp/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /servers/pymol-mcp/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Vishnu Rajan Tejus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /servers/pymol-mcp/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "PyMOL": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/pymol-mcp", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "PyMOL", 17 | "description": "PyMOL molecular visualization and analysis tool integration", 18 | "author": "@vrtejus", 19 | "category": "chemistry", 20 | "transport": [ 21 | "sse", 22 | "stdio" 23 | ] 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /servers/pymol-mcp/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PyMOL", 3 | "description": "PyMOL molecular visualization and analysis tool integration", 4 | "author": "@vrtejus", 5 | "category": "chemistry", 6 | "transport": ["sse", "stdio"], 7 | "tools": ["parse_and_execute"] 8 | } -------------------------------------------------------------------------------- /servers/pymol-mcp/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "mcp-rosetta" 3 | version = "0.1.0" 4 | description = "A simple CLI chatbot using the Model Context Protocol (MCP)" 5 | readme = "README.md" 6 | requires-python = ">=3.10" 7 | authors = [{ name = "Edoardo Cilia" }] 8 | keywords = ["mcp", "llm", "chatbot", "cli"] 9 | license = { text = "MIT" } 10 | classifiers = [ 11 | "Development Status :: 4 - Beta", 12 | "Intended Audience :: Developers", 13 | "License :: OSI Approved :: MIT License", 14 | "Programming Language :: Python :: 3", 15 | "Programming Language :: Python :: 3.10", 16 | ] 17 | dependencies = [ 18 | "python-dotenv>=1.0.0", 19 | "requests>=2.31.0", 20 | "mcp[cli]>=1.0.0", 21 | "uvicorn>=0.32.1", 22 | "httpx>=0.28.1", 23 | ] 24 | 25 | [project.scripts] 26 | mcp-simple-chatbot = "mcp_simple_chatbot.client:main" 27 | 28 | [build-system] 29 | requires = ["hatchling"] 30 | build-backend = "hatchling.build" 31 | 32 | [tool.hatch.build.targets.wheel] 33 | packages = ["mcp_simple_chatbot"] 34 | 35 | [tool.pyright] 36 | include = ["mcp_simple_chatbot"] 37 | venvPath = "." 38 | venv = ".venv" 39 | 40 | [tool.ruff.lint] 41 | select = ["E", "F", "I"] 42 | ignore = [] 43 | 44 | [tool.ruff] 45 | line-length = 88 46 | target-version = "py310" 47 | 48 | [tool.uv] 49 | dev-dependencies = ["pyright>=1.1.379", "pytest>=8.3.3", "ruff>=0.6.9"] 50 | -------------------------------------------------------------------------------- /servers/structure_generate/README.md: -------------------------------------------------------------------------------- 1 | # Structure Generate Server 2 | 3 | ## 主要功能 4 | 5 | ### 🔧 ASE 结构构建工具 6 | 7 | 使用 Atomic Simulation Environment (ASE) 库构建各种晶体结构: 8 | 9 | - **体相晶体结构** - 构建标准晶体结构(fcc、bcc、hcp、diamond 等) 10 | - **超胞生成** - 从现有结构生成超胞 11 | - **分子结构** - 构建分子结构并放置在晶胞中 12 | - **分子晶胞添加** - 为分子结构添加适当的晶胞,特别适用于ABACUS分子计算 13 | - **表面切片** - 按指定米勒指数生成表面切片 14 | - **表面吸附** - 在表面上添加吸附分子 15 | - **界面结构** - 构建两个材料的界面结构 16 | 17 | ### 🧬 CALYPSO 结构预测 18 | 19 | 基于进化算法和粒子群优化的晶体结构预测: 20 | 21 | - **智能结构搜索** - 使用进化算法寻找稳定晶体结构 22 | - **多组分系统** - 支持复杂的多元素化合物结构预测 23 | - **自动优化** - 内置结构筛选和优化机制 24 | 25 | ### 🤖 CrystalFormer 条件生成 26 | 27 | 基于机器学习的有条件晶体结构生成: 28 | 29 | - **属性导向生成** - 根据目标物理性质生成结构 30 | - **多目标优化** - 同时满足多个性质约束 31 | - **空间群约束** - 在指定空间群下生成结构 32 | 33 | ## 支持的工具 34 | 35 | | 工具名称 | 功能描述 | 主要参数 | 36 | |---------|----------|----------| 37 | | `build_bulk_structure` | 构建体相晶体结构 | 元素、晶体结构类型、晶格参数 | 38 | | `make_supercell_structure` | 生成超胞结构 | 输入结构、超胞矩阵 | 39 | | `build_molecule_structure` | 构建分子结构 | 分子名称、晶胞参数、真空层 | 40 | | `add_cell_for_molecules` | 为分子添加晶胞 | 分子路径、晶胞矢量、真空层 | 41 | | `build_surface_slab` | 构建表面切片 | 材料、米勒指数、层数、真空层 | 42 | | `build_surface_adsorbate` | 构建表面吸附结构 | 表面、吸附分子、位置、高度 | 43 | | `build_surface_interface` | 构建界面结构 | 两个材料、堆叠轴、界面距离 | 44 | | `generate_calypso_structures` | CALYPSO 结构预测 | 元素列表、生成数量 | 45 | | `generate_crystalformer_structures` | 条件结构生成 | 目标性质、空间群、样本数 | 46 | -------------------------------------------------------------------------------- /servers/structure_generate/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "StructureGenerateServer": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/structure_generate", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "StructureGenerateServer", 17 | "description": "Generate structures with ASE, CALYPSO, and CrystalFormer", 18 | "author": "@A-LOST-WAPITI", 19 | "category": "materials" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/structure_generate/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "StructureGenerateServer", 3 | "description": "Generate structures with ASE, CALYPSO, and CrystalFormer", 4 | "author": "@A-LOST-WAPITI", 5 | "category": "materials", 6 | "tools":[ 7 | "build_bulk_structure_by_template", 8 | "build_bulk_structure_by_wyckoff", 9 | "make_supercell_structure", 10 | "build_molecule_structure_from_g2database", 11 | "build_molecule_structures_from_smiles", 12 | "add_cell_for_molecules", 13 | "build_surface_slab", 14 | "build_surface_adsorbate", 15 | "build_surface_interface", 16 | "generate_calypso_structures", 17 | "generate_crystalformer_structures" 18 | ] 19 | } -------------------------------------------------------------------------------- /servers/structure_generate/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "structure-generate" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | requires-python = ">=3.13" 7 | dependencies = [ 8 | "ase>=3.26.0", 9 | "bohr-agent-sdk>=0.1.101", 10 | "bohrium-sdk>=0.13.0", 11 | "numpy>=2.3.2", 12 | "openbabel-wheel>=3.1.1.22", 13 | "pymatgen>=2025.6.14", 14 | ] 15 | -------------------------------------------------------------------------------- /servers/superconductor/README.md: -------------------------------------------------------------------------------- 1 | # ThermoelectricMCP Server 2 | 3 | A tool to predict supercondutor related properties and screen promising supercondutors. 4 | 5 | ##Overview 6 | 7 | This MCP server could make predictions of supercondutor critical temperature. Moreover, this tool could also randomly generate structures with calypso (element-guided) and CrystalFormer (property-guided), then select on-hull structures to further with desire critical temparture 8 | 9 | ## How to cite? 10 | 11 | ```bibtex 12 | @software{SuperconductorMCP, 13 | title = {SuperconductorMCP}, 14 | author = {AI4Scient}, 15 | year = {2025} 16 | } 17 | ``` 18 | -------------------------------------------------------------------------------- /servers/superconductor/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SuperconductorServer", 3 | "description": "Superconductor critical temperature prediction", 4 | "author": "@liuyuxiang92", 5 | "category": "materials" 6 | } 7 | -------------------------------------------------------------------------------- /servers/superconductor/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "superconductor-mcp-server" 3 | version = "0.1.0" 4 | description = "Superconductor critical temperature prediction" 5 | readme = "README.md" 6 | requires-python = ">=3.12" 7 | dependencies = [ 8 | "dpdata", 9 | "numpy", 10 | "ase", 11 | "pymatgen", 12 | "deepmd-kit", 13 | "pandas", 14 | "mcp", 15 | "fastmcp" 16 | ] 17 | -------------------------------------------------------------------------------- /servers/superconductor/uv.lock: -------------------------------------------------------------------------------- 1 | version = 1 2 | revision = 2 3 | requires-python = ">=3.12" 4 | 5 | [[package]] 6 | name = "superconductor-mcp-server" 7 | version = "0.1.0" 8 | source = { virtual = "." } 9 | -------------------------------------------------------------------------------- /servers/thermoelectric/README.md: -------------------------------------------------------------------------------- 1 | # ThermoelectricMCP Server 2 | 3 | A tool to predict thermoelectric material related properties and screen promising thermoelectric materials. 4 | 5 | ##Overview 6 | 7 | This MCP server could make predictions of thermoelectric material related properties, including hse-functional bandgap, power factor, Seeback coefficient, mass of carrier, shear and bulk modulus. Moreover, this tool could also randomly generate structures with calypso (element-guided) and CrystalFormer (property-guided), then select on-hull structures to further thermoelectric performance evaluations via band gap < 0.5eV, space group number > 75, and smaller sound velocity. 8 | 9 | ## How to cite? 10 | 11 | ```bibtex 12 | @software{ThermoelectricMCP, 13 | title = {ThermoelectricMCP}, 14 | author = {AI4Scient}, 15 | year = {2025} 16 | } 17 | ``` 18 | -------------------------------------------------------------------------------- /servers/thermoelectric/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "ThermoelectricMaterialsServer": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/thermoelectric", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "ThermoelectricMaterialsServer", 17 | "description": "Thermoelectric materials screening with CALYPSO", 18 | "author": "@liuyuxiang92", 19 | "category": "materials" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /servers/thermoelectric/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ThermoelectricMaterialsServer", 3 | "description": "Thermoelectric materials screening with CALYPSO", 4 | "author": "@liuyuxiang92", 5 | "category": "materials" 6 | } -------------------------------------------------------------------------------- /servers/thermoelectric/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "thermoelectric-materials-mcp-server" 3 | version = "0.1.0" 4 | description = "Thermoelectric materials screening with CALYPSO" 5 | readme = "README.md" 6 | requires-python = ">=3.12" 7 | dependencies = [ 8 | "dpdata", 9 | "numpy", 10 | "ase", 11 | "pymatgen", 12 | "deepmd-kit", 13 | "pandas", 14 | "mcp", 15 | "fastmcp" 16 | ] 17 | -------------------------------------------------------------------------------- /servers/thermoelectric/uv.lock: -------------------------------------------------------------------------------- 1 | version = 1 2 | revision = 2 3 | requires-python = ">=3.12" 4 | 5 | [[package]] 6 | name = "thermoelectric-materials-mcp-server" 7 | version = "0.1.0" 8 | source = { virtual = "." } 9 | -------------------------------------------------------------------------------- /servers/zotero-mcp/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | dist/ 11 | build/ 12 | *.egg-info/ 13 | *.egg 14 | 15 | # Virtual environments 16 | venv/ 17 | env/ 18 | .env 19 | .venv/ 20 | 21 | # Testing 22 | .pytest_cache/ 23 | .coverage 24 | htmlcov/ 25 | 26 | # IDE specific files 27 | .idea/ 28 | .vscode/ 29 | *.swp 30 | *.swo 31 | 32 | # OS specific files 33 | .DS_Store 34 | Thumbs.db 35 | 36 | # Environment variables 37 | .env 38 | .env.local 39 | -------------------------------------------------------------------------------- /servers/zotero-mcp/Dockerfile: -------------------------------------------------------------------------------- 1 | # Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile 2 | FROM python:3.10-slim 3 | 4 | # Set working directory 5 | WORKDIR /app 6 | 7 | # Copy the project files 8 | COPY . /app 9 | 10 | # Install build dependencies and install the package 11 | RUN pip install --no-cache-dir build hatchling \ 12 | && pip install --no-cache-dir . 13 | 14 | # Start the MCP server 15 | ENTRYPOINT ["zotero-mcp", "serve", "--transport", "stdio"] 16 | -------------------------------------------------------------------------------- /servers/zotero-mcp/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Zotero MCP Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /servers/zotero-mcp/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.md 3 | include pyproject.toml 4 | include setup.py 5 | recursive-include docs *.md 6 | recursive-include tests *.py 7 | -------------------------------------------------------------------------------- /servers/zotero-mcp/mcp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcpServers": { 3 | "Zotero": { 4 | "command": "uv", 5 | "args": [ 6 | "run", 7 | "--directory", 8 | "servers/zotero-mcp", 9 | "python", 10 | "server.py" 11 | ], 12 | "env": { 13 | "MCP_TRANSPORT": "stdio" 14 | }, 15 | "metadata": { 16 | "name": "Zotero", 17 | "description": "Zotero literature management and semantic search integration for scientific research", 18 | "author": "@54yyyu", 19 | "category": "research", 20 | "transport": [ 21 | "sse", 22 | "stdio" 23 | ] 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /servers/zotero-mcp/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Zotero", 3 | "description": "Zotero literature management and semantic search integration for scientific research", 4 | "author": "@54yyyu", 5 | "category": "research", 6 | "transport": ["sse", "stdio"], 7 | "tools": [ 8 | ] 9 | } -------------------------------------------------------------------------------- /servers/zotero-mcp/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["hatchling"] 3 | build-backend = "hatchling.build" 4 | 5 | [project] 6 | name = "zotero-mcp" 7 | version = "0.1.2" 8 | authors = [ 9 | { name = "54yyyu", email = "54yyyu@github.com" }, 10 | ] 11 | description = "A Model Context Protocol server for Zotero" 12 | readme = "README.md" 13 | requires-python = ">=3.10" 14 | classifiers = [ 15 | "Programming Language :: Python :: 3", 16 | "License :: OSI Approved :: MIT License", 17 | "Operating System :: OS Independent", 18 | ] 19 | dependencies = [ 20 | "pyzotero>=1.5.0", 21 | "mcp>=1.2.0", 22 | "python-dotenv>=1.0.0", 23 | "markitdown[pdf]", 24 | "pydantic>=2.0.0", 25 | "requests>=2.28.0", 26 | "fastmcp>=2.3.0", 27 | "chromadb>=0.4.0", 28 | "sentence-transformers>=2.2.0", 29 | "openai>=1.0.0", 30 | "google-genai>=0.7.0", 31 | ] 32 | 33 | [project.optional-dependencies] 34 | dev = [ 35 | "pytest>=7.0.0", 36 | "black>=23.0.0", 37 | "isort>=5.12.0", 38 | ] 39 | 40 | [project.urls] 41 | "Homepage" = "https://github.com/54yyyu/zotero-mcp" 42 | "Bug Tracker" = "https://github.com/54yyyu/zotero-mcp/issues" 43 | 44 | [project.scripts] 45 | zotero-mcp = "zotero_mcp.cli:main" 46 | 47 | [tool.black] 48 | line-length = 88 49 | target-version = ["py310"] 50 | 51 | [tool.isort] 52 | profile = "black" 53 | -------------------------------------------------------------------------------- /servers/zotero-mcp/requirements.txt: -------------------------------------------------------------------------------- 1 | pyzotero>=1.5.0 2 | mcp>=1.2.0 3 | python-dotenv>=1.0.0 4 | markitdown 5 | pydantic>=2.0.0 6 | fastmcp>=2.3.0 -------------------------------------------------------------------------------- /servers/zotero-mcp/server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | Zotero MCP Server using the simplified pattern for AI4S-agent-tools. 4 | This server provides integration with Zotero for literature management and semantic search. 5 | """ 6 | import argparse 7 | import os 8 | import sys 9 | 10 | # Add src to path to import the actual server implementation 11 | sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src')) 12 | 13 | from zotero_mcp.server import mcp 14 | 15 | def parse_args(): 16 | """Parse command line arguments for MCP server.""" 17 | parser = argparse.ArgumentParser(description="Zotero MCP Server") 18 | parser.add_argument('--port', type=int, default=50001, help='Server port (default: 50001)') 19 | parser.add_argument('--host', default='0.0.0.0', help='Server host (default: 0.0.0.0)') 20 | parser.add_argument('--log-level', default='INFO', 21 | choices=['DEBUG', 'INFO', 'WARNING', 'ERROR'], 22 | help='Logging level (default: INFO)') 23 | try: 24 | args = parser.parse_args() 25 | except SystemExit: 26 | class Args: 27 | port = 50001 28 | host = '0.0.0.0' 29 | log_level = 'INFO' 30 | args = Args() 31 | return args 32 | 33 | if __name__ == "__main__": 34 | args = parse_args() 35 | 36 | # Get transport type from environment variable, default to SSE 37 | transport_type = os.getenv('MCP_TRANSPORT', 'sse') 38 | 39 | # Note: The mcp instance is already configured in src/zotero_mcp/server.py 40 | # We just need to run it with the appropriate transport settings 41 | if transport_type == 'stdio': 42 | mcp.run(transport='stdio') 43 | else: 44 | # For SSE and streamable-http, use host and port from args 45 | mcp.run(transport=transport_type, host=args.host, port=args.port) -------------------------------------------------------------------------------- /servers/zotero-mcp/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from setuptools import setup 5 | 6 | # This setup.py is mainly for backward compatibility with older pip versions. 7 | # For modern builds, we're using pyproject.toml and hatchling. 8 | 9 | if __name__ == "__main__": 10 | setup() 11 | -------------------------------------------------------------------------------- /servers/zotero-mcp/smithery.yaml: -------------------------------------------------------------------------------- 1 | # Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml 2 | 3 | startCommand: 4 | type: stdio 5 | configSchema: 6 | # JSON Schema defining the configuration options for the MCP. 7 | type: object 8 | required: [] 9 | properties: 10 | zoteroLocal: 11 | type: boolean 12 | default: true 13 | description: If true, use the local Zotero API. Otherwise, use web API. 14 | zoteroApiKey: 15 | type: string 16 | description: Your Zotero API key for web API usage. 17 | zoteroLibraryId: 18 | type: string 19 | description: Your Zotero Library ID for web API usage. 20 | zoteroLibraryType: 21 | type: string 22 | default: user 23 | description: Type of Zotero library (e.g., user or group). 24 | commandFunction: 25 | # A JS function that produces the CLI command based on the given config to start the MCP on stdio. 26 | |- 27 | (config)=>{const env={}; if(!config.zoteroLocal){if(config.zoteroApiKey){env.ZOTERO_API_KEY=config.zoteroApiKey;} if(config.zoteroLibraryId){env.ZOTERO_LIBRARY_ID=config.zoteroLibraryId;} if(config.zoteroLibraryType){env.ZOTERO_LIBRARY_TYPE=config.zoteroLibraryType;} } else {env.ZOTERO_LOCAL='true';} return {command:'zotero-mcp', args:['serve','--transport','stdio'], env};} 28 | exampleConfig: 29 | zoteroLocal: true 30 | -------------------------------------------------------------------------------- /servers/zotero-mcp/src/zotero_mcp/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Zotero MCP - Model Context Protocol server for Zotero 3 | 4 | This module provides tools for AI assistants to interact with Zotero libraries. 5 | """ 6 | 7 | from ._version import __version__ 8 | from .server import mcp 9 | 10 | # These modules are not imported by default but are available 11 | # pdfannots_helper and pdfannots_downloader 12 | -------------------------------------------------------------------------------- /servers/zotero-mcp/src/zotero_mcp/_version.py: -------------------------------------------------------------------------------- 1 | """Version information.""" 2 | 3 | __version__ = "0.1.2" 4 | -------------------------------------------------------------------------------- /servers/zotero-mcp/src/zotero_mcp/utils.py: -------------------------------------------------------------------------------- 1 | from typing import List, Dict 2 | import os 3 | 4 | def format_creators(creators: List[Dict[str, str]]) -> str: 5 | """ 6 | Format creator names into a string. 7 | 8 | Args: 9 | creators: List of creator objects from Zotero. 10 | 11 | Returns: 12 | Formatted string with creator names. 13 | """ 14 | names = [] 15 | for creator in creators: 16 | if "firstName" in creator and "lastName" in creator: 17 | names.append(f"{creator['lastName']}, {creator['firstName']}") 18 | elif "name" in creator: 19 | names.append(creator["name"]) 20 | return "; ".join(names) if names else "No authors listed" 21 | 22 | 23 | def is_local_mode() -> bool: 24 | """Return True if running in local mode. 25 | 26 | Local mode is enabled when environment variable `ZOTERO_LOCAL` is set to a 27 | truthy value ("true", "yes", or "1", case-insensitive). 28 | """ 29 | value = os.getenv("ZOTERO_LOCAL", "") 30 | return value.lower() in {"true", "yes", "1"} 31 | --------------------------------------------------------------------------------