
Idf Mcp
io.github.intent-driven-software由 GitHub 账号 intent-driven-software 发布v1.0.2更新于 Oct 24, 2026
Turn an IDF domain into an MCP server with invariants and role scopes in every tool description.
概览
本地 stdio MCP 适配器,把 IDF 领域的意图暴露为工具,并在每个工具描述中带上不变量、角色范围和结构化拒绝信息。
- 可以做什么
- 把 IDF 领域中可由代理执行的每个意图暴露为 MCP 工具,输入模式来自意图参数,描述中包含前置条件、相关领域不变量和不可逆警告,高不可逆意图还会标记破坏性提示。以资源形式读取按角色可见范围过滤的集合,并按查看者裁剪。从宿主运行时接收结构化 JSON 拒绝而非通用错误,便于助手调整后续操作。首次连接时可从本地本体路径引导领域,或在宿主已加载时跳过引导。
- 适用场景
- 当你运行 Fold/IDF 宿主运行时,希望 Claude Desktop、Cursor 或 Zed 在能看到领域规则和角色范围的情况下调用某个领域的意图,而不是使用只描述接口形状的手写 MCP 服务器时适用。
- 运行要求
- 以 npm 包形式通过 stdio 本地运行。需要可访问的 IDF 宿主运行时(IDF_SERVER,默认 指定的领域名,以及正确编写的领域(含代理角色、canExecute 意图、visibleFields 和服务端效果构建器)。IDF_BOOTSTRAP 开启时使用 IDF_ONTOLOGY_PATH;IDF_AUTH_TOKEN 可选。
安装
在 SourceWeft 中
- 打开 控制台中的 Idf Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
@intent-driven/mcp-server
[CI] [npm version] [npm downloads] [license: MIT]
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.
→ Landing & demo: fold.intent-design.tech → 5-min quickstart: github.com/intent-driven-software/fold-runtime-quickstart
70-second walkthrough
Why this exists
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."
30-hour outage. PocketOS rolled back to a 3-month-old backup. (The Register · FastCompany · OECD AI Incident #6153)
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:
release_payment in the same domain:
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:
The next move for any sane agent: stop, ask the human for a preapproval, retry. Not a 500. Not a string. A JSON shape the LLM can read and adapt to.
Quickstart
The fastest path is the fold-runtime-quickstart — two commands, Docker-bundled, no path configuration:
If you'd rather drive the host yourself (e.g. for development against your own ontologies), see the next section.
Drive the MCP server directly
You need a running IDF host on localhost:3001 (the quickstart's
docker-compose gives you that, or run idf
manually) and a bootstrapped domain.
CLI
Flags / env vars:
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json:
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.
Schema mapping
Tools
One tool per intent in ontology.roles.agent.canExecute.
name—intentIdtitle—intent.namedescription—intent.description+Creates: …+ preconditions +May fail on (domain invariants)block + irreversibility warning whenirreversibility: "high"inputSchema— JSON Schema fromparticles.parameters:entityRef/id/text/textarea/select→stringnumber→numberboolean→booleandatetime→string+format: "date-time"email→string+format: "email"
annotations.destructiveHint—truewhenintent.irreversibility === "high"(§23 IDF: effect-level point of no return)
Resources
One resource per collection in role.visibleFields[entity]. URI scheme:
idf://<domain>/<collection>.
resources/read returns the filtered world from
/api/agent/:domain/world — already scoped per viewer (single-owner
- m2m via
role.scope).
What this gets you that hand-rolled MCP doesn't
The MCP community solves these by hand in every server:
- Scope / visibility. Decorators or middleware. → IDF declares
role.visibleFields. - Permissions. OAuth scopes, custom ACL. → IDF declares
roles.agent.canExecute. - Rate limits / spending caps. Bespoke per server. → IDF declares
preapproval.requiredForwithmaxAmount/dailySum. - Destructive hints. Manual, often forgotten. → IDF:
effect.context.__irr.point === "high"→destructiveHint: trueautomatic. - Business rules as LLM hint. Usually not transmitted. → IDF:
intent.conditionsland in tool description asPreconditions:. - 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 asfieldRole.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 filllabel,fieldRole,compositions, suggestedroles.agent.preapprovalpredicates 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.agentmust be declared. No agent role → no tools, no resources.role.agent.canExecute— list of safe intents. Avoid__irr:highwithout preapproval.role.agent.visibleFields— array of fields or"own"/"all"/"aggregated"markers.- Server-side effect builder (
server/schema/effectBuildersRegistry.cjsinidf) must include your domain. Without ittools/callreturnsdomain_not_supported. - Public catalogs without
ownerField. When an entity hasownerField, the SDKfilterWorldForRolefilters out rows whererow[ownerField] !== viewer.id. For public catalogs (e.g.Taskwithstatus: "published") userole.scopewith a via-collection or a separate agent-roleable projection (roadmap).
Limitations (1.0)
toolsandresourcesonly.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.
Links
- Landing & demo: fold.intent-design.tech
- Quickstart: intent-driven-software/fold-runtime-quickstart
- Host runtime: DubovskiyIM/idf
- Why a runtime layer: paper — ~1800-word essay on the agent-safety class question this answers
- MCP spec: modelcontextprotocol.io
License
MIT
来源:README.md,提交 5794c16
工具
0版本历史
1- v1.0.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分