mcp-assure 0.2.1__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.
Files changed (43) hide show
  1. mcp_assure-0.2.1/.github/workflows/ci.yml +27 -0
  2. mcp_assure-0.2.1/.gitignore +15 -0
  3. mcp_assure-0.2.1/AGENTS.md +9 -0
  4. mcp_assure-0.2.1/CLAIMS.md +44 -0
  5. mcp_assure-0.2.1/LICENSE +190 -0
  6. mcp_assure-0.2.1/PKG-INFO +253 -0
  7. mcp_assure-0.2.1/POST_DRAFT_X.txt +10 -0
  8. mcp_assure-0.2.1/README.md +220 -0
  9. mcp_assure-0.2.1/SECURITY.md +34 -0
  10. mcp_assure-0.2.1/THREAT_MODEL.md +69 -0
  11. mcp_assure-0.2.1/docs/HOST_WIRING.md +77 -0
  12. mcp_assure-0.2.1/examples/basic_runner.py +42 -0
  13. mcp_assure-0.2.1/examples/fastmcp_assured.py +71 -0
  14. mcp_assure-0.2.1/examples/host_demo.py +97 -0
  15. mcp_assure-0.2.1/examples/policy.example.json +26 -0
  16. mcp_assure-0.2.1/mcp_assure/__init__.py +32 -0
  17. mcp_assure-0.2.1/mcp_assure/__main__.py +125 -0
  18. mcp_assure-0.2.1/mcp_assure/args.py +56 -0
  19. mcp_assure-0.2.1/mcp_assure/engine.py +262 -0
  20. mcp_assure-0.2.1/mcp_assure/integrations/__init__.py +13 -0
  21. mcp_assure-0.2.1/mcp_assure/integrations/decorators.py +67 -0
  22. mcp_assure-0.2.1/mcp_assure/integrations/fastmcp_mw.py +132 -0
  23. mcp_assure-0.2.1/mcp_assure/integrations/fastmcp_notes.py +63 -0
  24. mcp_assure-0.2.1/mcp_assure/integrations/host.py +70 -0
  25. mcp_assure-0.2.1/mcp_assure/mcp_types.py +58 -0
  26. mcp_assure-0.2.1/mcp_assure/middleware.py +91 -0
  27. mcp_assure-0.2.1/mcp_assure/packs/__init__.py +36 -0
  28. mcp_assure-0.2.1/mcp_assure/packs/baseline.json +29 -0
  29. mcp_assure-0.2.1/mcp_assure/packs/mcp_authz_boundaries.json +54 -0
  30. mcp_assure-0.2.1/mcp_assure/packs/strict_local.json +22 -0
  31. mcp_assure-0.2.1/mcp_assure/policy.py +120 -0
  32. mcp_assure-0.2.1/mcp_assure/purple.py +191 -0
  33. mcp_assure-0.2.1/mcp_assure/purple_fixtures/authz_boundaries.json +48 -0
  34. mcp_assure-0.2.1/mcp_assure/purple_fixtures/unknown_and_injection.json +24 -0
  35. mcp_assure-0.2.1/mcp_assure/purple_fixtures/velocity_flood.json +16 -0
  36. mcp_assure-0.2.1/mcp_assure/py.typed +0 -0
  37. mcp_assure-0.2.1/mcp_assure/receipts.py +168 -0
  38. mcp_assure-0.2.1/mcp_assure/velocity.py +59 -0
  39. mcp_assure-0.2.1/mcp_assure/verity_hook.py +114 -0
  40. mcp_assure-0.2.1/pyproject.toml +50 -0
  41. mcp_assure-0.2.1/tests/test_adversarial.py +272 -0
  42. mcp_assure-0.2.1/tests/test_control_plane_v1.py +91 -0
  43. mcp_assure-0.2.1/tests/test_fastmcp_mw.py +106 -0
@@ -0,0 +1,27 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+ - name: Install
21
+ run: |
22
+ python -m pip install -U pip
23
+ pip install -e ".[dev]"
24
+ - name: Test
25
+ run: pytest -q
26
+ - name: Demo
27
+ run: python -m mcp_assure demo
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .eggs/
5
+ dist/
6
+ build/
7
+ .pytest_cache/
8
+ .coverage
9
+ htmlcov/
10
+ .venv/
11
+ venv/
12
+ *.jsonl
13
+ .DS_Store
14
+ .ruff_cache/
15
+ .mypy_cache/
@@ -0,0 +1,9 @@
1
+ # Agents working on mcp-assure
2
+
3
+ - **Facts over narrative.** Claims in README must match `CLAIMS.md` and tests.
4
+ - **No claim inflation.** Never market as a full SOC.
5
+ - **Deny by default** stays non-negotiable.
6
+ - **Handlers never run on DENY/DRY_RUN.**
7
+ - Prefer zero runtime deps for core.
8
+ - Add a property test when adding a security control.
9
+ - Do not commit real secrets, private host paths, or ADM classified material.
@@ -0,0 +1,44 @@
1
+ # Claim gate — mcp-assure
2
+
3
+ Public language must stay **≤ evidence**. Adversarial review will check this file
4
+ against README and tests.
5
+
6
+ ## Allowed now (after `pytest` green on this commit)
7
+
8
+ | Claim | Evidence |
9
+ |-------|----------|
10
+ | Deny-by-default tool authorization for agent tool calls | P1, P2 tests |
11
+ | Policy can block by velocity, blast, lab flag, freeze, forbidden args | P5–P7, P10–P11 |
12
+ | Decision receipts are hash-chained and tamper-detecting | P9 |
13
+ | Model text cannot authorize a denied call | P8 |
14
+ | Middleware does not execute tool on DENY/DRY_RUN | P3, P4 |
15
+ | Zero runtime dependencies for the core package | `pyproject.toml` |
16
+ | Built-in policy packs load and authorize only listed tools | `tests/test_control_plane_v1.py` |
17
+ | Purple fixtures (unknown tool, authz bindings, velocity) pass | `python -m mcp_assure purple` |
18
+ | Host dispatcher + decorator integration paths exist | integration tests |
19
+ | FastMCP `on_call_tool` middleware denies unknown tools without calling handler | `tests/test_fastmcp_mw.py` + async smoke |
20
+ | Optional verity hook soft-fails without verity installed | verity hook tests |
21
+
22
+ ## Not allowed (do not put on site/X yet)
23
+
24
+ | Overclaim | Why |
25
+ |-----------|-----|
26
+ | “Full SOC” / “enterprise SOC platform” | Wrong product class; no SIEM/IR product surface |
27
+ | “Stops all MCP attacks” / “unbreakable” | Out of scope per threat model |
28
+ | “CVE-proof” / scanner replacement | mcp-bench shows different problem; this is a runtime gate |
29
+ | “OAuth complete” / “implements full 2026-07-28 auth” | We check bindings when provided; we are not an AS |
30
+ | “Proven in production at scale” | No public deploy proof yet |
31
+ | Any win-rate / detection-rate % without holdout study | N/A and forbidden |
32
+
33
+ ## Recommended public wording
34
+
35
+ > **mcp-assure** is a plug-in, deny-by-default assurance layer for MCP-style tool
36
+ > calls: policy packs, rate/blast limits, resource/audience binding checks, and
37
+ > hash-chained decision receipts — with a re-runnable purple stress suite. The
38
+ > model proposes; the gate decides. It is not a full SOC and not a guarantee
39
+ > against all agent misuse.
40
+
41
+ ## State
42
+
43
+ **Candidate → Verified locally** when CI/tests pass on the published tree.
44
+ **Published** only after operator push + live install proof.
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranty or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Alex Price / StellarRequiem
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,253 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-assure
3
+ Version: 0.2.1
4
+ Summary: Deny-by-default assurance runtime for MCP tool calls: policy, velocity, blast limits, hash-chained receipts.
5
+ Project-URL: Homepage, https://github.com/StellarRequiem/mcp-assure
6
+ Project-URL: Repository, https://github.com/StellarRequiem/mcp-assure
7
+ Project-URL: Documentation, https://github.com/StellarRequiem/mcp-assure#readme
8
+ Project-URL: Issues, https://github.com/StellarRequiem/mcp-assure/issues
9
+ Author-email: Alex Price <hello@xclusivexo.com>
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: agents,assurance,audit,authorization,fastmcp,mcp,security
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Security
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Provides-Extra: dev
24
+ Requires-Dist: build>=1.2; extra == 'dev'
25
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
26
+ Requires-Dist: pytest>=8.0; extra == 'dev'
27
+ Requires-Dist: twine>=5.0; extra == 'dev'
28
+ Provides-Extra: fastmcp
29
+ Requires-Dist: fastmcp>=2.9; extra == 'fastmcp'
30
+ Provides-Extra: yaml
31
+ Requires-Dist: pyyaml>=6.0; extra == 'yaml'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # mcp-assure
35
+
36
+ [![ci](https://github.com/StellarRequiem/mcp-assure/actions/workflows/ci.yml/badge.svg)](https://github.com/StellarRequiem/mcp-assure/actions/workflows/ci.yml)
37
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)
38
+
39
+ **Deny-by-default assurance runtime for MCP-style tool calls.**
40
+
41
+ The model proposes. **The gate decides.** Receipts remember.
42
+
43
+ `mcp-assure` is a plug-in control plane you put **in front of tool execution**: policy catalog, argument constraints, optional resource/audience binding checks, velocity and blast limits, freeze mode, and **hash-chained decision receipts**. It is **not** a full SOC, not a scanner, and not a claim that all agent misuse is impossible.
44
+
45
+ Built by [Alex Price / StellarRequiem](https://xclusivexo.com). Apache-2.0. **Zero runtime dependencies** (core).
46
+ Version **0.2.1** adds policy packs, host/decorator integration, **FastMCP `on_call_tool` middleware**, purple stress fixtures, and an optional verity hook.
47
+
48
+ **Public page:** [xclusivexo.com/mcp-assurance/#mcp-assure](https://xclusivexo.com/mcp-assurance/#mcp-assure)
49
+
50
+ ## Why this exists
51
+
52
+ MCP hosts give agents tools. Tools are power. Under MCP **2026-07-28**, more security responsibility sits with implementers (stateless core, auth expectations, extensions). Scanners help at build time; **runtime authorization** is still required at the moment of `tools/call`.
53
+
54
+ ## Install
55
+
56
+ ```bash
57
+ pip install mcp-assure
58
+ # optional FastMCP middleware:
59
+ pip install "mcp-assure[fastmcp]"
60
+ # from git (development tip):
61
+ pip install "git+https://github.com/StellarRequiem/mcp-assure"
62
+ # from a checkout:
63
+ pip install -e ".[dev,fastmcp]"
64
+ ```
65
+
66
+ ## Real host demo (local)
67
+
68
+ Simulates an MCP host `tools/call` path with `AssuredToolDispatcher`:
69
+
70
+ ```bash
71
+ python examples/host_demo.py
72
+ ```
73
+
74
+ Expect: ALLOW for allowlisted tools, DENY for unknown tools / smuggled args, receipts verify.
75
+
76
+ ## 60-second integration
77
+
78
+ ```python
79
+ from mcp_assure import (
80
+ AssureEngine,
81
+ AssuredRunner,
82
+ ToolCall,
83
+ ToolPolicy,
84
+ ToolPolicyRegistry,
85
+ )
86
+
87
+ registry = ToolPolicyRegistry([
88
+ ToolPolicy(
89
+ name="read_file",
90
+ required_args=("path",),
91
+ allowed_args=("path",),
92
+ forbidden_args=("token", "password"),
93
+ max_blast=1,
94
+ ),
95
+ ])
96
+
97
+ engine = AssureEngine(registry, receipts_path="./mcp-assure-receipts.jsonl")
98
+
99
+ def read_file(args):
100
+ # your real implementation
101
+ return open(args["path"], encoding="utf-8").read()
102
+
103
+ runner = AssuredRunner(engine, handlers={"read_file": read_file})
104
+
105
+ out = runner.invoke(ToolCall(tool="read_file", arguments={"path": "README.md"}))
106
+ # out["executed"] is True only if the gate ALLOWed
107
+ # out["verdict"]["receipt_hash"] is the audit seal for this decision
108
+ ```
109
+
110
+ **Property:** on `DENY` / `DRY_RUN`, the handler is **never** called.
111
+
112
+ ## What it enforces (tested)
113
+
114
+ | ID | Property |
115
+ |----|----------|
116
+ | P1 | Unknown tool → DENY |
117
+ | P2 | Empty catalog → DENY |
118
+ | P3–P4 | DENY/DRY_RUN never invoke handlers |
119
+ | P5–P6 | Velocity / blast limits |
120
+ | P7 | `lab_only` tools require `lab_mode` |
121
+ | P8 | Model notes cannot flip DENY→ALLOW |
122
+ | P9 | Receipt chain verifies; tamper fails |
123
+ | P10 | Freeze mode blocks non-allowlisted tools |
124
+ | P11 | Forbidden / disallowed args → DENY |
125
+ | P12 | Resource/audience mismatch → DENY when configured |
126
+
127
+ See [`THREAT_MODEL.md`](./THREAT_MODEL.md) and [`CLAIMS.md`](./CLAIMS.md).
128
+
129
+ ## Policy from JSON
130
+
131
+ ```python
132
+ import json
133
+ from mcp_assure import AssureEngine, ToolPolicyRegistry
134
+
135
+ with open("examples/policy.example.json") as f:
136
+ reg = ToolPolicyRegistry.from_mapping(json.load(f))
137
+ engine = AssureEngine(reg)
138
+ ```
139
+
140
+ ## MCP-shaped payloads
141
+
142
+ ```python
143
+ from mcp_assure.mcp_types import tool_call_from_mcp
144
+ from mcp_assure import AssureEngine, ToolPolicy, ToolPolicyRegistry
145
+
146
+ engine = AssureEngine(ToolPolicyRegistry([ToolPolicy(name="echo")]))
147
+ call = tool_call_from_mcp({"name": "echo", "arguments": {"text": "hi"}})
148
+ print(engine.evaluate(call).as_dict())
149
+ ```
150
+
151
+ ## Policy packs
152
+
153
+ ```python
154
+ from mcp_assure import AssureEngine, load_pack
155
+
156
+ engine = AssureEngine(load_pack("baseline"))
157
+ # also: mcp_authz_boundaries, strict_local
158
+ ```
159
+
160
+ ```bash
161
+ python -m mcp_assure packs
162
+ ```
163
+
164
+ `mcp_authz_boundaries` encodes **runtime** gates for resource/audience-style failures (the class of bugs mcp-bench measures in scanners) — call-time enforcement, not a scanner replacement.
165
+
166
+ ## Host / FastMCP integration
167
+
168
+ ```python
169
+ from mcp_assure.integrations import AssuredToolDispatcher, assure_callable
170
+ # See mcp_assure/integrations/fastmcp_notes.py for patterns.
171
+ ```
172
+
173
+ Dispatcher is the usual host hook for `tools/call`. Decorators wrap kwargs-style tool functions before registration.
174
+
175
+ ### FastMCP middleware (`on_call_tool`)
176
+
177
+ Requires `pip install "mcp-assure[fastmcp]"` (FastMCP ≥2.9):
178
+
179
+ ```python
180
+ from fastmcp import FastMCP
181
+ from mcp_assure import AssureEngine
182
+ from mcp_assure.packs import load_pack
183
+ from mcp_assure.integrations import build_assure_middleware
184
+
185
+ engine = AssureEngine(load_pack("baseline"), receipts_path="receipts.jsonl")
186
+ mcp = FastMCP("secured")
187
+ mcp.add_middleware(build_assure_middleware(engine))
188
+
189
+ @mcp.tool
190
+ def echo(text: str) -> dict:
191
+ return {"echo": text}
192
+ ```
193
+
194
+ On DENY the middleware raises `ToolError` and **does not** call the tool handler.
195
+ Demo: `python examples/fastmcp_assured.py`
196
+
197
+ ## Purple stress suite
198
+
199
+ Synthetic adversarial sequences (no network):
200
+
201
+ ```bash
202
+ python -m mcp_assure purple
203
+ ```
204
+
205
+ ## Optional verity hook
206
+
207
+ If `verity-core` is installed, claim-like tool results can be soft-checked:
208
+
209
+ ```python
210
+ from mcp_assure.verity_hook import maybe_verify_tool_result
211
+ maybe_verify_tool_result({"accuracy": 0.99, "sample_size": 5})
212
+ ```
213
+
214
+ Not required; no-ops cleanly when verity is absent.
215
+
216
+ ## CLI
217
+
218
+ ```bash
219
+ python -m mcp_assure demo
220
+ python -m mcp_assure packs
221
+ python -m mcp_assure purple
222
+ python -m mcp_assure verify-receipts ./mcp-assure-receipts.jsonl
223
+ ```
224
+
225
+ ## Adversarial stance
226
+
227
+ This package is designed to survive **hostile review**:
228
+
229
+ - Explicit threat model and claim gate
230
+ - Properties P1–P12 locked to unit tests
231
+ - No runtime deps in the TCB surface
232
+ - Residual risk documented (host must not bypass the runner)
233
+
234
+ ```bash
235
+ pytest -q
236
+ ```
237
+
238
+ ## What this is not
239
+
240
+ - Not a replacement for OAuth authorization servers
241
+ - Not host EDR / network IDS
242
+ - Not “stops all prompt injection”
243
+ - Not a full enterprise SOC platform
244
+
245
+ ## Related work (StellarRequiem)
246
+
247
+ - [mcp-bench](https://github.com/StellarRequiem/mcp-bench) — do scanners catch authz-logic bugs?
248
+ - [scope-gate](https://github.com/StellarRequiem/scope-gate) — deny-by-default research authorization
249
+ - [verity-core](https://github.com/StellarRequiem/verity-core) — refuse bad claims; audit chains
250
+
251
+ ## License
252
+
253
+ Apache-2.0. Copyright 2026 Alex Price / StellarRequiem.
@@ -0,0 +1,10 @@
1
+ Shipped mcp-assure: a plug-in, deny-by-default gate for MCP tool calls.
2
+
3
+ Policy packs · velocity/blast limits · resource/audience checks · hash-chained receipts.
4
+ The model proposes. The gate decides. DENY never executes the handler.
5
+
6
+ Not a full SOC. Not “unbreakable.” Re-runnable: pytest + purple suite + host demo.
7
+ CI green.
8
+
9
+ https://github.com/StellarRequiem/mcp-assure
10
+ https://xclusivexo.com/mcp-assurance/#mcp-assure