Production-grade MCP client SDK for Pleroma Core — send SemanticIntent to the Pleroma Guardian
Project description
Pleroma MCP Client SDK — v1.0.0 (Production-Ready)
Python client for Pleroma Core — send SemanticIntent to the Pleroma Guardian and receive structured, formally verified ExecutionReceipt responses.
Designed for robust agentic workflows, Pleroma Client manages network framing, connection tracking, real-time rate limiting, and standard authentication out-of-the-box.
Features
- Documented & Safe Handshakes: Connects via plain TCP or secure TLS with automatic API key authentication.
- Formal Guarantee integration: Passes
SemanticIntentto the Pleroma Cedar Guardian for constitutional compliance checking (SAT/UNSAT evaluation). - Execution Engine Interfacing: Executes secure WASM modules within Pleroma's Saga Engine sandbox with rollbacks on failure.
- Granular WASI Capability Negotiation: Pass sandboxed system capability requests (
FsRead,FsWrite, etc.) directly to the runtime. - Strict Error Handling: Differentiates gracefully between
SUCCESS,BLOCKED(constitutional rejection),ROLLED_BACK(WASM trap/non-zero exit),RATE_LIMITED, andAUTH_FAILED.
Installation
Install the package in your Python environment:
# Setup virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install package in editable mode with development dependencies
pip install -e ".[dev]"
Quick Start
import asyncio
from pleroma_client import PleromaClient, execute_forensic_tool
async def main():
# Establishes framed TCP connection and performs handshake
async with PleromaClient(host="localhost", port=9090, api_key="your-api-key") as client:
# Construct and send a semantic forensic intent
intent = execute_forensic_tool("descompilador_ast", "abc123")
# Execute securely under constitutional authorization
receipt = await client.send_intent(intent)
if receipt.is_success:
print(f"Success: {receipt.message}")
elif receipt.is_blocked:
print(f"Blocked by constitution: {receipt.reason}")
else:
print(f"Error ({receipt.status}): {receipt.reason}")
if __name__ == "__main__":
asyncio.run(main())
Protocol & Architecture
Pleroma Client communicates with Pleroma Core using a framed TCP/TLS protocol:
- TCP Connection: Client establishes connection to the Pleroma socket (default:
localhost:9090). - Auth Handshake: If
PLEROMA_API_KEYis set in the environment or client configuration, the client immediately sends{"type": "auth", "token": "<key>"}as framed bytes and receives{"status": "AUTH_OK"}. - Intent Execution:
- Client frames
SemanticIntentJSON and sends it. - Pleroma Core verifies compliance using Cedar Policies.
- If permitted (SAT), Pleroma Core's Saga Engine runs the target WASM module.
- If execution fails or traps, the transaction is rolled back.
- Client receives a structured
ExecutionReceipt.
- Client frames
Data Models
SemanticIntent
| Field | Type | Description |
|---|---|---|
id |
str |
Unique transaction ID (UUIDv4) |
action |
str |
Action namespace / tool to execute (e.g. ejecutar_herramienta_forense) |
target |
str |
Resource path URI (e.g. plexor://fs/tmp/analisis.wasm) |
payload |
bytes |
Optional raw binary WASM or data payload |
wasi_capabilities |
list[str] |
Optional list of required WASI sandbox permissions (e.g. ["read", "write"]) |
Standard API Tools
Use the built-in helper functions to quickly instantiate standard semantic intents:
from pleroma_client import read_file_semantic, execute_forensic_tool, emit_alert
# 1. Read episodic memory
intent = read_file_semantic("recent security incidents")
# 2. Run a forensic tool
intent = execute_forensic_tool("descompilador_ast", "hash_value")
# 3. Emit system operator alert
intent = emit_alert("warning", "Unauthorized kernel action blocked")
Troubleshooting & Verification
To run unit and integration tests:
# Run existing tests suite
pytest
# Run the strict E2E tests against a compiled Rust binary
pytest tests/test_e2e.py
License
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pleroma_client-1.0.0.tar.gz.
File metadata
- Download URL: pleroma_client-1.0.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1db15a2bbc6ff8a3179c2e03fb7ea15905560a2a94f240f2cc219e3984f481a1
|
|
| MD5 |
7a25b85d72ee98db90e1ce04b280ef7f
|
|
| BLAKE2b-256 |
cac886b8550cd8bd04bb9f77ee25f1452c538278775c4b381860bf35afb14e99
|
File details
Details for the file pleroma_client-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pleroma_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e520dea9dc144b1bc7ed2226e46a8605999121e90a0ea294402ec459c98999f8
|
|
| MD5 |
18dec5cdc2c5ee9f350994305cefee05
|
|
| BLAKE2b-256 |
5d082e36566d9da3d607c62b4e9584c6673dd0e1a5b46b382b326a665ce7f763
|