pytest-mcp-assert
pytest plugin for mcp-assert. Run MCP server assertions as pytest test items.
Install
pip install pytest-mcp-assert
You also need the mcp-assert binary. Any of these:
brew install blackwell-systems/tap/mcp-assert
pip install mcp-assert
npm install -g @blackwell-systems/mcp-assert
Usage
Write assertion YAML files (see mcp-assert docs):
# evals/echo.yaml
name: echo returns the message
server:
command: my-mcp-server
assert:
tool: echo
args:
message: hello
expect:
not_error: true
contains: ["hello"]
timeout: 30s
Run with pytest:
pytest --mcp-suite evals/
Each YAML file becomes a pytest test item with pass/fail/skip semantics.
Options
| Option | pyproject.toml | Description |
|---|---|---|
--mcp-suite DIR |
mcp_suite |
Directory containing assertion YAML files |
--mcp-fixture DIR |
mcp_fixture |
Fixture directory (substituted for {{fixture}}) |
--mcp-server CMD |
Override server command for all assertions | |
--mcp-timeout DUR |
mcp_timeout |
Per-assertion timeout (default: 30s) |
--mcp-binary PATH |
Path to mcp-assert binary |
Configuration
# pyproject.toml
[tool.pytest.ini_options]
mcp_suite = "evals/"
mcp_fixture = "fixtures/"
mcp_timeout = "30s"
Then just run pytest with no extra flags.
How it works
The plugin discovers .yaml files in the suite directory, creates a pytest Item for each one, and calls mcp-assert run --suite <file> --json to execute it. The JSON result is mapped to pytest outcomes:
status: "pass"becomes a pytest passstatus: "fail"becomes a pytest failure with the detail as the messagestatus: "skip"becomes a pytest skipskip: truein the YAML skips the test (for known bugs)
The Go binary handles all MCP protocol interaction. The plugin is a thin bridge.
Metadata
Release files for pytest-mcp-assert 0.12.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pytest_mcp_assert-0.12.3.tar.gz | 4.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_mcp_assert-0.12.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / pytest_mcp_assert-0.12.3.tar.gz
| Download URL | pytest_mcp_assert-0.12.3.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
967a703af46517dec28eb5b273dc73def301c06e51ed10661118a9e032c39979
|
|
BLAKE2b-256 checksum How to use checksums |
14f387889a72ab43184dcb86bb72194d96fc247c6760adcee524093071625eb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / pytest_mcp_assert-0.12.3-py3-none-any.whl
| Download URL | pytest_mcp_assert-0.12.3-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d37b31220be22b8997c4d9b3293db76eb46bddac8fe328578df7dc10fb70202
|
|
BLAKE2b-256 checksum How to use checksums |
a8d3de42f04fc617730c9ce892f99717cd44f4969e38f211e482d9ef485d5c77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for pytest-mcp-assert 0.12.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.