mcp-molecules

mcp-molecules

An MCP server for chemistry: it computes molecular weights and isotope distributions from chemical formulae and resolves compound name/formula lookups, backed by NIST atomic-weight data and a cached finder over multiple online and offline sources.

Category
访问服务器

README

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.

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.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选