agent-evidence-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Sankalp Gilda
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-evidence-mcp
3
+ Version: 0.1.0
4
+ Summary: Offline, read-only MCP server that verifies agent evidence claims and replays the agent-evidence conformance vectors
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Source, https://github.com/probityai/agent-evidence-mcp
7
+ Project-URL: Documentation, https://github.com/probityai/agent-evidence-mcp/blob/main/docs/tools.md
8
+ Project-URL: Issues, https://github.com/probityai/agent-evidence-mcp/issues
9
+ Keywords: mcp,model-context-protocol,ai-agents,evidence-verification,conformance
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: mcp==2.3.0
14
+ Requires-Dist: pyyaml==6.0.3
15
+ Requires-Dist: probity-verify==0.1.1
16
+ Requires-Dist: agent-evidence-vectors==0.23.0
17
+ Requires-Dist: agent-evidence-vocabulary==0.6.0
18
+ Requires-Dist: agent-evidence-admission==0.1.2
19
+ Provides-Extra: test
20
+ Requires-Dist: pytest==9.1.1; extra == "test"
21
+ Dynamic: license-file
22
+
23
+ # agent-evidence-mcp
24
+
25
+ <!-- mcp-name: io.github.probityai/agent-evidence-mcp -->
26
+
27
+ An offline, read-only MCP server that decides whether a claim about an AI system holds against evidence bytes you supply, and replays the agent-evidence conformance vectors.
28
+
29
+ It's for agent builders, auditors and platform engineers who want their assistant to check evidence instead of trusting a report.
30
+
31
+ Install the released package: `pip install agent-evidence-mcp==0.1.0`. It pins `probity-verify==0.1.1`, `agent-evidence-vectors==0.23.0`, `agent-evidence-vocabulary==0.6.0` and `agent-evidence-admission==0.1.2` exactly.
32
+
33
+ ## Quick start
34
+
35
+ Add it to Claude Code, then ask the assistant to run the sample claim:
36
+
37
+ ```sh
38
+ claude mcp add agent-evidence -- uvx agent-evidence-mcp@0.1.0
39
+ ```
40
+
41
+ Or install the Claude Code plugin: `/plugin install agent-evidence --marketplace probityai/agent-evidence-mcp`.
42
+
43
+ Or call a tool from Python, with no client installed beyond the package:
44
+
45
+ ```sh
46
+ uvx --from agent-evidence-mcp==0.1.0 python - <<'PY'
47
+ import asyncio
48
+ from mcp.client import Client
49
+ from mcp.client.stdio import StdioServerParameters
50
+
51
+ async def main():
52
+ async with Client(StdioServerParameters(command="agent-evidence-mcp")) as client:
53
+ result = await client.call_tool("verify_sample", {"scenario": "contradicted"})
54
+ print(result.structured_content["decision"], result.structured_content["reason"])
55
+
56
+ asyncio.run(main())
57
+ PY
58
+ ```
59
+
60
+ It prints:
61
+
62
+ ```text
63
+ contradicted selected_span_missing_from_record
64
+ ```
65
+
66
+ A passage the report quotes is missing from the source capture, so the claim is contradicted. Use `supported` or `not_established` as the scenario for the other two decisions.
67
+
68
+ ## Tools
69
+
70
+ Seven tools, all read-only, offline and bounded: `verify_claim`, `verify_sample`, `list_vector_corpora`, `run_vectors`, `explain_vector`, `lookup_term` and `check_artifact_digest`. Nothing is fetched, written or sent.
71
+
72
+ ## Status
73
+
74
+ Version 0.1.0. The tests run every tool through a real MCP client against the shipped corpus, and a mutation check confirms they fail when a tool's output is broken. `canonicalize_json` and `verify_dsse` come later, once their Rust crates ship Python wheels.
75
+
76
+ ## Documentation
77
+
78
+ | page | read it for |
79
+ | --- | --- |
80
+ | [Tools](https://github.com/probityai/agent-evidence-mcp/blob/main/docs/tools.md) | every tool, its arguments and what it returns |
81
+ | [Install](https://github.com/probityai/agent-evidence-mcp/blob/main/docs/install.md) | Claude Code, Gemini CLI, Docker and plain stdio |
82
+ | [Agent guide](https://github.com/probityai/agent-evidence-mcp/blob/main/llms.txt) | a short index for agents using the server |
83
+ | [Changing the repository](https://github.com/probityai/agent-evidence-mcp/blob/main/AGENTS.md) | the commands to run and what never to hand-edit |
84
+
85
+ ## License
86
+
87
+ Apache-2.0.
@@ -0,0 +1,65 @@
1
+ # agent-evidence-mcp
2
+
3
+ <!-- mcp-name: io.github.probityai/agent-evidence-mcp -->
4
+
5
+ An offline, read-only MCP server that decides whether a claim about an AI system holds against evidence bytes you supply, and replays the agent-evidence conformance vectors.
6
+
7
+ It's for agent builders, auditors and platform engineers who want their assistant to check evidence instead of trusting a report.
8
+
9
+ Install the released package: `pip install agent-evidence-mcp==0.1.0`. It pins `probity-verify==0.1.1`, `agent-evidence-vectors==0.23.0`, `agent-evidence-vocabulary==0.6.0` and `agent-evidence-admission==0.1.2` exactly.
10
+
11
+ ## Quick start
12
+
13
+ Add it to Claude Code, then ask the assistant to run the sample claim:
14
+
15
+ ```sh
16
+ claude mcp add agent-evidence -- uvx agent-evidence-mcp@0.1.0
17
+ ```
18
+
19
+ Or install the Claude Code plugin: `/plugin install agent-evidence --marketplace probityai/agent-evidence-mcp`.
20
+
21
+ Or call a tool from Python, with no client installed beyond the package:
22
+
23
+ ```sh
24
+ uvx --from agent-evidence-mcp==0.1.0 python - <<'PY'
25
+ import asyncio
26
+ from mcp.client import Client
27
+ from mcp.client.stdio import StdioServerParameters
28
+
29
+ async def main():
30
+ async with Client(StdioServerParameters(command="agent-evidence-mcp")) as client:
31
+ result = await client.call_tool("verify_sample", {"scenario": "contradicted"})
32
+ print(result.structured_content["decision"], result.structured_content["reason"])
33
+
34
+ asyncio.run(main())
35
+ PY
36
+ ```
37
+
38
+ It prints:
39
+
40
+ ```text
41
+ contradicted selected_span_missing_from_record
42
+ ```
43
+
44
+ A passage the report quotes is missing from the source capture, so the claim is contradicted. Use `supported` or `not_established` as the scenario for the other two decisions.
45
+
46
+ ## Tools
47
+
48
+ Seven tools, all read-only, offline and bounded: `verify_claim`, `verify_sample`, `list_vector_corpora`, `run_vectors`, `explain_vector`, `lookup_term` and `check_artifact_digest`. Nothing is fetched, written or sent.
49
+
50
+ ## Status
51
+
52
+ Version 0.1.0. The tests run every tool through a real MCP client against the shipped corpus, and a mutation check confirms they fail when a tool's output is broken. `canonicalize_json` and `verify_dsse` come later, once their Rust crates ship Python wheels.
53
+
54
+ ## Documentation
55
+
56
+ | page | read it for |
57
+ | --- | --- |
58
+ | [Tools](https://github.com/probityai/agent-evidence-mcp/blob/main/docs/tools.md) | every tool, its arguments and what it returns |
59
+ | [Install](https://github.com/probityai/agent-evidence-mcp/blob/main/docs/install.md) | Claude Code, Gemini CLI, Docker and plain stdio |
60
+ | [Agent guide](https://github.com/probityai/agent-evidence-mcp/blob/main/llms.txt) | a short index for agents using the server |
61
+ | [Changing the repository](https://github.com/probityai/agent-evidence-mcp/blob/main/AGENTS.md) | the commands to run and what never to hand-edit |
62
+
63
+ ## License
64
+
65
+ Apache-2.0.
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "agent-evidence-mcp"
7
+ version = "0.1.0"
8
+ description = "Offline, read-only MCP server that verifies agent evidence claims and replays the agent-evidence conformance vectors"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ keywords = ["mcp", "model-context-protocol", "ai-agents", "evidence-verification", "conformance"]
14
+ dependencies = [
15
+ "mcp==2.3.0",
16
+ "pyyaml==6.0.3",
17
+ "probity-verify==0.1.1",
18
+ "agent-evidence-vectors==0.23.0",
19
+ "agent-evidence-vocabulary==0.6.0",
20
+ "agent-evidence-admission==0.1.2",
21
+ ]
22
+
23
+ [project.optional-dependencies]
24
+ test = ["pytest==9.1.1"]
25
+
26
+ [project.urls]
27
+ Source = "https://github.com/probityai/agent-evidence-mcp"
28
+ Documentation = "https://github.com/probityai/agent-evidence-mcp/blob/main/docs/tools.md"
29
+ Issues = "https://github.com/probityai/agent-evidence-mcp/issues"
30
+
31
+ [project.scripts]
32
+ agent-evidence-mcp = "agent_evidence_mcp.server:main"
33
+
34
+ [tool.setuptools.packages.find]
35
+ where = ["src"]
36
+
37
+ [tool.pytest.ini_options]
38
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """Offline, read-only MCP server over probity-verify and the agent-evidence packages."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,44 @@
1
+ """MCP server wiring: seven offline, read-only tools over stdio."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from mcp.server.mcpserver import MCPServer
6
+ from mcp.types import ToolAnnotations
7
+
8
+ from . import __version__, tools
9
+
10
+ READ_ONLY = {"readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False}
11
+
12
+ # (function, title) in the order they are listed. Names stay under 64 characters.
13
+ TOOLS = [
14
+ (tools.verify_claim, "Verify a claim against evidence"),
15
+ (tools.verify_sample, "Run a bundled sample claim"),
16
+ (tools.list_vector_corpora, "List conformance vector corpora"),
17
+ (tools.run_vectors, "Replay a conformance vector corpus"),
18
+ (tools.explain_vector, "Explain one conformance vector"),
19
+ (tools.lookup_term, "Look up a vocabulary term"),
20
+ (tools.check_artifact_digest, "Check an artifact digest against a document"),
21
+ ]
22
+
23
+
24
+ def build_server() -> MCPServer:
25
+ server = MCPServer(
26
+ "agent-evidence-mcp",
27
+ title="Agent evidence",
28
+ instructions=(
29
+ "Offline, read-only tools that verify a claim about an AI system against supplied evidence "
30
+ "bytes and replay the agent-evidence conformance vectors. Nothing is fetched or written."
31
+ ),
32
+ version=__version__,
33
+ )
34
+ for function, title in TOOLS:
35
+ server.tool(name=function.__name__, title=title, annotations=ToolAnnotations(title=title, **READ_ONLY))(function)
36
+ return server
37
+
38
+
39
+ def main() -> None:
40
+ build_server().run(transport="stdio")
41
+
42
+
43
+ if __name__ == "__main__":
44
+ main()
@@ -0,0 +1,246 @@
1
+ """The tool bodies. Each is a thin function over one library call, with bounded output."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import base64
6
+ import binascii
7
+ import json
8
+ import subprocess
9
+ import sys
10
+ import tempfile
11
+ from importlib import resources
12
+ from pathlib import Path, PurePosixPath
13
+ from typing import Any
14
+
15
+ import yaml
16
+ from agent_evidence_admission.digest_check import check, parse_document
17
+ from probity_verify.core import CaseError, adjudicate, render_packet
18
+
19
+ MAX_ARTIFACT_CHARS = 2_000_000
20
+ MAX_VECTOR_BYTES = 16_384
21
+ MAX_PAGE = 200
22
+ HARNESS_TIMEOUT_SECONDS = 300
23
+ OUTPUT_TAIL_CHARS = 2000
24
+
25
+ SAMPLES = {
26
+ "contradicted": ("case.json", "policy-june.json"),
27
+ "not_established": ("case.json", "policy-april.json"),
28
+ "supported": ("case-complete.json", "policy-complete.json"),
29
+ }
30
+
31
+
32
+ def _samples_dir() -> Path:
33
+ return Path(str(resources.files("probity_verify") / "samples"))
34
+
35
+
36
+ def _corpora_dir() -> Path:
37
+ return Path(str(resources.files("agent_evidence_vectors") / "corpora"))
38
+
39
+
40
+ def _error(message: str) -> dict[str, Any]:
41
+ return {"ok": False, "error": message}
42
+
43
+
44
+ def _summarize(result: dict) -> dict[str, Any]:
45
+ return {
46
+ "ok": True,
47
+ "decision": result["decision"],
48
+ "reason": result["reason"],
49
+ "claim_type": result["claim_type"],
50
+ "case_id": result["case_id"],
51
+ "policy_sha256": result["policy_sha256"],
52
+ "checks": result["checks"],
53
+ "scope": result["scope"],
54
+ "packet": render_packet(result),
55
+ }
56
+
57
+
58
+ def _safe_relative(name: str) -> PurePosixPath:
59
+ path = PurePosixPath(name)
60
+ if path.is_absolute() or ".." in path.parts or not path.parts or "\x00" in name:
61
+ raise CaseError(f"artifact path must be relative and stay inside the case: {name!r}")
62
+ return path
63
+
64
+
65
+ def verify_claim(case: dict, policy: dict, artifacts: dict[str, str] | None = None) -> dict[str, Any]:
66
+ """Decide one claim against evidence bytes the caller supplies, with probity-verify."""
67
+ artifacts = artifacts or {}
68
+ try:
69
+ with tempfile.TemporaryDirectory(prefix="aemcp-") as tmp:
70
+ root = Path(tmp)
71
+ total = 0
72
+ for name, text in artifacts.items():
73
+ relative = _safe_relative(name)
74
+ total += len(text)
75
+ if total > MAX_ARTIFACT_CHARS:
76
+ return _error("artifacts exceed the size limit")
77
+ target = root.joinpath(*relative.parts)
78
+ target.parent.mkdir(parents=True, exist_ok=True)
79
+ target.write_bytes(text.encode("utf-8"))
80
+ return _summarize(adjudicate(case, policy, root))
81
+ except CaseError as exc:
82
+ return _error(str(exc))
83
+
84
+
85
+ def verify_sample(scenario: str) -> dict[str, Any]:
86
+ """Run a bundled sample claim: contradicted, not_established or supported."""
87
+ if scenario not in SAMPLES:
88
+ return _error(f"scenario must be one of {sorted(SAMPLES)}")
89
+ case_name, policy_name = SAMPLES[scenario]
90
+ directory = _samples_dir()
91
+ case = json.loads((directory / case_name).read_text(encoding="utf-8"))
92
+ policy = json.loads((directory / policy_name).read_text(encoding="utf-8"))
93
+ try:
94
+ return _summarize(adjudicate(case, policy, directory))
95
+ except CaseError as exc:
96
+ return _error(str(exc))
97
+
98
+
99
+ def _harness(*args: str) -> subprocess.CompletedProcess[str]:
100
+ return subprocess.run(
101
+ [sys.executable, "-m", "agent_evidence_vectors.run_vectors", *args],
102
+ capture_output=True, text=True, timeout=HARNESS_TIMEOUT_SECONDS, check=False,
103
+ )
104
+
105
+
106
+ def _corpus_names() -> list[str]:
107
+ done = _harness("--list-corpora")
108
+ return [line.strip() for line in done.stdout.splitlines() if line.strip()]
109
+
110
+
111
+ def list_vector_corpora() -> dict[str, Any]:
112
+ """Name every shipped corpus with its suite revision and vector counts where it declares them."""
113
+ names = _corpus_names()
114
+ rows = []
115
+ for name in names:
116
+ row: dict[str, Any] = {"corpus": name}
117
+ manifest = _corpora_dir() / name / "MANIFEST.json"
118
+ if manifest.is_file():
119
+ data = json.loads(manifest.read_text(encoding="utf-8"))
120
+ if isinstance(data, dict):
121
+ row["suite_revision"] = data.get("suiteRevision")
122
+ vectors = data.get("vectors")
123
+ if isinstance(vectors, list):
124
+ row["vectors"] = len(vectors)
125
+ rows.append(row)
126
+ return {"ok": True, "total": len(rows), "corpora": rows}
127
+
128
+
129
+ def run_vectors(corpus: str = "vectors", offset: int = 0, limit: int = 50) -> dict[str, Any]:
130
+ """Replay one corpus with the bundled reference verifier; per-vector rows come back in pages."""
131
+ if corpus not in _corpus_names():
132
+ return _error(f"unknown corpus {corpus!r}; call list_vector_corpora")
133
+ limit = max(1, min(limit, MAX_PAGE))
134
+ offset = max(0, offset)
135
+ with tempfile.TemporaryDirectory(prefix="aemcp-") as tmp:
136
+ report_path = Path(tmp) / "report.json"
137
+ done = _harness("--corpus", corpus, "--report", str(report_path))
138
+ if not report_path.is_file():
139
+ # Some corpora print a text verdict and write no report; some need an external verifier.
140
+ return {
141
+ "ok": done.returncode == 0,
142
+ "corpus": corpus,
143
+ "exit_code": done.returncode,
144
+ "report": None,
145
+ "output": done.stdout[-OUTPUT_TAIL_CHARS:],
146
+ "error": done.stderr[-OUTPUT_TAIL_CHARS:] if done.returncode else None,
147
+ }
148
+ report = json.loads(report_path.read_text(encoding="utf-8"))
149
+ rows = [
150
+ {"id": v.get("id"), "kind": v.get("kind"), "status": v.get("status"),
151
+ "expected": v.get("expected"), "observed_verdict": (v.get("observed") or {}).get("verdict")}
152
+ for v in report.get("vectors", [])
153
+ ]
154
+ return {
155
+ "ok": True,
156
+ "corpus": corpus,
157
+ "exit_code": done.returncode,
158
+ "release": report.get("corpus", {}).get("release"),
159
+ "corpus_digest": report.get("corpus", {}).get("corpusDigest"),
160
+ "totals": report.get("totals"),
161
+ "offset": offset,
162
+ "page": rows[offset:offset + limit],
163
+ "next_offset": offset + limit if offset + limit < len(rows) else None,
164
+ }
165
+
166
+
167
+ def explain_vector(vector_id: str, corpus: str = "vectors") -> dict[str, Any]:
168
+ """Return one vector: its manifest entry, the conditions it tests, and its input bytes."""
169
+ if corpus not in _corpus_names():
170
+ return _error(f"unknown corpus {corpus!r}; call list_vector_corpora")
171
+ base = (_corpora_dir() / corpus).resolve()
172
+ manifest_path = base / "MANIFEST.json"
173
+ if not manifest_path.is_file():
174
+ return _error(f"corpus {corpus!r} has no top-level MANIFEST.json to explain from")
175
+ manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
176
+ entries = manifest.get("vectors") if isinstance(manifest, dict) else None
177
+ entry = next((e for e in entries or [] if isinstance(e, dict) and e.get("id") == vector_id), None)
178
+ if entry is None:
179
+ return _error(f"no vector {vector_id!r} in corpus {corpus!r}")
180
+ result: dict[str, Any] = {"ok": True, "corpus": corpus, "entry": entry, "spec_path": manifest.get("specPath")}
181
+ relative = entry.get("file")
182
+ if isinstance(relative, str):
183
+ path = (base / relative).resolve()
184
+ if base in path.parents and path.is_file():
185
+ raw = path.read_bytes()
186
+ result["input_bytes"] = len(raw)
187
+ result["input_truncated"] = len(raw) > MAX_VECTOR_BYTES
188
+ result["input"] = raw[:MAX_VECTOR_BYTES].decode("utf-8", errors="replace")
189
+ return result
190
+
191
+
192
+ def _vocabulary() -> dict[str, Any]:
193
+ text = (resources.files("agent_evidence_vocabulary") / "vocabulary.yaml").read_text(encoding="utf-8")
194
+ return yaml.safe_load(text)
195
+
196
+
197
+ def lookup_term(term: str) -> dict[str, Any]:
198
+ """Look a term up in the released vocabulary by exact key; otherwise suggest close keys."""
199
+ vocab = _vocabulary()
200
+ meta = vocab.get("meta", {})
201
+ found = []
202
+ for section, body in vocab.items():
203
+ if section == "meta" or not isinstance(body, dict):
204
+ continue
205
+ entry = body.get(term)
206
+ if isinstance(entry, dict) and "definition" in entry:
207
+ found.append({
208
+ "term": term, "section": section, "status": entry.get("status"),
209
+ "values": entry.get("values"), "definition": " ".join(str(entry["definition"]).split()),
210
+ "source_path": entry.get("source_path"),
211
+ })
212
+ if found:
213
+ return {"ok": True, "vocabulary_version": meta.get("version"), "spec_anchor": meta.get("spec_anchor"),
214
+ "spec_anchor_repo": meta.get("spec_anchor_repo"), "matches": found}
215
+ needle = term.lower()
216
+ close = sorted(
217
+ key for body in vocab.values() if isinstance(body, dict)
218
+ for key, value in body.items() if isinstance(value, dict) and "definition" in value
219
+ and (needle in key.lower() or key.lower() in needle)
220
+ )
221
+ return {"ok": False, "error": f"no term {term!r}", "close_terms": close[:20]}
222
+
223
+
224
+ def check_artifact_digest(document: str, artifact_text: str | None = None,
225
+ artifact_base64: str | None = None) -> dict[str, Any]:
226
+ """Check that an artifact has a digest a TEA, CycloneDX or in-toto document names."""
227
+ if (artifact_text is None) == (artifact_base64 is None):
228
+ return _error("pass exactly one of artifact_text and artifact_base64")
229
+ try:
230
+ raw = artifact_text.encode("utf-8") if artifact_text is not None else base64.b64decode(
231
+ artifact_base64 or "", validate=True)
232
+ except (binascii.Error, ValueError) as exc:
233
+ return _error(f"artifact_base64 is not valid base64: {exc}")
234
+ if len(raw) > MAX_ARTIFACT_CHARS:
235
+ return _error("artifact exceeds the size limit")
236
+ try:
237
+ result = check(parse_document(document.encode("utf-8")), raw)
238
+ except ValueError as exc:
239
+ return _error(f"document could not be read: {exc}")
240
+ return {
241
+ "ok": True,
242
+ "admitted": result.ok,
243
+ "reason": result.reason or "digest-matched",
244
+ "matched": {"algorithm": result.matched[0], "digest": result.matched[1]} if result.matched else None,
245
+ "declared": [{"algorithm": a, "digest": d} for a, d in result.declared],
246
+ }
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-evidence-mcp
3
+ Version: 0.1.0
4
+ Summary: Offline, read-only MCP server that verifies agent evidence claims and replays the agent-evidence conformance vectors
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Source, https://github.com/probityai/agent-evidence-mcp
7
+ Project-URL: Documentation, https://github.com/probityai/agent-evidence-mcp/blob/main/docs/tools.md
8
+ Project-URL: Issues, https://github.com/probityai/agent-evidence-mcp/issues
9
+ Keywords: mcp,model-context-protocol,ai-agents,evidence-verification,conformance
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: mcp==2.3.0
14
+ Requires-Dist: pyyaml==6.0.3
15
+ Requires-Dist: probity-verify==0.1.1
16
+ Requires-Dist: agent-evidence-vectors==0.23.0
17
+ Requires-Dist: agent-evidence-vocabulary==0.6.0
18
+ Requires-Dist: agent-evidence-admission==0.1.2
19
+ Provides-Extra: test
20
+ Requires-Dist: pytest==9.1.1; extra == "test"
21
+ Dynamic: license-file
22
+
23
+ # agent-evidence-mcp
24
+
25
+ <!-- mcp-name: io.github.probityai/agent-evidence-mcp -->
26
+
27
+ An offline, read-only MCP server that decides whether a claim about an AI system holds against evidence bytes you supply, and replays the agent-evidence conformance vectors.
28
+
29
+ It's for agent builders, auditors and platform engineers who want their assistant to check evidence instead of trusting a report.
30
+
31
+ Install the released package: `pip install agent-evidence-mcp==0.1.0`. It pins `probity-verify==0.1.1`, `agent-evidence-vectors==0.23.0`, `agent-evidence-vocabulary==0.6.0` and `agent-evidence-admission==0.1.2` exactly.
32
+
33
+ ## Quick start
34
+
35
+ Add it to Claude Code, then ask the assistant to run the sample claim:
36
+
37
+ ```sh
38
+ claude mcp add agent-evidence -- uvx agent-evidence-mcp@0.1.0
39
+ ```
40
+
41
+ Or install the Claude Code plugin: `/plugin install agent-evidence --marketplace probityai/agent-evidence-mcp`.
42
+
43
+ Or call a tool from Python, with no client installed beyond the package:
44
+
45
+ ```sh
46
+ uvx --from agent-evidence-mcp==0.1.0 python - <<'PY'
47
+ import asyncio
48
+ from mcp.client import Client
49
+ from mcp.client.stdio import StdioServerParameters
50
+
51
+ async def main():
52
+ async with Client(StdioServerParameters(command="agent-evidence-mcp")) as client:
53
+ result = await client.call_tool("verify_sample", {"scenario": "contradicted"})
54
+ print(result.structured_content["decision"], result.structured_content["reason"])
55
+
56
+ asyncio.run(main())
57
+ PY
58
+ ```
59
+
60
+ It prints:
61
+
62
+ ```text
63
+ contradicted selected_span_missing_from_record
64
+ ```
65
+
66
+ A passage the report quotes is missing from the source capture, so the claim is contradicted. Use `supported` or `not_established` as the scenario for the other two decisions.
67
+
68
+ ## Tools
69
+
70
+ Seven tools, all read-only, offline and bounded: `verify_claim`, `verify_sample`, `list_vector_corpora`, `run_vectors`, `explain_vector`, `lookup_term` and `check_artifact_digest`. Nothing is fetched, written or sent.
71
+
72
+ ## Status
73
+
74
+ Version 0.1.0. The tests run every tool through a real MCP client against the shipped corpus, and a mutation check confirms they fail when a tool's output is broken. `canonicalize_json` and `verify_dsse` come later, once their Rust crates ship Python wheels.
75
+
76
+ ## Documentation
77
+
78
+ | page | read it for |
79
+ | --- | --- |
80
+ | [Tools](https://github.com/probityai/agent-evidence-mcp/blob/main/docs/tools.md) | every tool, its arguments and what it returns |
81
+ | [Install](https://github.com/probityai/agent-evidence-mcp/blob/main/docs/install.md) | Claude Code, Gemini CLI, Docker and plain stdio |
82
+ | [Agent guide](https://github.com/probityai/agent-evidence-mcp/blob/main/llms.txt) | a short index for agents using the server |
83
+ | [Changing the repository](https://github.com/probityai/agent-evidence-mcp/blob/main/AGENTS.md) | the commands to run and what never to hand-edit |
84
+
85
+ ## License
86
+
87
+ Apache-2.0.
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/agent_evidence_mcp/__init__.py
5
+ src/agent_evidence_mcp/server.py
6
+ src/agent_evidence_mcp/tools.py
7
+ src/agent_evidence_mcp.egg-info/PKG-INFO
8
+ src/agent_evidence_mcp.egg-info/SOURCES.txt
9
+ src/agent_evidence_mcp.egg-info/dependency_links.txt
10
+ src/agent_evidence_mcp.egg-info/entry_points.txt
11
+ src/agent_evidence_mcp.egg-info/requires.txt
12
+ src/agent_evidence_mcp.egg-info/top_level.txt
13
+ tests/test_tools.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ agent-evidence-mcp = agent_evidence_mcp.server:main
@@ -0,0 +1,9 @@
1
+ mcp==2.3.0
2
+ pyyaml==6.0.3
3
+ probity-verify==0.1.1
4
+ agent-evidence-vectors==0.23.0
5
+ agent-evidence-vocabulary==0.6.0
6
+ agent-evidence-admission==0.1.2
7
+
8
+ [test]
9
+ pytest==9.1.1
@@ -0,0 +1 @@
1
+ agent_evidence_mcp
@@ -0,0 +1,240 @@
1
+ """Every tool runs against the real packages and the real shipped corpus. Nothing is mocked."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import asyncio
6
+ import base64
7
+ import hashlib
8
+ import json
9
+ import sys
10
+ from importlib import metadata, resources
11
+ from pathlib import Path
12
+
13
+ import pytest
14
+ from mcp.client import Client
15
+ from mcp.client.stdio import StdioServerParameters
16
+
17
+ from agent_evidence_mcp.server import TOOLS, build_server
18
+ from conftest import call
19
+
20
+ SAMPLES = Path(str(resources.files("probity_verify") / "samples"))
21
+ JUNE_POLICY_SHA = "dfda1551714f92702169d1411af6b0bfeee54732f934ce71265534af775fa388"
22
+
23
+
24
+ def _sample_inputs(case: str, policy: str) -> dict:
25
+ artifacts = {
26
+ p.name: p.read_text(encoding="utf-8") for p in SAMPLES.iterdir() if p.suffix in {".txt", ".html"}
27
+ }
28
+ return {
29
+ "case": json.loads((SAMPLES / case).read_text(encoding="utf-8")),
30
+ "policy": json.loads((SAMPLES / policy).read_text(encoding="utf-8")),
31
+ "artifacts": artifacts,
32
+ }
33
+
34
+
35
+ # --- listing and annotations ---------------------------------------------------------
36
+
37
+ def test_every_tool_is_annotated_read_only_titled_and_short() -> None:
38
+ async def listing():
39
+ async with Client(build_server()) as client:
40
+ return (await client.list_tools()).tools
41
+
42
+ tools = asyncio.run(listing())
43
+ assert {t.name for t in tools} == {f.__name__ for f, _ in TOOLS}
44
+ for tool in tools:
45
+ assert len(tool.name) < 64
46
+ assert tool.title and tool.annotations is not None
47
+ assert tool.annotations.title == tool.title
48
+ assert tool.annotations.read_only_hint is True
49
+ assert tool.annotations.destructive_hint is False
50
+ assert tool.annotations.open_world_hint is False
51
+
52
+
53
+ def test_serves_over_stdio() -> None:
54
+ async def run():
55
+ params = StdioServerParameters(command=sys.executable, args=["-m", "agent_evidence_mcp.server"])
56
+ async with Client(params) as client:
57
+ return await client.call_tool("verify_sample", {"scenario": "contradicted"})
58
+
59
+ result = asyncio.run(run())
60
+ assert result.structured_content["decision"] == "contradicted"
61
+
62
+
63
+ # --- verify_claim / verify_sample ----------------------------------------------------
64
+
65
+ @pytest.mark.parametrize(
66
+ ("scenario", "decision", "reason"),
67
+ [
68
+ ("contradicted", "contradicted", "selected_span_missing_from_record"),
69
+ ("not_established", "not_established", "witness_outside_source_window"),
70
+ ("supported", "supported", "all_selected_spans_present"),
71
+ ],
72
+ )
73
+ def test_verify_sample_decisions(scenario: str, decision: str, reason: str) -> None:
74
+ out = call("verify_sample", {"scenario": scenario})
75
+ assert (out["decision"], out["reason"]) == (decision, reason)
76
+ assert out["packet"].startswith("Probity decision packet v1")
77
+ assert f"Decision: {decision}" in out["packet"]
78
+
79
+
80
+ def test_verify_sample_reports_its_checks() -> None:
81
+ assert len(call("verify_sample", {"scenario": "contradicted"})["checks"]) == 1
82
+ assert call("verify_sample", {"scenario": "not_established"})["checks"] == []
83
+
84
+
85
+ def test_verify_sample_binds_the_policy_bytes() -> None:
86
+ assert call("verify_sample", {"scenario": "contradicted"})["policy_sha256"] == JUNE_POLICY_SHA
87
+
88
+
89
+ def test_verify_sample_rejects_unknown_scenario() -> None:
90
+ out = call("verify_sample", {"scenario": "nope"})
91
+ assert out["ok"] is False and "scenario" in out["error"]
92
+
93
+
94
+ def test_verify_claim_matches_the_sample_run() -> None:
95
+ sample = call("verify_sample", {"scenario": "contradicted"})
96
+ direct = call("verify_claim", _sample_inputs("case.json", "policy-june.json"))
97
+ assert direct["decision"] == sample["decision"] == "contradicted"
98
+ assert direct["policy_sha256"] == JUNE_POLICY_SHA
99
+ assert direct["checks"] == sample["checks"]
100
+
101
+
102
+ def test_verify_claim_changes_its_decision_when_the_evidence_changes() -> None:
103
+ inputs = _sample_inputs("case-complete.json", "policy-complete.json")
104
+ assert call("verify_claim", inputs)["decision"] == "supported"
105
+ inputs["artifacts"]["report-complete.txt"] = "nothing the source said"
106
+ changed = call("verify_claim", inputs)
107
+ assert changed["ok"] is False and "binding_mismatch" in changed["error"]
108
+
109
+
110
+ @pytest.mark.parametrize("name", ["../escape.txt", "/etc/passwd", "a/../../b"])
111
+ def test_verify_claim_refuses_artifact_paths_outside_the_case(name: str) -> None:
112
+ inputs = _sample_inputs("case.json", "policy-june.json")
113
+ inputs["artifacts"][name] = "x"
114
+ out = call("verify_claim", inputs)
115
+ assert out["ok"] is False and "relative" in out["error"]
116
+
117
+
118
+ def test_verify_claim_reports_invalid_input_without_a_verdict() -> None:
119
+ out = call("verify_claim", {"case": {}, "policy": {}})
120
+ assert out["ok"] is False and "decision" not in out
121
+
122
+
123
+ # --- vectors -------------------------------------------------------------------------
124
+
125
+ def test_corpora_listing_has_the_main_corpus_with_its_count() -> None:
126
+ out = call("list_vector_corpora")
127
+ rows = {r["corpus"]: r for r in out["corpora"]}
128
+ assert out["total"] == len(rows) >= 30
129
+ assert rows["vectors"]["vectors"] == 288
130
+
131
+
132
+ def test_run_vectors_replays_the_main_corpus_clean() -> None:
133
+ out = call("run_vectors", {"corpus": "vectors", "limit": 5})
134
+ assert out["exit_code"] == 0
135
+ assert out["release"] == metadata.version("agent-evidence-vectors")
136
+ assert out["totals"]["vectors"] == 288 and out["totals"]["pass"] == 288 and out["totals"]["fail"] == 0
137
+ assert len(out["page"]) == 5 and out["next_offset"] == 5
138
+ assert all(row["status"] == "PASS" for row in out["page"])
139
+
140
+
141
+ def test_run_vectors_pages_to_the_end() -> None:
142
+ out = call("run_vectors", {"corpus": "vectors", "offset": 280, "limit": 50})
143
+ assert len(out["page"]) == 8 and out["next_offset"] is None
144
+
145
+
146
+ def test_run_vectors_final_page_that_ends_exactly_at_the_corpus_end_has_no_next() -> None:
147
+ out = call("run_vectors", {"corpus": "vectors", "offset": 238, "limit": 50})
148
+ assert len(out["page"]) == 50 and out["next_offset"] is None
149
+
150
+
151
+ def test_run_vectors_replays_a_second_corpus_with_a_report() -> None:
152
+ out = call("run_vectors", {"corpus": "vectors-agent-change-admission", "limit": 3})
153
+ assert out["ok"] and out["totals"]["fail"] == 0 and out["totals"]["vectors"] == 35
154
+
155
+
156
+ def test_run_vectors_returns_the_text_verdict_for_a_corpus_without_a_report() -> None:
157
+ out = call("run_vectors", {"corpus": "vectors-admission"})
158
+ assert out["ok"] is True and out["report"] is None and out["exit_code"] == 0
159
+ assert "every member behaves as MANIFEST.json declares" in out["output"]
160
+
161
+
162
+ def test_run_vectors_surfaces_a_corpus_that_needs_an_external_verifier() -> None:
163
+ out = call("run_vectors", {"corpus": "vectors-source-coverage"})
164
+ assert out["ok"] is False and out["exit_code"] == 2 and "external verifier" in out["error"]
165
+
166
+
167
+ def test_run_vectors_refuses_an_unknown_corpus() -> None:
168
+ assert call("run_vectors", {"corpus": "../etc"})["ok"] is False
169
+
170
+
171
+ def test_explain_vector_returns_entry_and_input_bytes() -> None:
172
+ out = call("explain_vector", {"vector_id": "vcf20eae7df4f1f1b"})
173
+ assert out["entry"]["conditions"] == ["aee-c-1", "aee-c-3", "aee-c-12", "aee-c-28", "aee-c-50"]
174
+ assert out["entry"]["expected"] == {"verdict": "valid", "result": "fail"}
175
+ assert json.loads(out["input"]) and out["input_bytes"] > 0
176
+
177
+
178
+ def test_explain_vector_unknown_id_and_path_like_id() -> None:
179
+ assert call("explain_vector", {"vector_id": "nope"})["ok"] is False
180
+ assert call("explain_vector", {"vector_id": "../MANIFEST"})["ok"] is False
181
+
182
+
183
+ # --- vocabulary ----------------------------------------------------------------------
184
+
185
+ def test_lookup_term_finds_a_term() -> None:
186
+ out = call("lookup_term", {"term": "observation_vantage"})
187
+ match = out["matches"][0]
188
+ assert match["values"] == ["substrate", "artifact"] and match["status"] == "proposed"
189
+ assert out["vocabulary_version"] == metadata.version("agent-evidence-vocabulary")
190
+ assert "substrate" in match["definition"]
191
+
192
+
193
+ def test_lookup_term_suggests_close_terms_and_never_invents() -> None:
194
+ out = call("lookup_term", {"term": "vantage"})
195
+ assert out["ok"] is False and "observation_vantage" in out["close_terms"]
196
+ assert call("lookup_term", {"term": "zzzz"})["close_terms"] == []
197
+
198
+
199
+ # --- digest check --------------------------------------------------------------------
200
+
201
+ ARTIFACT = "the artifact bytes"
202
+ DIGEST = hashlib.sha256(ARTIFACT.encode()).hexdigest()
203
+ STATEMENT = json.dumps({"subject": [{"name": "a", "digest": {"sha256": DIGEST}}]})
204
+
205
+
206
+ def test_digest_match_admits() -> None:
207
+ out = call("check_artifact_digest", {"document": STATEMENT, "artifact_text": ARTIFACT})
208
+ assert out["admitted"] is True and out["matched"] == {"algorithm": "sha256", "digest": DIGEST}
209
+
210
+
211
+ def test_digest_mismatch_refuses_with_the_declared_digest() -> None:
212
+ out = call("check_artifact_digest", {"document": STATEMENT, "artifact_text": ARTIFACT + "!"})
213
+ assert out["admitted"] is False and out["reason"] == "digest-mismatch"
214
+ assert out["declared"] == [{"algorithm": "sha256", "digest": DIGEST}]
215
+
216
+
217
+ def test_document_naming_no_digest_refuses() -> None:
218
+ out = call("check_artifact_digest", {"document": "{}", "artifact_text": ARTIFACT})
219
+ assert out["admitted"] is False and out["reason"] == "no-digest-named"
220
+
221
+
222
+ def test_base64_artifact_and_argument_errors() -> None:
223
+ b64 = base64.b64encode(ARTIFACT.encode()).decode()
224
+ assert call("check_artifact_digest", {"document": STATEMENT, "artifact_base64": b64})["admitted"] is True
225
+ assert call("check_artifact_digest", {"document": STATEMENT})["ok"] is False
226
+ assert call("check_artifact_digest", {"document": STATEMENT, "artifact_base64": "!!"})["ok"] is False
227
+ assert call("check_artifact_digest", {"document": "not json", "artifact_text": "x"})["ok"] is False
228
+
229
+
230
+ # --- pins ----------------------------------------------------------------------------
231
+
232
+ def test_every_package_is_pinned_exactly_and_installed_at_that_pin() -> None:
233
+ requires = [r for r in metadata.requires("agent-evidence-mcp") or [] if "extra ==" not in r]
234
+ pins = dict(r.split("==") for r in requires)
235
+ assert set(pins) == {
236
+ "mcp", "pyyaml", "probity-verify", "agent-evidence-vectors",
237
+ "agent-evidence-vocabulary", "agent-evidence-admission",
238
+ }
239
+ for name, version in pins.items():
240
+ assert metadata.version(name) == version