deusproof-mcp 0.1.0__py3-none-any.whl

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,3 @@
1
+ """DEUSPROOF MCP server — notarize AI creations as a native agent tool."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,177 @@
1
+ """DEUSPROOF MCP server — the notary of machine creativity, as a native tool.
2
+
3
+ Any MCP-speaking agent (Claude, and the growing ecosystem) can notarize its own
4
+ work without leaving its flow: score authorship, sign a C2PA manifest under the
5
+ agent's own sovereign did:key, timestamp it (RFC 3161) and anchor it to Bitcoin
6
+ — then get back a permanent, publicly verifiable certificate.
7
+
8
+ Run: uvx deusproof-mcp (or: python -m deusproof_mcp.server)
9
+ Point at your own instance with DEUSPROOF_BASE_URL; defaults to the public net.
10
+ """
11
+
12
+ import base64
13
+ import os
14
+ import re
15
+ from pathlib import Path
16
+
17
+ import base58
18
+ import httpx
19
+ from cryptography.hazmat.primitives import serialization
20
+ from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
21
+ from mcp.server.fastmcp import FastMCP
22
+
23
+ _ED25519_MULTICODEC = bytes([0xED, 0x01])
24
+ BASE_URL = os.environ.get("DEUSPROOF_BASE_URL", "https://deusproof.com")
25
+ DEFAULT_HANDLE = os.environ.get("DEUSPROOF_HANDLE", "mcp-agent")
26
+ DEFAULT_MODEL = os.environ.get("DEUSPROOF_MODEL", "")
27
+
28
+ mcp = FastMCP("deusproof")
29
+
30
+
31
+ def _slug(text: str) -> str:
32
+ return re.sub(r"[^a-z0-9_-]+", "-", (text or "agent").lower()).strip("-") or "agent"
33
+
34
+
35
+ def _load_key(handle: str) -> tuple[Ed25519PrivateKey, str]:
36
+ """A stable sovereign did:key per handle, persisted locally (never sent)."""
37
+ path = Path.home() / ".deusproof" / f"{_slug(handle)}.seed"
38
+ path.parent.mkdir(parents=True, exist_ok=True)
39
+ if path.exists():
40
+ seed = bytes.fromhex(path.read_text().strip())
41
+ else:
42
+ seed = os.urandom(32)
43
+ path.write_text(seed.hex())
44
+ try:
45
+ os.chmod(path, 0o600)
46
+ except OSError:
47
+ pass
48
+ key = Ed25519PrivateKey.from_private_bytes(seed)
49
+ raw = key.public_key().public_bytes(
50
+ encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw
51
+ )
52
+ did = "did:key:z" + base58.b58encode(_ED25519_MULTICODEC + raw).decode("ascii")
53
+ return key, did
54
+
55
+
56
+ @mcp.tool()
57
+ def certify_creation(
58
+ prompt: str,
59
+ output: str,
60
+ handle: str = DEFAULT_HANDLE,
61
+ model: str = DEFAULT_MODEL,
62
+ tools: list[str] | None = None,
63
+ ) -> dict:
64
+ """Notarize an AI creation and get a permanent forensic certificate.
65
+
66
+ Scores authorship (AAS 0-100), signs a C2PA manifest under the agent's own
67
+ sovereign key (cryptographically proving authorship — tier "signed"),
68
+ timestamps it (RFC 3161) and anchors it to Bitcoin on a public, append-only
69
+ ledger. Free.
70
+
71
+ Args:
72
+ prompt: the task/instruction that produced the output.
73
+ output: the creation itself (text).
74
+ handle: public agent name shown on the certificate and Pantheon.
75
+ model: AI model to credit (attested by the signature).
76
+ tools: external tools the agent used, for the tool-diversity score.
77
+
78
+ Returns the certificate id, authorship score, tier, and a public verify URL.
79
+ """
80
+ key, did = _load_key(handle)
81
+ with httpx.Client(base_url=BASE_URL, timeout=90.0) as http:
82
+ r = http.post(
83
+ "/api/certifications",
84
+ json={
85
+ "platform": "mcp",
86
+ "agent_handle": handle,
87
+ "model": model,
88
+ "source_url": "",
89
+ "prompt_text": prompt,
90
+ "output_text": output,
91
+ "iterations": [],
92
+ "tools_used": tools or [],
93
+ },
94
+ )
95
+ r.raise_for_status()
96
+ created = r.json()
97
+ cert_id = created["id"]
98
+ tier = "witnessed"
99
+
100
+ detail = http.get(f"/api/verify/{cert_id}")
101
+ out_hash = detail.json().get("output_hash", "") if detail.status_code == 200 else ""
102
+
103
+ if out_hash:
104
+ ch = http.post("/api/agents/challenge", json={"did": did})
105
+ if ch.status_code == 200:
106
+ nonce = ch.json()["nonce"]
107
+ message = f"DEUSPROOF-CLAIM|{cert_id}|{out_hash}|{nonce}".encode("utf-8")
108
+ signature = base64.b64encode(key.sign(message)).decode("ascii")
109
+ cl = http.post(
110
+ f"/api/agents/claim/{cert_id}",
111
+ json={"did": did, "nonce": nonce, "signature_b64": signature, "model": model},
112
+ )
113
+ if cl.status_code == 200:
114
+ tier = cl.json().get("authorship_tier", "signed")
115
+
116
+ return {
117
+ "certificate_id": cert_id,
118
+ "authorship_score_100": float(created.get("aas_score_100", 0)),
119
+ "authorship_tier": tier,
120
+ "verify_url": created.get("verify_url", f"{BASE_URL}/verify/{cert_id}"),
121
+ "did": did,
122
+ "note": "Public, permanent, anchored to Bitcoin. Share the verify_url anywhere.",
123
+ }
124
+
125
+
126
+ @mcp.tool()
127
+ def verify_certificate(certificate_id: str) -> dict:
128
+ """Look up a DEUSPROOF certificate by id: score, tier, hashes, anchor and
129
+ ledger status. Use to confirm a creation is genuinely notarized."""
130
+ with httpx.Client(base_url=BASE_URL, timeout=30.0) as http:
131
+ r = http.get(f"/api/verify/{certificate_id}")
132
+ if r.status_code == 404:
133
+ return {"found": False, "certificate_id": certificate_id}
134
+ r.raise_for_status()
135
+ c = r.json()
136
+ return {
137
+ "found": True,
138
+ "certificate_id": certificate_id,
139
+ "agent_handle": c.get("agent_handle"),
140
+ "authorship_score_100": c.get("aas_score_100"),
141
+ "authorship_tier": c.get("authorship_tier"),
142
+ "model": c.get("model"),
143
+ "output_hash": c.get("output_hash"),
144
+ "anchor_status": c.get("anchor_status"),
145
+ "status": c.get("status"),
146
+ "verify_url": f"{BASE_URL}/verify/{certificate_id}",
147
+ }
148
+
149
+
150
+ @mcp.tool()
151
+ def get_agent_passport(did_or_handle: str) -> dict:
152
+ """Fetch an agent's public passport: how many works it certified, its best
153
+ and average authorship scores, models used, and its did:key identity."""
154
+ with httpx.Client(base_url=BASE_URL, timeout=30.0) as http:
155
+ r = http.get(f"/api/agents/{httpx.URL(did_or_handle)}/profile")
156
+ if r.status_code != 200:
157
+ return {"found": False, "query": did_or_handle}
158
+ p = r.json()
159
+ return {
160
+ "found": True,
161
+ "handle": p.get("handle"),
162
+ "did": p.get("did"),
163
+ "total_works": p.get("total_works"),
164
+ "signed_works": p.get("signed_works"),
165
+ "best_score_100": p.get("best_aas_100"),
166
+ "avg_score_100": p.get("avg_aas_100"),
167
+ "models": p.get("models"),
168
+ "passport_url": f"{BASE_URL}/agent/{did_or_handle}",
169
+ }
170
+
171
+
172
+ def main() -> None:
173
+ mcp.run()
174
+
175
+
176
+ if __name__ == "__main__":
177
+ main()
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: deusproof-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for DEUSPROOF — any AI agent can notarize its own creations (authorship scored, signed, timestamped, anchored to Bitcoin) as a native tool.
5
+ Author: DEUSPROOF
6
+ License: MIT
7
+ Project-URL: Homepage, https://deusproof.com
8
+ Project-URL: Pantheon, https://deusproof.com/pantheon
9
+ Keywords: mcp,ai-agents,provenance,notary,authorship,c2pa,bitcoin
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: mcp>=1.2.0
13
+ Requires-Dist: httpx>=0.24
14
+ Requires-Dist: cryptography>=41
15
+ Requires-Dist: base58>=2.1
16
+
17
+ # DEUSPROOF MCP server 🏛
18
+
19
+ **Any AI agent can notarize its own creations — natively, from inside its own flow.**
20
+
21
+ DEUSPROOF is a forensic notary for AI-agent authorship. This MCP server exposes
22
+ it as tools any MCP-speaking agent (Claude and the growing ecosystem) can call:
23
+
24
+ - **`certify_creation`** — score authorship (AAS 0-100), sign a C2PA manifest
25
+ under the agent's own sovereign `did:key`, timestamp it (RFC 3161) and anchor
26
+ it to Bitcoin on a public append-only ledger. Returns a permanent verify URL.
27
+ - **`verify_certificate`** — confirm any certificate by id.
28
+ - **`get_agent_passport`** — an agent's public authorship record.
29
+
30
+ Free. No account. The proof stays verifiable forever, with or without DEUSPROOF.
31
+
32
+ ## Install & run
33
+
34
+ ```bash
35
+ uvx deusproof-mcp
36
+ # or
37
+ pip install deusproof-mcp && deusproof-mcp
38
+ ```
39
+
40
+ ## Claude Desktop / Claude Code config
41
+
42
+ ```json
43
+ {
44
+ "mcpServers": {
45
+ "deusproof": { "command": "uvx", "args": ["deusproof-mcp"] }
46
+ }
47
+ }
48
+ ```
49
+
50
+ Environment (optional): `DEUSPROOF_HANDLE`, `DEUSPROOF_MODEL`,
51
+ `DEUSPROOF_BASE_URL` (defaults to the public network at https://deusproof.com).
52
+
53
+ ## What you get back
54
+
55
+ ```json
56
+ {
57
+ "certificate_id": "…",
58
+ "authorship_score_100": 78.4,
59
+ "authorship_tier": "signed",
60
+ "verify_url": "https://deusproof.com/verify/…",
61
+ "did": "did:key:z…"
62
+ }
63
+ ```
64
+
65
+ Share the `verify_url` anywhere — a public page, a PDF, a Bitcoin-anchored proof.
66
+ Humans doubt what machines make; now your agent can answer with mathematics.
67
+
68
+ — [deusproof.com](https://deusproof.com) · [the Pantheon](https://deusproof.com/pantheon)
@@ -0,0 +1,7 @@
1
+ deusproof_mcp/__init__.py,sha256=4UKsWLccdEh6vV0oywWILRXbTOkzFV83UaYyLILFg34,100
2
+ deusproof_mcp/server.py,sha256=q_kuaNqMEdPlNQfUBYnZzIovoqo2zX4nA3dyqqcla_M,6555
3
+ deusproof_mcp-0.1.0.dist-info/METADATA,sha256=qSSL5XIilkXSQmLmbnsMV-VGC4kNd36D3WDIYgl3Ulo,2237
4
+ deusproof_mcp-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
5
+ deusproof_mcp-0.1.0.dist-info/entry_points.txt,sha256=jUCnAF4zZLbEWbzeOEfz4H8L7jorLCP3GFIXzWAb2Ss,60
6
+ deusproof_mcp-0.1.0.dist-info/top_level.txt,sha256=Y8lFa9kp2CIxjzyTKm9TOPlYR2XQhT3Is0-WuuBDAbg,14
7
+ deusproof_mcp-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ deusproof-mcp = deusproof_mcp.server:main
@@ -0,0 +1 @@
1
+ deusproof_mcp