MatRouter
MatRouter is an agent-native materials evidence substrate. It routes explicit
EvidenceRequirement objects to source-qualified executable operations and
deterministically decides whether returned evidence is admissible for a
ClaimSpec. It does not treat retrievable data, a ready route, or a successful
source call as support for a scientific claim.
The Agent control plane—LLM, Skills, and MCP tool use—interprets natural
language, decomposes evidence needs, chooses source breadth and order, retries,
iterates, stops, and writes the narrative. The Python evidence plane owns typed
requests, capability truth, route readiness, qualified source identity,
SourceOutcome, canonical observations and provenance, scientific
qualification, trace, lineage, artifact integrity, and ClaimSupportMap.
Agents may change a plan; they may not upgrade an incomplete,
incomparable, or conflicted MatRouter disposition to supported.
MatRouter's scientific model separates availability → execution → admissibility. FastMCP is one transport for the Python core, and the Agent Skill is a control-plane recipe.
Status
This checkout is the direct-v2 cutover. The public architecture is the
two-plane surface described above; old workflow schemas and end-to-end task
tools are migration inputs, not supported fallback APIs. A v2 contract or MCP
tool is public only when its typed module and contract tests are present.
Schemas remain versioned and may change before a stable release.
Stateful MCP composition starts with begin_evidence_run; its returned
process-local ID isolates the attempt ledger, and a later attempt invalidates
older bundles for the same requirements. Each stateful call holds a run-wide
lease, so an active run cannot be replaced mid-operation. Executed malformed
payloads remain failed SourceOutcome attempts and never become evidence.
Quick Start
MatRouter requires Python 3.11 or newer.
Add MatRouter to a Python project:
uv add --prerelease=allow matrouter
Use the package directly:
from matrouter import create_router
with create_router() as router:
print(router.explain_sources())
Create a claim specification, collect the explicitly declared evidence requirements through the Agent control plane, and let deterministic Python qualification produce the claim-support map:
from matrouter.claim_support import make_claim_support_request, qualify_claim_support
request = make_claim_support_request(bundle, (claim_spec,))
support_map = qualify_claim_support(request)
print(support_map.entries[0].disposition)
The four finite templates are retained as versioned Python policy packs, Skill
recipes, and benchmark specifications. They deterministically expand into
mandatory EvidenceRequirement objects; they do not choose a complete source
sequence or report preset. EvidenceBundle is the sole evidence truth, and
ClaimSupportMap exposes only the four scientific dispositions
supported, conflicted, incomparable, and incomplete. Availability
statuses such as unsupported remain outside that scientific algebra.
OPTIMADE and MatRouter are complementary: OPTIMADE standardizes provider-side common-record interoperability, while MatRouter provides agent-side evidence capability routing and scientific admissibility across native and OPTIMADE sources. Aggregate providers are discovery scopes; executable evidence routes retain the exact provider/database child identity. MatRouter does not replace OPTIMADE.
Install the same package as an MCP runtime:
uv tool install --prerelease=allow matrouter
Or install from a source checkout:
git clone https://github.com/MatRouter/matrouter.git
cd matrouter
uv sync
Agent hosts can then run MatRouter as a local MCP stdio server:
matrouter
When running from a source checkout instead of the installed tool, use uv run matrouter.
For Codex and Claude Code, prefer the installable plugin path in the user guide. For OpenCode or other hosts, configure MCP with command: "matrouter" or command: ["matrouter"] and install the portable skill if the host supports skills.
Most starter workflows can use public sources without MatRouter-specific credentials. Materials Project, MaterialsGalaxy structure/property routes, and MPDS require API keys supplied through the process environment or the agent host's secret storage. Do not commit keys to the repository or shared MCP client configuration.
Documentation
- User setup, data-source configuration, MCP client examples, workflows, and troubleshooting: user guide
- Development guide, architecture notes, configuration contract, testing, and release workflow: development guide
- Validation report: test report
Agent Skill
The public MatRouter skill source lives in skills/matrouter/. It is for agents that have, or are being configured to have, MatRouter MCP access. It is the non-normative control-plane recipe for creating claim specifications, decomposing evidence needs, choosing routes, handling retries and gaps, and narrating deterministic MatRouter qualification without changing its disposition.
For Codex auto-discovery, install it by copying skills/matrouter/ to .agents/skills/matrouter/ in a repo or to $HOME/.agents/skills/matrouter/ for personal use.
For human-facing MCP client setup, use the user guide. After setup, a useful prompt is:
Use MatRouter to find the band structure of diamond and generate a plot.
Contact
Authors:
- Quansheng Wu quansheng.wu@iphy.ac.cn
- Tiannian Zhu (朱天念) tnzhu@iphy.ac.cn
Maintainer:
- Quansheng Wu wuquansheng@gmail.com
License
MatRouter source code is licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
MatRouter does not grant rights to third-party database content. Data retrieved through MatRouter remains subject to the terms, licenses, API policies, attribution requirements, and access restrictions of the respective upstream data providers.
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 matrouter-0.3.2.tar.gz.
File metadata
- Download URL: matrouter-0.3.2.tar.gz
- Upload date:
- Size: 897.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4728fe97c5162fe82520606a47c133b5d719a7e37d76cb6e30c5dcee1db6289b
|
|
| MD5 |
592ce46d35c3d9724786cd6cba12d1c2
|
|
| BLAKE2b-256 |
d475b95c85b20d00e41be0b15279067f7b5ae246b376b1edad265aa586003e1b
|
Provenance
The following attestation bundles were made for matrouter-0.3.2.tar.gz:
Publisher:
publish.yml on MatRouter/matrouter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
matrouter-0.3.2.tar.gz -
Subject digest:
4728fe97c5162fe82520606a47c133b5d719a7e37d76cb6e30c5dcee1db6289b - Sigstore transparency entry: 2311399996
- Sigstore integration time:
-
Permalink:
MatRouter/matrouter@db98811c69ef6652a491b9ddefb68a6f815c8b27 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/MatRouter
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db98811c69ef6652a491b9ddefb68a6f815c8b27 -
Trigger Event:
release
-
Statement type:
File details
Details for the file matrouter-0.3.2-py3-none-any.whl.
File metadata
- Download URL: matrouter-0.3.2-py3-none-any.whl
- Upload date:
- Size: 360.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
842feea91e4776ee3fec175619798810f287a84770de6332adda0a38c5c04147
|
|
| MD5 |
452dce0fa4301e2844c1e7e8d92c64ed
|
|
| BLAKE2b-256 |
c85d34a8771279fc0d4512450450bf5733de30d51059a7d1c3d3e56c9b34d62d
|
Provenance
The following attestation bundles were made for matrouter-0.3.2-py3-none-any.whl:
Publisher:
publish.yml on MatRouter/matrouter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
matrouter-0.3.2-py3-none-any.whl -
Subject digest:
842feea91e4776ee3fec175619798810f287a84770de6332adda0a38c5c04147 - Sigstore transparency entry: 2311400008
- Sigstore integration time:
-
Permalink:
MatRouter/matrouter@db98811c69ef6652a491b9ddefb68a6f815c8b27 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/MatRouter
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db98811c69ef6652a491b9ddefb68a6f815c8b27 -
Trigger Event:
release
-
Statement type: