Python client¶
Purpose¶
Call trusted server APIs (for example AI capabilities and notifications) from Python backends.
Example¶
from mkp_client import MKPClient
client = MKPClient(base_url=..., client_id=..., client_secret=...)
client.ai.execute("ai.grammar_review", {"text": "..."}, user_public_id="usr_...")
client.notifications.send(
"forms.submission_received",
"user@example.com",
context={"payload": {"name": "Ada"}},
)
Package lives in sdk/python/mkp_client. Add that path to PYTHONPATH or install as a local package. Runtime dependency: httpx.
Never use this client from browser code. Forms submissions use the public site key, not server secrets.
Live prototype¶
Equivalent of client.ai.execute(...) via the docs demo proxy (so the docs page does not embed a server secret). On your product backend, call the Python client directly instead.
AI execute (docs proxy)
Code to paste on a product backend¶
from mkp_client import MKPClient
client = MKPClient(
base_url="https://YOUR_PLATFORM",
client_id="skpub_...",
client_secret="sk_...",
)
print(client.ai.execute("ai.grammar_review", {"text": "Ths is a deme."}))
print(client.notifications.send(
"docs.demo_notification",
"you@example.com",
context={"payload": {"name": "Ada"}, "demo_note": "from python client"},
))