Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

merofoundry_client-0.1.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

merofoundry_client-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file merofoundry_client-0.1.0.tar.gz.

File metadata

  • Download URL: merofoundry_client-0.1.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for merofoundry_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cea429492ab7823c62728bcdc4f2931930a1ebaac1b7f525705828f32e1a6211
MD5 41a68b1cf8fb0b4237b93596ad92d0ce
BLAKE2b-256 f46ec063861fcf76b5e8fd986b9ac83df56b532fb9fb4f58b23b77446db06149

See more details on using hashes here.

File details

Details for the file merofoundry_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: merofoundry_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for merofoundry_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3d71a3793197bd30e5ba4636868c558294dfb0ad6f366f07348cfff221fec51
MD5 b600dfe1fb48bd2df557b5d5a4652de9
BLAKE2b-256 00940dc3dd587869f7422b6777b344f59530d69db47c384c057b4c6e31323467

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page