cheminformatics_mcp_headless

cheminformatics_mcp_headless

A self-driving cheminformatics MCP server that dynamically exposes a growing library of RDKit-based molecular analysis tools (fingerprints, descriptors, substructure matching, drug-likeness filters, and more) as MCP tools, with each skill autonomously implemented and tested by an agent loop without human intervention.

Category
访问服务器

README

cheminformatics_mcp_headless

A cheminformatics MCP server whose tools are designed, implemented, tested, and published entirely by an autonomous Claude Code loop — no human in the loop once it's set running.

What this is

Two ideas combined into one project:

  1. A headless, self-driving agent loop. A single prompt (AGENT_LOOP.md) tells an agent, running non-interactively via claude -p, to do all of the following in one shot: pick a cheminformatics capability that's still missing, implement it, design a test for it, write the test, run it, iterate until it's green, and publish it — with no human approving any step. run_loop.sh drives this in a loop, one fresh process per skill, and survives Claude's usage limits by detecting the rate-limit message and backing off until it resets instead of dying.
  2. An MCP server for cheminformatics. mcp_server.py dynamically discovers every skill under skills/ and exposes it as an MCP tool — dropping a valid skill folder in is the only "publish" step; nothing needs editing to add a tool.

State lives entirely on disk (progress.md, the skills/ directory) because each loop iteration is a brand-new process with no memory of the last one.

Architecture

AGENT_LOOP.md  →  run_loop.sh  →  claude -p (one skill per run)
                                        │
                                        ▼
                              skills/<name>/{__init__.py, skill.py,
                                             test_skill.py, meta.json}
                                        │
                        pytest (skills/, tests/) validates it, including
                        against a shared standard-benchmark dataset
                        (tests/data/molecules.csv — see below)
                                        │
                                        ▼
                              mcp_server.py globs skills/*/meta.json
                              and registers each as an MCP tool

The skill contract

Every skill is a folder skills/<name>/ with exactly four files — see skills/README.md for the full contract:

  • __init__.py — empty; makes the folder a real package.
  • skill.py — a single, fully type-hinted, pure run(...) function. The MCP server introspects its signature to build the tool's JSON schema — there's no hand-written schema anywhere.
  • test_skill.py — a plain pytest module (no custom test runner).
  • meta.json — {"name", "description"} for the MCP tool listing.

Testing against a real, standard dataset

Hand-picked test SMILES are easy to unconsciously cherry-pick into looking right. Instead, every skill's test sweeps tests/dataset.py: a small (195-row), vendored fixture built from the ESOL/Delaney solubility set (MoleculeNet's standard small- molecule benchmark) — 175 real compounds plus 20 deliberately broken rows covering the three failure modes real-world SMILES data actually has: unparsable SMILES, NaN/empty fields, and structurally incomplete rows. See tests/data/build_dataset.py for provenance; the fixture is committed so tests never depend on network access.

This caught a real, systemic bug during development: Chem.MolFromSmiles("") returns a valid empty molecule rather than None, and Chem.MolFromSmiles(None) raises a raw TypeError — neither was caught by the obvious if mol is None: raise ValueError guard every skill had. Every skill now explicitly rejects blank/missing SMILES before it reaches RDKit.

Setup

git clone git@github.com:ASinanSaglam/cheminformatics_mcp_headless.git
cd cheminformatics_mcp_headless
python -m venv .venv && source .venv/bin/activate   # or conda/micromamba
pip install -r requirements.txt

Run the tests:

python -m pytest

Using the MCP server

The server speaks plain MCP-over-stdio, so any MCP-capable client can use it — Claude Code, a local-model harness, a raw mcp Python client, etc.

Claude Code: this repo's .mcp.json already has it configured:

{
  "mcpServers": {
    "chem_skills": {
      "command": "python3",
      "args": ["${CLAUDE_PROJECT_DIR}/mcp_server.py"]
    }
  }
}

${CLAUDE_PROJECT_DIR} is expanded by Claude Code to this repo's root, so it works regardless of where you cloned it. python3 must resolve (via PATH) to the environment you installed requirements.txt into — activate your venv/conda/micromamba environment before starting claude. (A shell function like some conda/micromamba activation wrappers won't work as the command value itself — Claude Code execs it directly rather than through your interactive shell — but an activated environment's PATH works fine, since that's inherited normally.)

Start (or restart) a Claude Code session in this repo, approve the new MCP server when prompted, then /mcp should show chem_skills connected.

Any other MCP client: point it at the same command/args as a stdio server; see mcp.client.stdio in the mcp Python SDK for a minimal example.

Running the loop yourself

./run_loop.sh 10   # builds up to 10 more skills, one claude -p process each

Progress and decisions are logged to progress.md and loop.log.

Current skills

  • brics_fragmentation — Break a molecule into fragments at BRICS retrosynthetic bonds (dummy-atom labeled cut points) for fragment-library/matched-pair generation.
  • canonical_tautomer — Canonicalize a molecule's tautomer using RDKit's tautomer enumeration and scoring rules, given a SMILES string.
  • crippen_logp — Calculate the Crippen-method octanol/water partition coefficient (LogP) of a molecule from its SMILES string.
  • double_bond_stereo — Find stereogenic C=C double bonds in a SMILES molecule and report each as E, Z, or unspecified, with summary counts.
  • fraction_csp3 — Compute Fsp3, the fraction of sp3-hybridized carbons, of a molecule from its SMILES string.
  • functional_group_scan — Detect common medchem functional groups (carboxylic acid, ester, amide, amines, alcohol, ether, aldehyde, ketone, nitrile, nitro, sulfonamide, halogen, aromatic ring) in a molecule via SMARTS, with match counts and atom indices.
  • lipinski_ro5 — Evaluate Lipinski's Rule of Five drug-likeness (MW, LogP, H-bond donors/acceptors, violation count) for a molecule from its SMILES string.
  • maximum_common_substructure — Find the maximum common substructure (MCS) shared by two molecules given their SMILES strings, returning it as a SMARTS pattern with atom/bond counts.
  • molecular_formula — Compute the Hill-order molecular formula (e.g. C9H8O4) of a molecule from its SMILES string.
  • molecular_weight — Compute the molecular weight (g/mol) of a molecule from its SMILES string.
  • morgan_fingerprint — Compute the Morgan (ECFP-like) circular fingerprint of a molecule as a sparse on-bit list, for similarity search, clustering, or ML feature vectors.
  • murcko_scaffold — Extract the Murcko scaffold (ring systems and linkers, side chains stripped) from a molecule's SMILES, optionally as a generic topology-only scaffold.
  • pains_filter — Screen a molecule (SMILES) against RDKit's built-in PAINS structural-alert catalog to flag known assay-interference substructures.
  • qed_score — Compute the QED (Quantitative Estimate of Drug-likeness) score and its eight constituent properties for a molecule given as SMILES.
  • ring_system_analysis — Analyze ring topology of a molecule from SMILES: ring count, sizes, aromaticity, fused ring systems, and macrocycle detection.
  • rotatable_bonds — Count rotatable bonds in a molecule (conformational flexibility descriptor; half of the Veber oral-bioavailability rule alongside TPSA).
  • smiles_to_inchi — Convert a SMILES string to InChI, InChIKey, and canonical SMILES.
  • smiles_to_molblock — Convert a SMILES string to a 2D-coordinate MDL molblock (V2000 molfile).
  • standardize_molecule — Standardize a molecule from SMILES by stripping counterions/salts (largest-fragment selection), neutralizing formal charges where possible, and returning the canonical SMILES.
  • stereocenter_analysis — Find tetrahedral stereocenters in a SMILES molecule and report each as R, S, or unassigned (?), with summary counts.
  • substructure_match — Match an arbitrary caller-supplied SMARTS substructure query against a SMILES molecule, returning every matching set of atom indices.
  • tanimoto_similarity — Compute the Tanimoto similarity between two molecules' Morgan (ECFP-like) fingerprints, given their SMILES strings.
  • tpsa_descriptor — Compute the topological polar surface area (TPSA, in Ų) of a molecule from its SMILES string.

This list grows as the loop runs; each skill's own meta.json is the source of truth if this drifts out of date.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选