Turn an IDF domain into an MCP server with invariants and role scopes in every tool description.
A server that turns an IDF domain into an MCP server with invariants and role scopes embedded in every tool description. It enables structured, domain-driven modeling of tools for intent-driven software.
π οΈ Key Features
Converts IDF domain into MCP server with invariant- and role-based tool descriptions
Tools carry explicit invariants and role scopes
Self-documented server ready for integration with MCP clients
Lightweight, CI-friendly npm-based deployment
π Use Cases
Build intent-driven AI agents with constrained tool access
Enforce domain invariants across tool invocations
Standardize tool descriptions for MCP-compatible ecosystems
β‘ Developer Benefits
Clear grounding of tools in domain logic
Tight alignment between IDF domain and MCP protocol
Ready-to-use npm package with CI badges and licensing
β οΈ Limitations
Information available is limited to readmeExcerpt and metadata
Specific invariants and scopes depend on the provided IDF domain
Stop giving AI agents API keys. Give them a domain.
@intent-driven/mcp-server exposes any IDF domain
to Claude Desktop / Cursor / Zed as a Model Context Protocol server β with
domain semantics in tool descriptions (preconditions, invariants,
irreversibility, role scopes) and structured rejections when the agent
tries something it shouldn't. Not a 500. Not a string. A JSON shape the
LLM can read and adapt to.
On April 25 2026 a Cursor agent powered by Claude Opus 4.6, working on a
credential mismatch in PocketOS staging, found an unrelated API token,
decided to delete a Railway volume to fix things, and wiped the production
database and all volume-level backups in 9 seconds. The agent's own
post-mortem:
"I guessed that deleting a staging volume via the API would be scoped
to staging only. I didn't verify. I didn't check if the volume ID was
shared across environments."
This isn't an alignment problem. The system never told the agent what
was allowed, why it shouldn't, or what would happen if it tried. Existing
MCP servers don't either β tool descriptions carry endpoint shape
and not much else. The agent learns by colliding with 500s.
This package fixes that. The MCP tool descriptions carry the why the
call might fail; the rejection carries the what failed, structured.
How it plugs into your stack
@intent-driven/mcp-server is a stdio MCP adapter that talks to a
Fold runtime over an HTTP API. The runtime is a sibling service β
not middleware in your existing app, not codegen at runtime. Your current
backend stays where it is; the IDF artifact describes the agent-facing
surface, and the runtime serves it on its own port (default :3001).
The MCP server is what Claude/Cursor connects to. The runtime is
what enforces the rejection. The IDF artifact is what you author.
Who this is for. You're the engineer at a 5β30-person team putting
an AI agent into production this quarter β on top of a real backend,
with real customers, real SOC2 review on the horizon. You don't want a
guardrail layer that reviews after the fact. You want the system itself
to refuse the wrong action β before the call, with a structured reason
the agent can read.
What the agent actually sees
submit_response in the freelance domain:
code
Executor ΠΏΡΠ±Π»ΠΈΠΊΡΠ΅Ρ Response Π½Π° Task Π² status=published; Response.status=pending; +1 Π² Task.responsesCount
Creates: Response(pending)
Preconditions: task.status = "published"
May fail on (domain invariants):
- Response.taskId must reference existing Task.id
- Response: max 1 per taskId where (status="selected")
- Response: row count rule per taskId where (status="pending") [info]
release_payment in the same domain:
code
Customer releases escrow to executor. After confirmation, money is gone β forward-correction only.
β οΈ Irreversible action (point-of-no-return: high). Forward-correction only after this effect is confirmed.
May fail on (domain invariants):
- Deal.status transitions allowed: in_progressβcompleted, on_reviewβcompleted, ...
None of this is hand-written for the MCP server. It's all derived from
one declarative IDF artifact (entities + intents + invariants + roles
irreversibility points).
What a structured rejection looks like
Agent submits a $50,000 BTC long without preapproval. The runtime
intercepts before any effect lands in storage:
IDF_BOOTSTRAP=0 if the host already has the domain loaded (the quickstart
container does this on docker compose up). Restart Claude Desktop fully
(βQ + relaunch β closing the window isn't enough). All
agent-callable intents appear in the Tools menu.
Business rules as LLM hint. Usually not transmitted. β IDF: intent.conditions land in tool description as Preconditions:.
Domain invariants in descriptions. Almost never. β IDF computes the relevant invariants per intent (alpha Γ entity match) and injects them as May fail on (domain invariants). Closes the #1 complaint about hand-rolled MCP servers: "the server doesn't carry domain semantics β the LLM knows what to call but not why it'll fail."
How long does authoring an IDF artifact take
Three reference points from the public IDF host runtime:
Where the speed comes from (all in @intent-driven/cli):
idf import postgres β reads your live schema, generates entity
baseline with FKs and column types as fieldRole.
idf import openapi β reads your existing API spec, generates intents
parameter shapes + reference fields. This is how a 253-entity
domain gets bootstrapped.
idf import prisma β same story for ORM-driven backends.
idf enrich β LLM pass to fill label, fieldRole, compositions,
suggested roles.agent.preapproval predicates from your existing
code comments.
The author-once-then-forget loop is the whole point. Once the artifact
exists, you don't regenerate scaffolding on schema change β the runtime
re-reads and serves four readers (UI, voice, agent, document) off the
same file.
Domain prerequisites
The protocol is reliable, but it needs the IDF domain to be authored
correctly. Without these, tools/list may return empty,
tools/call may return domain_not_supported, resources may be empty:
ontology.roles.agent must be declared. No agent role β no tools, no resources.
role.agent.canExecute β list of safe intents. Avoid __irr:high without preapproval.
role.agent.visibleFields β array of fields or "own" / "all" / "aggregated" markers.
Server-side effect builder (server/schema/effectBuildersRegistry.cjs in idf) must include your domain. Without it tools/call returns domain_not_supported.
Public catalogs without ownerField. When an entity has ownerField, the SDK filterWorldForRole filters out rows where row[ownerField] !== viewer.id. For public catalogs (e.g. Task with status: "published") use role.scope with a via-collection or a separate agent-roleable projection (roadmap).
Limitations (1.0)
tools and resources only. prompts / completion β roadmap.
Bootstrap reads ontology from local FS. SaaS variant (ontology from DB/API) β next.
Auth: email/password login. PAT / OAuth2 β next.
Sync only (POST /exec). Long-running via MCP tasks API β next.