merofoundry-client
Async Python client for the MeroFoundry public API.
MeroFoundry is a platform for building applications — data models, forms, pages and rules — and
this library is the typed, httpx-based way to drive one from Python. It is the same client the
merofoundry-mcp server is built on.
Install
pip install merofoundry-client
Requires Python 3.11 or newer.
Quick start
The client is asynchronous and is an async context manager, so the underlying connection pool is closed for you:
import asyncio
import os
from merofoundry_client import MeroFoundryClient
APP_ID = "..."
MODEL_ID = "..."
async def main() -> None:
async with MeroFoundryClient(
"https://platform.merofoundry.com",
api_key=os.environ["MEROFOUNDRY_API_KEY"],
) as client:
app = await client.get_application(APP_ID)
print(app["name"])
page = await client.list_records(APP_ID, MODEL_ID, per_page=50)
print(page["total"], "records")
for record in page["items"]:
print(record["id"], record["data"])
created = await client.create_record(
APP_ID, MODEL_ID, data={"title": "Hello"}, idempotency_key="hello-1"
)
print(created["id"])
asyncio.run(main())
Pass the API base URL as the host root — https://platform.merofoundry.com, not a path. The client
appends the public API prefix itself.
Authentication
Authentication is an API key, sent as X-API-Key. Keys are scoped to a single application and
carry only the permissions granted to them, so a data-plane key that can read and write records
cannot create models or delete an application. Authoring keys are considerably more powerful;
treat them accordingly.
Idempotency
Writes that create something accept an idempotency_key. Passing one makes a retry safe — the
same key returns the original record rather than creating a second one. Use it anywhere a network
error could otherwise leave you unsure whether a write landed.
Errors
Every failure raises a subclass of MeroFoundryError, so one except clause covers the library:
from merofoundry_client import (
MeroFoundryError, # base class for everything below
AuthError, # missing or invalid key
PermissionDeniedError, # key lacks the permission
CapabilityError, # the application does not offer this capability
NotFoundError,
ConflictError,
ValidationError,
StorageError,
RateLimitError,
ApiError, # anything else the API returned
)
try:
await client.get_record(APP_ID, MODEL_ID, record_id)
except NotFoundError:
...
except MeroFoundryError as exc:
# exc carries the API's own code, HTTP status and message
print(exc)
A transport failure — DNS, connection refused, timeout — also arrives as a MeroFoundryError
rather than a raw httpx exception, so callers do not have to catch two families.
What it covers
41 methods across the public API:
| Area | Methods |
|---|---|
| Applications | get_application, create_application, update_application, delete_application |
| Models and fields | list_models, get_model, create_model, update_model, delete_model, publish_model, add_field, update_field, delete_field |
| Records | list_records, get_record, search_records, create_record, update_record, delete_record |
| Files | upload_file, get_file, download_file, delete_file |
| Pages | create_page, list_pages, get_page, update_page, delete_page, render_page, get_published_page |
| Forms | create_form, update_form, delete_form |
| Rules and services | create_rule, test_rule, run_rule_event, run_saved_query, invoke_service, invoke_service_stream, set_outbound_governance |
A model must be published before records can be created against it. Adding or changing a field returns the model to draft, so re-publish after schema changes.
Status
0.1.0, pre-1.0. The API surface may still change between minor versions.
Metadata
Release files for merofoundry-client 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| merofoundry_client-0.1.0.tar.gz | 22.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| merofoundry_client-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.3 kB
Release files / merofoundry_client-0.1.0.tar.gz
| Download URL | merofoundry_client-0.1.0.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cea429492ab7823c62728bcdc4f2931930a1ebaac1b7f525705828f32e1a6211
|
|
BLAKE2b-256 checksum How to use checksums |
f46ec063861fcf76b5e8fd986b9ac83df56b532fb9fb4f58b23b77446db06149
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / merofoundry_client-0.1.0-py3-none-any.whl
| Download URL | merofoundry_client-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3d71a3793197bd30e5ba4636868c558294dfb0ad6f366f07348cfff221fec51
|
|
BLAKE2b-256 checksum How to use checksums |
00940dc3dd587869f7422b6777b344f59530d69db47c384c057b4c6e31323467
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|