An MCP server for molecular weight / molar mass calculation from chemical formulae, backed by the NIST atomic weights database.
Project description
mcp-molecules
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.
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 labelsD(deuterium) andT(tritium). Examples:H2O,C6H12O6,Ca(OH)2,Fe2(SO4)3,((CH3)2CH)2,D2O,Tc.unit—g/mol(default),kg/mol,Da,u, orkDa.uncertainty— propagate the per-element NIST standard uncertainties in quadrature and reportvalue ± 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.
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.by—auto(default) guesses name vs. formula and falls back to the other direction on a miss;nameorformulapin 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_molecules-0.1.0.tar.gz.
File metadata
- Download URL: mcp_molecules-0.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e02fa279cbaf448ef22fd569c488b0dc34acd57227aadfe741ea204a58a50fe
|
|
| MD5 |
ab11ec142fb1121eecc6ca118a21bb85
|
|
| BLAKE2b-256 |
7dc10da9e782206db2c6e86b3404d0f2698621c4b19e9c746f9f944392758ddb
|
Provenance
The following attestation bundles were made for mcp_molecules-0.1.0.tar.gz:
Publisher:
release.yml on laszlopere/mcp-molecules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_molecules-0.1.0.tar.gz -
Subject digest:
7e02fa279cbaf448ef22fd569c488b0dc34acd57227aadfe741ea204a58a50fe - Sigstore transparency entry: 1834018623
- Sigstore integration time:
-
Permalink:
laszlopere/mcp-molecules@afaaaca775120ee997fff4736734a56ba394ed9d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/laszlopere
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@afaaaca775120ee997fff4736734a56ba394ed9d -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_molecules-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_molecules-0.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
004634e2a0cb955ea9855af5ae2c9a985b2bebe3f0df5c4ce9048d45b809b94b
|
|
| MD5 |
0abd2003a0647b83851dd20e8d744d44
|
|
| BLAKE2b-256 |
d4efae4eab2cbd9b4846af6faaddf1c6e8bbb74aece09778d62a58dfd4d3f68c
|
Provenance
The following attestation bundles were made for mcp_molecules-0.1.0-py3-none-any.whl:
Publisher:
release.yml on laszlopere/mcp-molecules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_molecules-0.1.0-py3-none-any.whl -
Subject digest:
004634e2a0cb955ea9855af5ae2c9a985b2bebe3f0df5c4ce9048d45b809b94b - Sigstore transparency entry: 1834018762
- Sigstore integration time:
-
Permalink:
laszlopere/mcp-molecules@afaaaca775120ee997fff4736734a56ba394ed9d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/laszlopere
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@afaaaca775120ee997fff4736734a56ba394ed9d -
Trigger Event:
push
-
Statement type: