sdcmodeler
The modeler's client for SDCStudio. Search the public catalog, estimate, assemble and publish an SDC4 data model, generate its package and an application. A Python client with httpx as its only dependency, a CLI, and sdcmodeler mcp, an MCP server for any agent.

Why
An agent that builds a feature decides a data model at that moment. With sdcmodeler the data is modeled in SDC by default: the agent searches the catalog first, reuses published components wherever one fits, mints only what is new, publishes the model, and takes the package. The result is interoperable because it is composed from shared, published components, and verifiable because every record validates against a published schema.
The name follows the role pattern of the other Semantic Data Charter servers: sdcvalidator validates, sdcgovernance governs, sdcreader reads, sdcmodeler models. It also names what SDCStudio calls every user: a Modeler.
Install
pip install sdcmodeler
The catalog and estimates need no account. Building needs an SDCStudio API key, created in Settings, API Keys, with the scopes and spending limit the holder should have:
export SDCSTUDIO_API_KEY=sdcs_...
The three layers
The client
from sdcmodeler import SDCStudioClient
c = SDCStudioClient() # key from $SDCSTUDIO_API_KEY, URL from $SDCSTUDIO_URL
hits = c.search_components("blood pressure", type="xdquantity")
tree = {
"label": "Vitals",
"components": [
{"ct_id": hits["results"][0]["ct_id"]}, # reuse: free
{"label": "Pulse", "data_type": "XdCount"}, # mint: 200 credits (draft and publication)
],
"clusters": [],
}
estimate = c.estimate(tree, "Vitals") # the server's estimate: reuse, mint, problems, total_credits, wallet, key, estimate_id
result = c.assemble("Vitals", tree, estimate_id=estimate["estimate_id"]) # 500 credits plus 200 per new component
Every leaf existing: the server assembles, publishes and generates the package in one call (result["mode"] == "reuse"; published and generated say so). Some leaves new: the pipeline runs and result["job_ct_id"] is polled with c.job_status(...), or c.wait_for_job(...), until completed, when the job has published and generated as asked and its result carries the model's links. publish=False leaves a draft for a person to review. The server refuses a build whose tree changed since the estimate.
A 402 is InsufficientCredits with the numbers in credits. A 403 from the key's policy (no spend scope, or past its limit) is KeyPolicyRefused. The client never funds a wallet; a person does that at the wallet page.
The CLI
sdcmodeler search "blood pressure" --type xdquantity
sdcmodeler models "patient"
sdcmodeler model <ct_id>
sdcmodeler artifact <ct_id> xsd --dir ./schemas
sdcmodeler estimate tree.json --title "Vitals"
sdcmodeler build tree.json --title "Vitals" --wait
sdcmodeler job <job_ct_id>
sdcmodeler package <ct_id> --dir ./packages
sdcmodeler app <ct_id> --profile lightweight --dir ./apps
sdcmodeler kit <ct_id> --project ./my-app
sdcmodeler ship tree.json --title "Vitals" --deliver package,kit --project ./my-app
sdcmodeler translate <ct_id> --language pt-BR --plan
sdcmodeler wallet
The MCP server
sdcmodeler mcp
A JSON-RPC 2.0 stdio server, no SDK, the way sdcvalidator and sdcgovernance are built. A client configuration needs only:
{"command": "uvx", "args": ["sdcmodeler", "mcp"], "env": {"SDCSTUDIO_API_KEY": "sdcs_..."}}
| Tool |
Does |
Spends |
search_components |
published components by label, type and project: with a key your own first (private included, scope: mine), then the public catalog |
no |
list_models, get_model |
published models and their artifact routes |
no |
estimate_model |
what a tree would reuse, mint and cost; returns estimate_id; with deliver, the whole run's total and whether the wallet and the key can pay it |
no |
build_model |
assemble, publish and generate (or publish: false for a draft); needs the estimate_id the person saw; refuses past the key's limit |
yes |
job_status |
one job by id: status, step, cost so far, the model's links |
no |
download_package |
a model's package ZIP with the key, including a model in a private project; builds a missing package first (free, once) unless generate is false |
no |
generate_app |
generate and download the application; needs confirm_charge; 1,500 credits the first time, free after |
yes |
add_supabase_kit |
write a model's Supabase kit into a project (project_dir); needs confirm_charge; charged with the application, once per model |
yes |
build_and_deliver |
one run: build, publish, wait, then deliver the package, application or kit; needs the estimate_id returned with the same deliver; refuses before building when the total cannot be paid |
yes |
estimate_translation |
what translating a published model or component into another language would reuse, copy and cost, and which enumeration values have no definition IRI; returns estimate_id; never spends, even with auto-spend |
no |
translate_model |
translate and publish (or review: true for drafts); needs the estimate_id the person saw, or an auto-spend key |
yes |
wallet |
balance in credits and the key's policy |
no |
The policy lives in the server. No spend without an estimate shown: build_model takes the estimate_id that estimate_model returned for the same title and tree in this process. Stop at the key's limit: a build whose estimate exceeds what the key may still spend is refused before the server is asked. Never pay: a 402 is reported with the wallet page's address and the tool stops. One approval per run: build_and_deliver follows the run's total the person saw, which covers the application or kit charge, so it needs no confirm_charge. No tool takes a URL, a key or a payment method as an argument; the key is the environment the server starts with.
The package or the application
get_model names the artifacts: the XSD 1.1 schema, the instance template, JSON, JSON-LD, SHACL, HTML, GraphQL. The package is a contract with no runtime attached; a feature inside an existing application implements on it, in any language, validating every record locally with sdcvalidator. The generated application (lightweight or enterprise profile) is a Django implementation on the same package, right when the feature is a new service. The Supabase kit is the same for a TypeScript app on Supabase: typed code for the model's records, migrations, and a gate (an Edge Function) that validates every record against the published model before storing it. sdcmodeler kit and add_supabase_kit write it into the project: the first model brings the project base, each further one adds its kit and one migration, numbered after the project's latest, and a component already in the project is never rewritten. Apply with Supabase's CLI (supabase db push, supabase functions deploy gate). CordovaOS is ten of them sharing data with zero integration code.
Walkthrough for an SDCStudio team
Set up once
The account holder does this in SDCStudio at sdcstudio.axius-sdc.com; each developer then installs the package and exports their key.
- Fund the wallet. Building is paid in credits, 1,000 to the dollar. sdcmodeler never adds funds; a person does that at the wallet page.
- Create one API key per developer or agent in Settings, API Keys. Without the
spend scope a key can search, estimate, read models and download packages. With it, the key's spending limit caps what that holder may spend.
- Check a key at any time with
sdcmodeler wallet: the balance and that key's policy.
On an SDCStudio deployment with the build-and-deliver release, three more settings decide how far an agent goes without asking. A signed-in person makes all three; a key can spend within them and can never change them:
- Auto-spend on the key. The agent runs
build_and_deliver without a person approving each estimate. A spending limit stays optional: with none, the agent spends in the wallet's reload amounts, under the monthly maximum below.
- Auto-reload on the wallet, confirmed. When a run needs more than the balance, SDCStudio tops the wallet up from the saved card, in the configured amount, before anything is published. A key may trigger a reload only after the person has confirmed auto-reload, and the person gets one email per reload a key triggers.
- A monthly auto-reload maximum. The most auto-reload adds in a calendar month. A wallet's first funding sets it to four times that amount, and sets the reload amount to the amount itself ($10 funded: $10 reloads, at most $40 a month).
| Key |
Auto-reload |
A run |
no spend |
any |
searches, estimates, reads models, downloads packages; no charge |
spend |
off |
the person approves each estimate; a short balance stops it before anything is published |
spend |
confirmed |
the person approves each estimate; a short balance is topped up first |
spend + auto-spend |
off |
no per-run approval; a short balance stops it before anything is published |
spend + auto-spend |
confirmed |
no per-run approval; a short balance is topped up first, within the monthly maximum |
Organization wallets never auto-reload; the organization's admin sets each member's limit.
With a coding agent
Add the MCP configuration above to the agent. A typical session, for a developer adding a vitals form to a clinic app:
- The developer asks: "Add a form to record blood pressure and pulse."
- The agent calls
search_components and finds a published blood pressure component.
- It drafts a tree that reuses that component and mints a new Pulse count, then calls
estimate_model.
- It shows the developer the estimate: one component reused, one minted, the total in credits.
- The developer approves. The agent calls
build_model with that estimate_id, follows job_status if a job runs, then calls download_package or add_supabase_kit.
- The agent writes the feature against the published model.
The agent cannot skip step 4: build_model refuses without the estimate_id returned for the same title and tree in the same session.
With the CLI
The one piece written by hand is the tree. A component with a ct_id is reused; one with a label and an SDC4 data_type (such as XdString, XdCount, XdQuantity or XdTemporal) is minted. Clusters group components and nest.
{
"label": "Vitals",
"components": [
{"ct_id": "<ct_id from search>"},
{"label": "Pulse", "data_type": "XdCount"}
],
"clusters": []
}
sdcmodeler search "blood pressure" --type xdquantity
sdcmodeler estimate tree.json --title "Vitals"
sdcmodeler build tree.json --title "Vitals" --estimate-id <id> --wait
sdcmodeler package <ct_id> --dir ./packages
Builds land in the Modeler's default project, created on first use if there is none.
In one run
ship (CLI) and build_and_deliver (MCP) do the whole path after one approval: build, publish every new component and the model into the Modeler's private default project, wait for the job, then deliver.
sdcmodeler ship tree.json --title "Vitals" --deliver package,kit --project ./my-app --plan # the total; nothing spent
sdcmodeler ship tree.json --title "Vitals" --deliver package,kit --project ./my-app # asks once, then runs
The total covers the build and the deliverables: 1,500 credits once when they include an application or a kit, since one charge covers both. A run the wallet or the key cannot pay is refused before anything is built. Once the model is published, a deliverable that fails is reported under failed, the others still run, and ship exits 2; fetch the failed one with its own command. --yes approves without the prompt, for scripts.
On a deployment with the build-and-deliver release, SDCStudio does the run itself: it funds and holds the whole total before the first publish (a reload included, when the person allows one), delivers each item from the hold, and sdcmodeler downloads what is ready and writes the kit. On an older deployment sdcmodeler composes the run from the calls it already has. Which one is decided by what the server's estimate answers, never by a setting. With an auto-spend key, build_and_deliver needs no prior estimate and returns the estimate in its result; ship still asks at the terminal unless --yes.
The deliverables can live in the agent's settings instead of each call: SDCMODELER_DELIVER (for example package,kit), SDCMODELER_OUTPUT_DIR for the package and application, and SDCMODELER_PROJECT_DIR for the kit, in the environment of the CLI or of the MCP server's configuration.
Translating a model