Skip to main content
Glama
laszlopere

mcp-molecules

by laszlopere

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. Searches a bundled offline database (a PubChem subset) and a writable user cache first, then — unless disabled — an online fallback (PubChem, Wikidata, and, when an API key is set, EPA CompTox), caching what it fetches. 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.

    The online fallback is on by default; set MCP_MOLECULES_ONLINE to a falsy value (0/false/no/off) to keep lookups fully offline. The EPA CompTox source additionally needs a free CCTE API key in MCP_MOLECULES_EPA_API_KEY; without it that source is skipped.

  • info — server availability / version / environment health check.

Related MCP server: ChemDraw Server

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.

Available Tools

4 tools
find_chemical_compoundA

Look up a chemical compound by name or molecular formula.

Searches the bundled name<->formula database (a PubChem subset) first, then the writable user cache, then -- unless disabled -- the online fallback (PubChem, Wikidata, and, when an API key is set, EPA CompTox). A name resolves to its molecular formula(e); a formula resolves to the compound name(s) sharing it (isomers), ordered with the preferred name first. The direction is chosen by by. Returns the query, how it was interpreted (interpreted_as), the normalized Hill-system canonicalization of the query whenever it parses as a formula (e.g. 'O6C6H12' -> 'C6H12O6'; null when it is not a parseable formula), the matches (each {"name", "formula"}, the preferred result first), and the resolving source / license.

Raises ValueError if nothing matches.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesCompound to look up -- either a name or a molecular formula. Names match the canonical name or any alias, case-insensitively, ignoring trailing registry annotations like '(9CI)' or '(USAN)'. Formulae are canonicalized to the Hill system, so 'C6H12O6', 'O6C6H12', and 'C₆H₁₂O₆' are equivalent. Examples: 'aspirin', 'acetylsalicylic acid', 'H2O', 'C9H8O4'.
byNoHow to read the query. 'auto' (default) treats a parseable formula as a formula and anything else as a name, falling back to the other direction on a miss. 'name' or 'formula' pin it.auto
limitNoMaximum number of compounds to return for a formula lookup. Isomers share a formula; results are ordered with the most notable (preferred) name first.

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It details search sources, interpretation logic (auto/name/formula), canonicalization (Hill system, trailing registry annotations), error raising ('ValueError'), and even sample output fields. This is exceptionally transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, then details search scope, parameters, and output. While slightly verbose, every sentence adds value. It could be trimmed slightly without losing meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite lacking an output schema, the description fully explains all return fields (query, interpreted_as, normalized, matches, source, license) and error behavior. Combined with 100% schema coverage for parameters, this is a complete and self-contained definition.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds valuable context beyond schema: explains formula canonicalization examples, auto direction fallback, and the meaning of 'preferred name'. This enhances agent understanding without being redundant.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with a clear verb+resource: 'Look up a chemical compound by name or molecular formula.' It distinguishes itself from sibling tools like 'info', 'isotope_distribution', and 'molecular_weight_calculator' by focusing on name/formula resolution.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly outlines the search order (bundled database, user cache, online fallback) and the direction selection via the 'by' parameter. It implies use when identifying compounds, but lacks explicit when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

infoA

Report mcp-molecules server availability, version, and environment information.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full burden. It only states it reports information, but does not disclose whether it is read-only, any authorization needs, rate limits, or potential side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence that is front-loaded with the verb 'Report' and is concise with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema, so the description should explain the return value format. It mentions what is reported but not the structure or type of the output, leaving the agent uncertain.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters and schema coverage is 100%. With no parameters, the description need not add param info. Baseline 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Report' and clearly identifies the resource: server availability, version, and environment information. It distinguishes from sibling tools which focus on chemical computations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The context implies this tool is for server info, but there is no explicit guidance on when to use it versus alternatives, nor any when-not-to-use instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

isotope_distributionA

Compute the natural isotopic pattern (isotope distribution) of a formula.

Returns the set of isotopologue peaks a mass spectrometer would see: each peak's neutral mass (and mz when charge is non-zero), its intensity relative to the base peak, and its absolute abundance. Also reports the monoisotopic_mass (most-abundant isotope of each element) and the average_mass. Backed by the bundled NIST Atomic Weights and Isotopic Compositions database -- offline and deterministic.

Peaks below threshold percent of the base peak are dropped; at most limit are returned. grouping selects nominal-mass (unit) or fully resolved (exact) peaks.

Raises ValueError for an unparseable formula or an unknown element.

ParametersJSON Schema
NameRequiredDescriptionDefault
formulaYesChemical formula whose isotopic pattern to compute. Same syntax as molecular_weight_calculator: element symbols, integer multipliers, nested groups, isotope labels D/T, Unicode subscripts. Examples: 'CHCl3', 'C6H5Br', 'C254H377N65O75S6'.
chargeNoIon charge. 0 (default) reports neutral isotopologue masses. A non-zero n reports m/z for the [M+nH] ion (positive) or [M-nH] ion (negative): (mass +/- n*proton)/|n|.
thresholdNoDrop peaks below this percent of the base (most intense) peak.
limitNoMaximum number of peaks to return, most intense first.
groupingNo'unit' (default) collapses peaks to nominal integer masses (intensity-weighted centroid) -- the low-resolution spectrum a chemist eyeballs. 'exact' keeps every resolved isotopologue.unit

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses return values, threshold/limit behavior, grouping options, error handling (ValueError), and notes the offline deterministic database. It could mention idempotency but is thorough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured, front-loading the core purpose. It uses clear language and separates key points. A minor improvement would be further tightening, but it is effective.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 5 parameters and no output schema, the description covers return values, parameter behavior, and error conditions adequately. It lacks explicit output format structure but provides enough context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds context about output but does not meaningfully extend parameter descriptions beyond what the schema provides. The grouping explanation is helpful but not substantial.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it computes the natural isotopic pattern of a formula, specifies what is returned (peaks with mass, mz, intensity, abundance, monoisotopic and average mass), and distinguishes from sibling tools by focusing on isotopic distribution.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not explicitly provide usage guidelines or contrast with alternatives like molecular_weight_calculator, find_chemical_compound, or info. It implies when to use (for isotopic pattern) but lacks guidance on when not to use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

molecular_weight_calculatorA

Compute the molecular weight (molar mass) of a chemical formula.

Parses formula into an atom tally, looks up each element's mass in the bundled NIST Atomic Weights and Isotopic Compositions database, and returns the total weight in the requested unit. Every call reports all three distinct mass flavors under masses so callers never conflate them or have to re-ask:

  • nominal -- sum of the integer mass numbers of the most abundant isotopes,

  • average -- the standard atomic weight (average molar mass),

  • monoisotopic -- the exact mass of the most abundant isotopes.

The monoisotopic flag selects which of these is mirrored at the top level (weight / uncertainty / formatted) and named by primary. Optionally propagates NIST uncertainties (uncertainty) and/or reports percent composition by mass (composition).

Raises ValueError for an unparseable formula or an unknown element.

ParametersJSON Schema
NameRequiredDescriptionDefault
formulaYesChemical formula to weigh. Supports element symbols, integer multipliers, arbitrarily nested parenthetical groups, and isotope labels D (deuterium) and T (tritium). Examples: 'H2O', 'C6H12O6', 'Ca(OH)2', 'Fe2(SO4)3', '((CH3)2CH)2', 'D2O', 'Tc'.
unitNoOutput unit for the reported mass. Defaults to grams per mole.g/mol
uncertaintyNoIf true, propagate the per-element NIST standard uncertainties in quadrature and report the result as value ± sigma.
monoisotopicNoSelects which mass flavor is reported at the top level (weight / uncertainty / formatted): false (default) for the standard atomic weight, true for the monoisotopic mass. All three flavors (nominal, average, monoisotopic) are always returned under 'masses' regardless of this flag.
compositionNoIf true, return the per-element percent composition by mass (count, mass subtotal, and percentage) alongside the total weight.

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description effectively discloses all key behaviors: parsing formula, looking up NIST data, returning three mass flavors, and raising ValueError for invalid inputs. It does not mention performance or side effects, but for a read-only calculator this is sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured, front-loaded with the primary purpose, and uses a bullet-like list for the mass flavors. Every sentence adds value, and the length is appropriate for the tool's complexity, achieving high information density without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite lacking an output schema, the description thoroughly covers input parameters, output structure (three masses, top-level weight, uncertainty, composition), and error handling. It provides all necessary context for an agent to correctly invoke and interpret results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing baseline parameter documentation. The description adds significant value beyond the schema by explaining the three mass flavors, the role of the monoisotopic flag, uncertainty propagation, and composition reporting, thus enriching the agent's understanding of parameter interactions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it computes molecular weight (molar mass) from a chemical formula, using a specific verb and resource. It distinguishes itself from sibling tools like isotope_distribution by focusing on bulk mass calculation rather than isotopic patterns.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for molecular weight queries through the first sentence, but does not explicitly guide when to use this tool over siblings like find_chemical_compound or isotope_distribution. It provides clear context but lacks exclusions or alternative recommendations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.2.0
    • First observedfind_chemical_compound
    • First observedinfo
    • First observedisotope_distribution
    • First observedmolecular_weight_calculator

TDQS

A4.1/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: lookup compounds, report server info, compute isotope distribution, and calculate molecular weight. There is no functional overlap, and the detailed descriptions prevent confusion.

Naming Consistency3/5

Tool names mix patterns: 'find_chemical_compound' follows verb_noun, while 'info', 'isotope_distribution', and 'molecular_weight_calculator' are noun phrases. The inconsistent verb usage and the terse 'info' name break a predictable pattern.

Tool Count5/5

With 4 tools, the server is well-scoped for its purpose of chemical compound lookup and calculation. Each tool earns its place without feeling sparse or bloated.

Completeness4/5

The server covers core workflows: compound lookup, molecular weight, and isotope distribution. Minor gaps exist, such as missing tools for property lookup or cache management, but the domain is well-served by the current set.

Maintenance

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    A
    maintenance
    Provides a collection of MCP servers for computational chemistry tasks including molecular generation and retrosynthesis. Also offers property prediction and molecule pricing capabilities.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides chemical informatics endpoints for converting between chemical names and SMILES, processing molecule structures, and comparing molecules, with MCP compatibility.
    5
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server for Ketcher chemical structure editor integration, enabling SMILES/MOL/InChI conversion, image generation, molecular property calculation, and validation.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server for chemistry-focused tools, enabling LLM agents to perform molecule parsing, format conversion, property lookup, and other chemistry operations with explainable responses.
    Apache 2.0