Skip to main content

An MCP server for chemistry, calculations (e.g. molecular weights, isotope distributions) and a cached formula finder backed by multiple online and offline sources.

Project description

mcp-molecules

CI PyPI Python 3.10+ License: GPLv3 Sponsor Ruff Checked with mypy Last commit

Atoms and molecules for the artificial minds — trustworthy chemistry tools, computed for real and backed by authoritative data.

Atoms combine into molecules, and a language model asked about them should not have to recall facts from memory; it should compute answers it can trust. mcp-molecules is a growing toolbox for working with chemical elements and molecules — offline, deterministic, and backed by authoritative sources such as the NIST Atomic Weights and Isotopic Compositions database.

For example, it can already take a chemical formula and return its molecular weight: ask "what does C₆H₁₂O₆ weigh?" and it parses the formula, looks every element up in NIST data, and computes the molar mass rather than guessing it. More molecule-oriented tools are planned.

You can ask things like:

  • "What does a mole of glucose weigh?" — resolves the name to C₆H₁₂O₆ and computes the molar mass.
  • "How much of Fe₂(SO₄)₃'s mass is iron?" — per-element percent composition.
  • "What's the molar mass of caffeine, with uncertainty?" — propagates the NIST standard uncertainties.
  • "What does the mass spectrum of chloroform look like?" — the natural chlorine isotope pattern (the M, M+2, M+4 … peaks).
  • "What's the [M+H]⁺ m/z for caffeine?" — the protonated-ion mass.
  • "Which compound has the formula C₉H₈O₄?" — formula → name (aspirin, among its isomers).
  • "What are the isomers of C₂H₆O?" — one formula, several names (ethanol and dimethyl ether).

What it gives you

  • molecular_weight_calculator(one example of what's here today) compute the molecular weight (molar mass) of a chemical formula. Parameters:
    • formula — element symbols, integer multipliers, arbitrarily nested parentheses, and the isotope labels D (deuterium) and T (tritium). Examples: H2O, C6H12O6, Ca(OH)2, Fe2(SO4)3, ((CH3)2CH)2, D2O, Tc.
    • unitg/mol (default), kg/mol, Da, u, or kDa.
    • uncertainty — propagate the per-element NIST standard uncertainties in quadrature and report value ± sigma.
    • monoisotopic — use the most abundant isotope of each element (mass-spectrometry monoisotopic mass) instead of the standard atomic weight.
    • composition — return the per-element percent composition by mass.
  • isotope_distribution — compute the natural isotopic pattern (the peaks a mass spectrometer would see) for a formula, with each peak's mass, m/z, and relative intensity, plus the monoisotopic and average masses. Parameters:
    • formula — same syntax as molecular_weight_calculator.
    • charge0 (default) reports neutral masses; a non-zero n reports m/z for the [M+nH]/[M-nH] ion.
    • threshold — drop peaks below this percent of the base peak (default 0.1).
    • limit — maximum peaks to return, most intense first (default 10).
    • groupingunit (default) collapses to nominal integer masses; exact keeps every resolved isotopologue.
  • find_chemical_compound — look up a compound by name or molecular formula against a bundled offline database (a PubChem subset). Parameters:
    • query — a name (aspirin, acetylsalicylic acid) or a formula (H2O, C9H8O4); formulae are matched in the Hill system.
    • byauto (default) guesses name vs. formula and falls back to the other direction on a miss; name or formula pin the direction.
    • limit — maximum compounds to return for a formula lookup (isomers share a formula), preferred name first.
  • info — server availability / version / environment health check.

Install

uv tool install mcp-molecules

Register with Claude Code

claude mcp add molecules -- mcp-molecules

Development

uv sync --all-extras
uv run mcp-molecules        # run the server over stdio
uv run pytest               # tests
uv run ruff format .        # format
uv run ruff check .         # lint
uv run mypy                 # type-check

A pre-commit hook in .githooks/ auto-formats and lints staged Python files so the CI format gate can't be missed. Enable it once per clone:

git config core.hooksPath .githooks

Data

Element masses come from the NIST Atomic Weights and Isotopic Compositions database (https://physics.nist.gov/cgi-bin/Compositions/stand_alone.pl), which is in the public domain. The data is bundled in the package as mcp_molecules/data/nist_atomic_weights.json.

Sponsoring

Sponsoring this project will keep it alive. If it is useful to you, please consider sponsoring.

Credits

The idea and the inspiration came from Mátyás Mayer. The idea was excellent, the inspiration priceless.

License

GPL-3.0-or-later. See LICENSE. The bundled NIST data is public domain.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_molecules-0.2.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_molecules-0.2.0-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file mcp_molecules-0.2.0.tar.gz.

File metadata

  • Download URL: mcp_molecules-0.2.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcp_molecules-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ea79ef0874cf941f33651733c4c596ad5d75e09aa899093f8a6f55ddf512de86
MD5 6dea20935931181072cbd424d65775b0
BLAKE2b-256 73a1d80f5956461bd8f54e21a5af950c2e4de8359688d100a88bf063fd229033

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_molecules-0.2.0.tar.gz:

Publisher: release.yml on laszlopere/mcp-molecules

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_molecules-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_molecules-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcp_molecules-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33226a374f529d4707558929c4b071744991bcfe4b0e1f2ccaafb4ebde205409
MD5 db5898c1d44f5f4ccb406918dfaeaa1c
BLAKE2b-256 69643dc177955a3577b1f97efeeadec7e99ba0e823050ef7faf9c2266f9d12ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_molecules-0.2.0-py3-none-any.whl:

Publisher: release.yml on laszlopere/mcp-molecules

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page