The MCP foundation for the MolCrafts ecosystem
Project description
molmcp
The MCP foundation for the MolCrafts ecosystem
Documentation · Quickstart · Write a Provider · Issues
Why molmcp
The MolCrafts ecosystem ships many packages — molpy, molcfg, molexp, molpack, mollog, molq, molrec, molvis — and each of them benefits from being callable by an LLM agent. Without coordination, every package would have to author its own MCP server, redo the same source-introspection plumbing, redo the same security defaults, redo the same plugin wiring. molmcp is the layer that the MolCrafts packages share so they don't have to.
It does two things:
- Exposes seven read-only source-introspection tools for any MolCrafts package, so an agent can ask "what does
molpy.core.atomisticcontain?" and get an exact answer from the live source. - Defines a Provider plugin contract so each MolCrafts package can ship its own domain tools (
molpackexposes "pack a box",molqexposes "submit a job",molexpexposes "run an experiment") under a single coordinated MCP server with shared security defaults.
molmcp itself imports nothing from the MolCrafts packages. That's the point — it's pure infrastructure, and any MolCrafts package can adopt it without dragging in the others.
Features
- Seven introspection tools —
list_modules,list_symbols,get_source,get_docstring,get_signature,read_file,search_source— pointed at any MolCrafts import root. - Provider plugin contract — MolCrafts packages contribute domain tools via a
Providerclass plus an entry point. Auto-discovered, namespaced, version-able. - Security middleware that's on by default — path-traversal guard, response-size cap (256 KB), and a startup-time check that refuses to serve any tool missing a
readOnlyHint/destructiveHintannotation. safe_subprocesshelper — for MolCrafts packages that wrap external CLIs (Packmol, LAMMPS, AmberTools): forced list args, noshell=True, mandatory timeout.- Three transports —
stdio,streamable-http,sse.
Install
pip install molcrafts-molmcp
Requires Python ≥ 3.10. The PyPI distribution is molcrafts-molmcp; the import name is molmcp.
60-second quickstart
Expose a MolCrafts package as a set of MCP introspection tools:
python -m molmcp --import-root molpy --name molpy
Wire it into Claude Code:
claude mcp add molpy -- python -m molmcp --import-root molpy --name molpy
The agent now has mcp__molpy__list_modules, mcp__molpy__get_source, etc.
Adding domain tools (for MolCrafts packages)
# in your MolCrafts package, e.g. src/molpack_mcp/__init__.py
from fastmcp import FastMCP
from mcp.types import ToolAnnotations
class MolpackProvider:
name = "molpack"
def register(self, mcp: FastMCP) -> None:
@mcp.tool(annotations=ToolAnnotations(destructiveHint=True))
def pack_box(spec: dict, workdir: str) -> dict:
"""Pack a simulation box from a MolCrafts pack spec."""
from molpack import pack
return pack(spec, workdir).to_dict()
Declare the entry point in your package's pyproject.toml:
[project.entry-points."molmcp.providers"]
molpack = "molpack_mcp:MolpackProvider"
Now python -m molmcp discovers it automatically. The new tool joins the introspection tools in the same server.
Architecture
┌────────────────────────────────────┐
│ MCP clients │
│ (Claude Code, Claude Desktop, …) │
└──────────────┬─────────────────────┘
│ stdio / http / sse
▼
┌────────────────────────────────────┐
│ molmcp │
│ • Provider contract │
│ • IntrospectionProvider │
│ • PathSafety / ResponseLimit │
│ • run_safe / fence_untrusted │
└──────────────┬─────────────────────┘
│
┌───────────┬───────────┼───────────┬───────────┐
▼ ▼ ▼ ▼ ▼
molpy_mcp molpack_mcp molexp_mcp molq_mcp mollog_mcp
(domain) (domain) (domain) (domain) (domain)
molmcp itself is library code — no MolCrafts package depends on any other through molmcp. Each package writes its Provider against the molmcp contract and ships the entry point; the host process composes them at runtime.
Documentation
Full documentation lives at molcrafts.github.io/molmcp:
To preview the docs locally:
pip install "molcrafts-molmcp[docs]"
zensical serve
Status
Alpha. The Provider contract and middleware surface may shift before 1.0. Pin to molcrafts-molmcp >= 0.1, < 0.2.
Contributing
git clone https://github.com/MolCrafts/molmcp.git
cd molmcp
pip install -e ".[dev]"
pytest
License
BSD-3-Clause. See LICENSE.
Acknowledgements
molmcp is part of the MolCrafts project. It implements the Model Context Protocol using the fastmcp server library.
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 molcrafts_molmcp-0.1.0.tar.gz.
File metadata
- Download URL: molcrafts_molmcp-0.1.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b143eb0e7fa9ebbc14c8301e6337e963e02fb6b8f2cf0018389f29a7206cf4d
|
|
| MD5 |
f4a9d014b06fb74eb5306ecc45c6cf98
|
|
| BLAKE2b-256 |
fb9ee9a6446579fa65b07d2b50704ad3f1768ca568ceee7f39272fccda58bd9e
|
Provenance
The following attestation bundles were made for molcrafts_molmcp-0.1.0.tar.gz:
Publisher:
release.yml on MolCrafts/molmcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
molcrafts_molmcp-0.1.0.tar.gz -
Subject digest:
9b143eb0e7fa9ebbc14c8301e6337e963e02fb6b8f2cf0018389f29a7206cf4d - Sigstore transparency entry: 1396611243
- Sigstore integration time:
-
Permalink:
MolCrafts/molmcp@4b0924a2803bf4bbea9d433186729001f991cf33 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MolCrafts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4b0924a2803bf4bbea9d433186729001f991cf33 -
Trigger Event:
push
-
Statement type:
File details
Details for the file molcrafts_molmcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: molcrafts_molmcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d105044ec0135cfb8b2dba4dd62f7f9d5b94d4ea31568698ac4f8b835eb4075
|
|
| MD5 |
30236a9f0262ec408a59cd757befd269
|
|
| BLAKE2b-256 |
d43583d156541a33862122946ad1a98c90fb6a08247aafa42412e6b079019c8b
|
Provenance
The following attestation bundles were made for molcrafts_molmcp-0.1.0-py3-none-any.whl:
Publisher:
release.yml on MolCrafts/molmcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
molcrafts_molmcp-0.1.0-py3-none-any.whl -
Subject digest:
5d105044ec0135cfb8b2dba4dd62f7f9d5b94d4ea31568698ac4f8b835eb4075 - Sigstore transparency entry: 1396611258
- Sigstore integration time:
-
Permalink:
MolCrafts/molmcp@4b0924a2803bf4bbea9d433186729001f991cf33 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MolCrafts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4b0924a2803bf4bbea9d433186729001f991cf33 -
Trigger Event:
push
-
Statement type: