strata
strata composes verified backend modules into your codebase
README
<div align="center">
<img src="docs/assets/banner.svg" alt="Strata — verified backend modules, composed and proven" width="620">
Your agent writes the backend. Strata proves it runs.
An MCP server that composes verified backend modules into your codebase — reading your schema, following your conventions, wiring them in the order Express actually requires — then writes one command that boots the app and exercises every requirement against a live server.
<br>
</div>
<br>
$ # your agent calls one tool, once
strata_use dir=./shop-api task="product list API"
capabilities=[ "cursor pagination with sorting",
"per-IP rate limiting",
"structured request logging" ]
FILES CREATED
server.js
strata/lib.js — the implementation these import from
strata/verify.js — boots the app and exercises the feature end to end
$ npm install && node strata/verify.js
PASS unit selftests — 3 passed, 0 failed
PASS server boots and answers /health
PASS correlation id honours an inbound x-request-id
PASS an authorization header is NOT written to the log
PASS a password in a request BODY is NOT written to the log
PASS a malformed body is a 4xx and leaks no stack trace to the caller
PASS /items walks pages by cursor without repeating a row
PASS a sort field that is not allowlisted is REJECTED, not honoured
PASS a burst past capacity yields 429 + Retry-After
12/12 checks passed — the delivered feature works end to end.
<div align="center"> <sub>Real output. Those check names are the whole idea — anyone can generate pagination,<br> the question is whether page two repeats page one.</sub> </div>
Key capabilities
- Schema-aware composition — reads Prisma, Mongoose, Drizzle, TypeORM, Sequelize or plain JS and wires modules against your real entity, fields and ID column
- Correct middleware ordering — logging above body parsing, rate limits above routes, error handlers last, enforced by rank rather than left to the model
- Generated end-to-end verifier —
strata/verify.jsboots the app on a free port and drives every requirement against it - Six machine-checked admission gates — no module reaches your project without passing all of them
- Honest declines — refuses roughly a third of tasks, where composing costs more than writing the code
<br>
$ # asked for something the library does not cover
strata_use task="slugify helper" capabilities=["convert a string to a url slug"]
No verified Strata recall covers "slugify helper". Build it from scratch the
normal way — a clean hand-written implementation is the right outcome here,
not a forced match.
<div align="center"> <sub>Refusing is a feature. One module is not worth the cost of reading and verifying it,<br> and a tool that always says yes is a tool you stop trusting.</sub> </div>
- Local by construction — your source and schema never leave the machine; only the task text is sent
Benchmark
<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="docs/assets/benchmark-dark.svg"> <img src="docs/assets/benchmark-light.svg" alt="Quality against cost across 60 benchmark runs" width="760"> </picture> </div>
60 full agent sessions: four backend tasks, five arms, three runs each. Checks were frozen and published before the first run, every check carries a negative control proving it can fail, and every output tree is archived. Delivered module source is not published — modules live in the hub and reach a project at call time.
| Arm | Catalog | Idempotency | Payments | Retry | Average | Cost |
|---|---|---|---|---|---|---|
| haiku | 70.8% | 66.7% | 29.2% | 85.7% | 63.1% | $0.22 |
| haiku + Strata | 87.5% | 85.7% | 100% | 95.2% | 92.1% | $0.27 |
| sonnet | 62.5% | 85.7% | 95.8% | 64.3% | 77.1% | $1.07 |
| sonnet + Strata | 100% | 100% | 95.8% | 95.2% | 97.8% | $1.62 |
| opus | 75.0% | 90.5% | 75.0% | 95.2% | 83.9% | $1.33 |
- A cheap model with Strata scores above a frontier model without it, at a fifth of the cost.
sonnet + Stratais the only arm to reach a perfect score, and reaches it twice. No baseline at any tier reached one in thirty-six attempts.- Quality does not track price across baselines: sonnet is the weakest arm on catalog while costing 6.6× the cheapest.
Cost is a premium on three of four tasks — +73% on catalog, +22% on idempotency, +74% on sonnet's payments run. The trade is quality and predictability, not spend. On payments the effect inverts with model strength: given the same modules, haiku's session length is unchanged (48 → 49 turns) while sonnet's grows 28% (64 → 82) as it re-reads and reworks code it did not write.
Full methodology, per-run scores and every instrument defect found along the way: docs/BENCHMARK.md.
Quick start
Prerequisites: Node.js ≥ 18 and any MCP client — Claude Code, Cursor, Windsurf, VS Code or Claude Desktop.
// .mcp.json (or claude_desktop_config.json for Claude Desktop)
{
"mcpServers": {
"strata": { "command": "npx", "args": ["-y", "stratalib"] }
}
}
Restart the client and ask for a backend feature that needs several parts:
Add cursor pagination, per-IP rate limiting and request logging to the products API.
Strata reads the project, composes the modules, writes the files, and prints what it created and what it modified. Then:
npm install && node strata/verify.js
[!NOTE] No API key and no account. Modules are served from the hub; the task text is the only thing sent. Your source, schema and files stay on your machine.
The tool
Strata registers exactly one tool. Every tool in an MCP schema is billed on every turn, so the surface is kept to one that does the whole job.
strata_use
| Argument | Purpose |
|---|---|
dir |
Absolute path to the project root — where the schema and conventions are read from |
task |
A short label for the work |
capabilities |
3–6 phrases naming the parts of the job. Your model writes these; it has read the whole task |
Returns the files created and modified, the exports available from each module, and the command to verify the result.
How it works
1 · Reads the project — locates the ORM and extracts the real entity: fields, types, enums and the actual ID column. Deterministic, in Node, before the model sees a byte. Where the entity cannot be identified with confidence, Strata leaves a slot rather than guessing.
2 · Selects modules — each capability phrase is scored against the library, and anything matching on shared vocabulary alone is discarded. Fewer than two surviving modules triggers a decline.
3 · Composes — modules contribute to the app rather than owning it, each contribution carrying a rank that fixes its position in the middleware chain. A malformed request throws during body parsing, so logging mounts above it; get that backwards and the one request most worth tracing is the one that loses its correlation id.
4 · Writes the verifier — strata/verify.js runs each module's own suite, boots the app on a free port, and exercises every requirement against it. Built against your entity, so the checks run on your fields and your routes.
Admission gates
Every module passes six machine-checked gates before it can be served. A module that fails is discarded, not repaired — hand-patching generated modules returns coverage to craft and stops it scaling.
| Gate | Requirement |
|---|---|
| Exports | Loads, and every export it declares resolves at runtime |
| Selftest | Its own suite passes, with a stable assertion count across five runs |
| Adversarial | ≥ 8 assertions, hostile inputs, and assertions that something must not happen |
| Compose | Valid fragments with ranks, and declared factories that exist |
| Collisions | No exported name collides with another module |
| Composed boot | Composes with two others into an app that starts and verifies |
The adversarial gate is the one that matters. Every hand-written module in this library shipped with a real bug its own tests did not catch — a 404 that reset a circuit breaker's failure count, a dropped enum constraint, an attacker-controlled request id echoed into a response header. A confirmatory suite admits exactly those.
Repository layout
| Path | Contents |
|---|---|
src/ |
MCP server: project reading, selection, composition, verifier generation |
bin/ |
CLI entry point |
templates/ |
Express skeleton used during composition |
benchmark/ |
The 60-run quality battery, pre-registered suites, negative controls, archived output trees |
scripts/ |
Admission gates, library indexing, selection tests |
Modules are served from the hub; the task text is the only thing sent. Your source, schema and files stay on your machine.
Documentation
| Document | Subject |
|---|---|
docs/BENCHMARK.md |
The 60-run benchmark: method, board, and every instrument defect found |
Development
npm install
node --max-old-space-size=8192 node_modules/typescript/bin/tsc -p tsconfig.mcp.json # build
node scripts/admit-recall.js recalls/<domain>/<name>/v1 # run the gates
node benchmark/quality/negative-control.js # prove the checks can fail
node benchmark/run-quality-battery.js --tasks catalog --max 3 # collect runs
STRATA_MODE=local composes against a local recalls/ checkout instead of the hub — required when testing a module that has not been deployed.
Acknowledgements
Built on the Model Context Protocol, Express, Prisma, Mongoose, Drizzle, TypeORM and Sequelize.
License
AGPL-3.0-or-later. See LICENSE.
<div align="center"> <sub> <a href="https://stratalib.com">stratalib.com</a> · <a href="https://www.npmjs.com/package/stratalib">npm</a> · <a href="https://x.com/stratalib">@stratalib</a> </sub> </div>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。