writ-mcp 0.2.2__tar.gz → 0.2.3__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.
- {writ_mcp-0.2.2/src/writ_mcp.egg-info → writ_mcp-0.2.3}/PKG-INFO +2 -1
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/README.md +1 -0
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/pyproject.toml +1 -1
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/src/writ_mcp/__init__.py +1 -1
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/src/writ_mcp/server.py +23 -0
- {writ_mcp-0.2.2 → writ_mcp-0.2.3/src/writ_mcp.egg-info}/PKG-INFO +2 -1
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/src/writ_mcp.egg-info/SOURCES.txt +2 -1
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/tests/test_server.py +2 -1
- writ_mcp-0.2.3/tests/test_verify_receipts.py +70 -0
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/LICENSE +0 -0
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/setup.cfg +0 -0
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/src/writ_mcp.egg-info/dependency_links.txt +0 -0
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/src/writ_mcp.egg-info/entry_points.txt +0 -0
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/src/writ_mcp.egg-info/requires.txt +0 -0
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/src/writ_mcp.egg-info/top_level.txt +0 -0
- {writ_mcp-0.2.2 → writ_mcp-0.2.3}/tests/test_lease_execute.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: writ-mcp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Writ MCP server: point-of-action policy checks for AI agent writes (ALLOW/DENY/STEP_UP) with a tamper-evident audit log
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://withwrit.com
|
|
@@ -106,6 +106,7 @@ The tool descriptions teach the agent this flow, but the short version:
|
|
|
106
106
|
| `writ_grant` | sponsor | Approve a STEP_UP (one-time grant) |
|
|
107
107
|
| `writ_revoke` / `writ_reinstate` | sponsor | Kill switch on/off for a principal |
|
|
108
108
|
| `writ_receipts` | agent | Audit trail of decisions |
|
|
109
|
+
| `writ_verify_receipts` | agent | Verify the audit-log hash chain |
|
|
109
110
|
| `writ_policy` | agent | Tenant verb policy |
|
|
110
111
|
| `writ_sandbox` | anyone | Free 90-second demo grant, no key needed |
|
|
111
112
|
| `writ_github_installations` | admin | List connected GitHub App installations |
|
|
@@ -90,6 +90,7 @@ The tool descriptions teach the agent this flow, but the short version:
|
|
|
90
90
|
| `writ_grant` | sponsor | Approve a STEP_UP (one-time grant) |
|
|
91
91
|
| `writ_revoke` / `writ_reinstate` | sponsor | Kill switch on/off for a principal |
|
|
92
92
|
| `writ_receipts` | agent | Audit trail of decisions |
|
|
93
|
+
| `writ_verify_receipts` | agent | Verify the audit-log hash chain |
|
|
93
94
|
| `writ_policy` | agent | Tenant verb policy |
|
|
94
95
|
| `writ_sandbox` | anyone | Free 90-second demo grant, no key needed |
|
|
95
96
|
| `writ_github_installations` | admin | List connected GitHub App installations |
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "writ-mcp"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.3"
|
|
8
8
|
description = "Writ MCP server: point-of-action policy checks for AI agent writes (ALLOW/DENY/STEP_UP) with a tamper-evident audit log"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -302,6 +302,29 @@ def writ_receipts(limit: int = 10) -> str:
|
|
|
302
302
|
return _fmt({"error": str(e), "status": e.status, "detail": e.payload})
|
|
303
303
|
|
|
304
304
|
|
|
305
|
+
@mcp.tool()
|
|
306
|
+
def writ_verify_receipts(limit: int = 200) -> str:
|
|
307
|
+
"""Verify the tenant audit-log hash chain and report whether it is intact.
|
|
308
|
+
|
|
309
|
+
Walks the tenant's receipt chain from its head, recomputing every visited
|
|
310
|
+
receipt's HMAC. This is the endpoint behind `./writ verify-chain`: use it
|
|
311
|
+
to prove the audit log has not been tampered with.
|
|
312
|
+
|
|
313
|
+
Args:
|
|
314
|
+
limit: Max receipts to verify, newest first. Default 200, clamped to
|
|
315
|
+
the range 1..1000.
|
|
316
|
+
|
|
317
|
+
Returns the gate payload verbatim: ok (chain intact), checked (receipts
|
|
318
|
+
verified), tip and tipReceipt (chain head), chainedFrom, legacyCount, and
|
|
319
|
+
complete. Verification stops at legacy (pre-chain) receipts and reports
|
|
320
|
+
them as legacyCount.
|
|
321
|
+
"""
|
|
322
|
+
try:
|
|
323
|
+
n = min(1000, max(1, limit))
|
|
324
|
+
return _fmt(_key_call("GET", f"/v1/receipts/verify?limit={n}"))
|
|
325
|
+
except WritError as e:
|
|
326
|
+
return _fmt({"error": str(e), "status": e.status, "detail": e.payload})
|
|
327
|
+
|
|
305
328
|
@mcp.tool()
|
|
306
329
|
def writ_policy() -> str:
|
|
307
330
|
"""Read the tenant's verb policy: which verbs allow, deny, require a grant, or step up."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: writ-mcp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Writ MCP server: point-of-action policy checks for AI agent writes (ALLOW/DENY/STEP_UP) with a tamper-evident audit log
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://withwrit.com
|
|
@@ -106,6 +106,7 @@ The tool descriptions teach the agent this flow, but the short version:
|
|
|
106
106
|
| `writ_grant` | sponsor | Approve a STEP_UP (one-time grant) |
|
|
107
107
|
| `writ_revoke` / `writ_reinstate` | sponsor | Kill switch on/off for a principal |
|
|
108
108
|
| `writ_receipts` | agent | Audit trail of decisions |
|
|
109
|
+
| `writ_verify_receipts` | agent | Verify the audit-log hash chain |
|
|
109
110
|
| `writ_policy` | agent | Tenant verb policy |
|
|
110
111
|
| `writ_sandbox` | anyone | Free 90-second demo grant, no key needed |
|
|
111
112
|
| `writ_github_installations` | admin | List connected GitHub App installations |
|
|
@@ -14,6 +14,7 @@ EXPECTED_TOOLS = {
|
|
|
14
14
|
"writ_revoke",
|
|
15
15
|
"writ_reinstate",
|
|
16
16
|
"writ_receipts",
|
|
17
|
+
"writ_verify_receipts",
|
|
17
18
|
"writ_policy",
|
|
18
19
|
"writ_sandbox",
|
|
19
20
|
"writ_github_installations",
|
|
@@ -29,7 +30,7 @@ EXPECTED_TOOLS = {
|
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
def test_version():
|
|
32
|
-
assert writ_mcp.__version__ == "0.2.
|
|
33
|
+
assert writ_mcp.__version__ == "0.2.3"
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
def test_public_base_url_default():
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""writ_verify_receipts tests — mocked gate, no network."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
from writ_mcp import server
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
VERIFY_PAYLOAD = {
|
|
9
|
+
"ok": True,
|
|
10
|
+
"checked": 200,
|
|
11
|
+
"tip": "9f2cdeadbeef",
|
|
12
|
+
"tipReceipt": "rcpt_9d2f",
|
|
13
|
+
"chainedFrom": "rcpt_51ab",
|
|
14
|
+
"legacyCount": 0,
|
|
15
|
+
"complete": True,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class _Recorder:
|
|
20
|
+
def __init__(self, payload=None):
|
|
21
|
+
self.calls = []
|
|
22
|
+
self.payload = payload if payload is not None else VERIFY_PAYLOAD
|
|
23
|
+
|
|
24
|
+
def __call__(self, method, path, body=None):
|
|
25
|
+
self.calls.append((method, path, body))
|
|
26
|
+
return self.payload
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _raise_401(method, path, body=None):
|
|
30
|
+
raise server.WritError(401, {"error": "API key required."})
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _loads(s):
|
|
34
|
+
return json.loads(s)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_default_limit_is_200(monkeypatch):
|
|
38
|
+
rec = _Recorder()
|
|
39
|
+
monkeypatch.setattr(server, "_key_call", rec)
|
|
40
|
+
out = _loads(server.writ_verify_receipts())
|
|
41
|
+
assert out == VERIFY_PAYLOAD
|
|
42
|
+
assert rec.calls == [("GET", "/v1/receipts/verify?limit=200", None)]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_limit_zero_clamps_to_1(monkeypatch):
|
|
46
|
+
rec = _Recorder()
|
|
47
|
+
monkeypatch.setattr(server, "_key_call", rec)
|
|
48
|
+
_loads(server.writ_verify_receipts(limit=0))
|
|
49
|
+
assert rec.calls == [("GET", "/v1/receipts/verify?limit=1", None)]
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_limit_5000_clamps_to_1000(monkeypatch):
|
|
53
|
+
rec = _Recorder()
|
|
54
|
+
monkeypatch.setattr(server, "_key_call", rec)
|
|
55
|
+
_loads(server.writ_verify_receipts(limit=5000))
|
|
56
|
+
assert rec.calls == [("GET", "/v1/receipts/verify?limit=1000", None)]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_gate_payload_returned_verbatim(monkeypatch):
|
|
60
|
+
rec = _Recorder()
|
|
61
|
+
monkeypatch.setattr(server, "_key_call", rec)
|
|
62
|
+
assert _loads(server.writ_verify_receipts(limit=42)) == VERIFY_PAYLOAD
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_writ_error_surfaces_as_standard_error_json(monkeypatch):
|
|
66
|
+
monkeypatch.setattr(server, "_key_call", _raise_401)
|
|
67
|
+
out = _loads(server.writ_verify_receipts())
|
|
68
|
+
assert out["status"] == 401
|
|
69
|
+
assert "Writ API error 401" in out["error"]
|
|
70
|
+
assert out["detail"] == {"error": "API key required."}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|