Nifra docs

io.github.nifrajs由 GitHub 账号 nifrajs 发布v5.12.1更新于 Nov 4, 2026

Nifra 文档、可运行示例和 API 类型,作为面向任何 AI 助手的 MCP 服务器。

AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。

原文描述

Nifra docs, runnable examples, and API types as an MCP server for any AI assistant.

已验证Streamable HTTP可网页运行知识与记忆开发者工具

概览

Nifra docs 的托管 MCP 服务(mcp.nifra.dev);无需登录;Streamable HTTP;7 个工具。

暂无 AI 概览:以下信息来自注册中心条目和服务本身。

端点
mcp.nifra.dev
最近检查

安装

在 SourceWeft 中

  1. 打开 控制台中的 Nifra docs,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.nifrajs%2Fnifra-docs/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "nifra-docs": {
      "type": "http",
      "url": "https://mcp.nifra.dev/"
    }
  }
}

README

[Nifra]

Nifra

The AI-native TypeScript framework.
Typed APIs and full-stack SSR on five UI libraries, one app across Bun, Node, Deno, and the edge -
built so both humans and coding agents can change it safely.

[npm] [downloads] [CI] [Bun >= 1.3] [MIT]

Documentation · Playground · Benchmarks · vs. other frameworks


Nifra is for software that is built, operated, and used with agents in the loop.

An agent should not be a chat bubble bolted onto an app, or a coding assistant guessing at an API. It should discover the real contract, call typed capabilities, stream progress into the UI, ask for approval at the right boundary, update state optimistically, reconcile with the server, and leave evidence that the work actually happened. Nifra makes that one system:

  • Build surface: typed APIs, runtime schemas, a no-codegen client, full-stack SSR, and one app across five UI libraries and five runtimes.
  • Agent surface: page-local WebMCP, remote MCP/MCP Apps, A2A, and AG-UI from the same capability and tool contracts.
  • Execution surface: bounded agent turns, budgets, approvals, idempotency, cancellation, resumable evidence, and provider-neutral model ports.
  • UI surface: deterministic predictive UI, shared run state, streamed deltas, human-in-the-loop decisions, content-free browser views, and Run Studio.
  • Proof surface: live MCP project context plus typecheck, route assurance, effect provenance, manifests, and contract-derived verification gates.

One contract. Every surface.

The central design decision is simple: define the capability once, then project it to the surface that fits the moment. A page-local agent can use WebMCP while the page is open; a background agent can use remote MCP; another agent can use A2A; a human-facing client can consume AG-UI. They still meet the same typed validation, authorization, approval, output, and evidence boundary.

ts
import { t } from "@nifrajs/schema"import { defineAgentCapability, registerWebMcpTools } from "@nifrajs/webmcp"
export const addToCart = defineAgentCapability({  name: "cart.add",  description: "Add a product to the current cart.",  input: t.object({ sku: t.string(), quantity: t.number() }),  output: t.object({ cartVersion: t.string() }),  writes: ["cart"],  execute: (input) => addItemOnTheServer(input),  predict: ({ input, version }) => ({    baseVersion: version,    patch: [{ op: "add", path: "/items/-", value: input }],  }),})
// Explicit page-local discovery. Unsupported hosts receive a safe no-op report.await registerWebMcpTools([addToCart])

The same addToCart.tool can be projected into Nifra's remote MCP adapter or called by an agent runner. Predictions are deterministic application code - not LLM guesses - and commit, rollback, conflict, expiry, and authoritative reconciliation are explicit outcomes.

See the WebMCP and predictive UI guide and the agent layer.

Start with a typed backend

sh
bun create nifra my-app # scaffold the API startercd my-appbun installbun run dev

For a full-stack React app with SSR:

sh
bun create nifra my-app --template site --framework react

Or add a backend to an existing project:

sh
bun add @nifrajs/core @nifrajs/schema @nifrajs/client
ts
import { server } from "@nifrajs/core/server"import { t } from "@nifrajs/schema"
export const app = server()  .get("/users/:id", (c) => ({ id: c.params.id }))  .post("/users", { body: t.object({ name: t.string() }) }, (c) => ({    id: crypto.randomUUID(),    name: c.body.name,  }))

The client is inferred from the server type - no codegen, no duplicated schema, no stale SDK:

ts
import { client } from "@nifrajs/client"import type { app } from "./server"
const api = client<typeof app>("http://localhost:3000")const result = await api.users({ id: "42" }).get()
if (result.ok) result.data.id   // route return type, checked by tscelse result.error               // failures are returned, never thrown

Change a route and every caller stops compiling until it is updated. Add loaders, actions, streaming, defer()/<Await>, islands, query cache, progressive-enhancement forms, and server functions when the app grows. The same web layer runs on React, Vue, Solid, Svelte, or Preact.

The web layer also keeps pages fresh and fast without a second data layer:

  • Live refresh - a loader names the keys it read with live(...); a publish reloads only those loaders on every open tab, through the same middleware, gates and loaders a navigation runs.
  • Partial prerendering - the part of a page every visitor shares is served from a cache at once, and each per-visitor hole streams in as its loader settles.
  • Server components on all five adapters - React RSC/Flight, and native server-rendered ranges for the others.
  • Keep-alive - back and forward bring a page back with its state, scroll and focus.
  • SSG and ISR with tag purges that clear data caches, the page store, live pages and the CDN in order, so a writer reads its own write.

Agentic backend: bounded, typed, observable

Nifra also provides the runtime for applications whose product is an agent. The model provider, credentials, durable state, tenancy, and policy are injected ports; the framework owns the safety and execution semantics around them.

ts
import { createAgentState, runAgent } from "@nifrajs/agent"
const result = await runAgent(definition, { value: input }, ports, {  state: createAgentState("support-1"),  maxTurns: 8,})

You get typed tool contracts, bounded turns and budgets, approvals, cancellation, idempotency, resumable token-only evidence, model/token streaming, transient shared state, and composable telemetry. A failed post-turn gate can become a bounded repair turn in the standalone nifra-agent host. The local process and extension adapters contain crashes and accidents; they are not hostile-code sandboxes.

Agentic UI: from intent to visible state

The UI is not an afterthought. Nifra gives an agent several deliberate ways to interact with an app:

SurfaceBest forNifra's contract
WebMCPAn agent acting in the currently open pageExplicit tool allowlists, typed inputs/outputs, bounded receipts, deterministic prediction, versioned reconciliation
MCP / MCP AppsRemote tools, background work, and rich tool resultsThe same core tool projected to remote MCP and ui:// widgets
AG-UIStreaming an agent run into a product UISSE lifecycle, text/reasoning/tool deltas, shared-state snapshots/deltas, resumable evidence, typed resume
Agent App / WorkbenchBrowser and desktop control planesNegotiated features, approvals, handoffs, decision inbox, capability registry, Run Studio

For a predictive interaction, the application supplies a pure patch and a reconciliation rule. The store applies it atomically, then either accepts authoritative server state or reports rollback, conflict, or expiry. The human UI remains fully functional when no agent host is present.

Interoperate without rewriting the agent

The runner is the center; protocol adapters are edges:

Every protocol boundary still needs application authentication and authorization. Public reference adapters keep credentials, durable storage, tenant state, and operated policy outside the package so you can supply the right implementation for your deployment.

Give coding agents a live project, not stale docs

Register Nifra once and an agent can inspect the actual project, fetch version-checked examples and types, scaffold in the correct route directory, run HTTP/SSR/WebSocket checks, inspect recent requests, and loop on structured fixes:

sh
claude mcp add nifra -- bunx nifra mcpnifra init-agents
nifra context       # live route and convention mapnifra smoke         # real SSR, API, auth and hydration requests against the buildnifra check         # typecheck, drift, and bundle-boundary gatenifra assure        # route security evidence gatenifra levels        # cumulative proof level and next missing rung

The local server runs where your code lives - your source never reaches Nifra. The teaching tools are also hosted at mcp.nifra.dev for agents that only need the verified Nifra corpus. Skills are available for Pi and Claude Code.

Proof, not promises

Agentic systems need more than “the model said it worked.” Nifra turns the important claims into gates:

sh
nifra checknifra assurenifra capabilities checknifra manifest diffnifra levels --min 1
  • nifra check catches type drift, raw calls around the typed client, server-only bundle leaks, and other contract violations.
  • nifra assure classifies the live route graph and fails when required authentication, validation, rate limiting, CSRF, or body-cap evidence is missing.
  • nifra capabilities check compares declared effect tokens with the module graph and a reviewed lockfile.
  • nifra manifest diff detects contract, assurance, effect, and response-sensitivity changes at promotion time.
  • nifra levels reports the highest cumulative proof level a project actually holds, from typed contract to contract-derived invariant tests.

Docs and examples are compiled against the live API, and the machine-readable MCP corpus is generated from built packages. An agent gets a repairable diagnostic instead of a stale suggestion.

Full-stack portability, without the framework tax

The app lifecycle is app.fetch(Request): Promise<Response>. Define it once and deploy to Bun, Node, Deno, Cloudflare Workers/Pages, or Vercel Edge with a small adapter. The web layer supports React, Vue, Solid, Svelte, and Preact without changing the route/data model.

The published snapshot in site/shared/data/benchmarks.json is the source of truth for the website tables and benchmark comparison articles. The benchmark suites merge fresh results into it through bench/site-bench.ts. The public tables include rows where Nifra loses and keep bare HTTP, middleware-shaped HTTP, dynamic SSR, and cacheable SSR results separate.

See benchmark methodology and full results, and run bun run bench:http / bun run bench:ssr yourself.

Batteries (56 packages, all typed, all optional)

The package map is organized by job:

LayerPackages
Backendcore · schema · client · middleware
Full-stack webweb · web-react · web-vue · web-solid · web-svelte · web-preact · web-vanilla · cache · i18n · image · content
Runtimesnode · deno · edge · workers · aws-lambda
Agent runtimeagent · prompt · runner · agent-telemetry
Agent UI and protocolswebmcp · agent-app · mcp · a2a · ag-ui
Coding agentscoding-agent · agent-protocol · pi · acp · skills
App services and qualityauth · better-auth · authjs · jobs · cron · storage · uploads · testing · mock · otel
Toolingcli · create-nifra · devtools · ts-plugin

All packages are optional and typed. Start with the core, then add only the surfaces your product needs. Browse the complete documentation.

Develop

sh
bun installbun run check          # lint, typecheck, tests, docs, corpus, and size gatesbun run build          # emit dist/ for all packagesbun run bench:http     # reproducible HTTP matrix

Contributions welcome - see CONTRIBUTING.md. MIT licensed.

来源:README.md,提交 ab3b6a8

工具

7

nifra_docs

Search nifra docs

Search nifra's framework documentation and get back ONLY the matching sections - auth, uploads, ISR, WebSockets, loaders, deployment, anything. Call with no query for the cheap section index; pass query (e.g. "isr revalidate") for the top matching sections. Use this instead of reading llms-full.txt (~150 KB) whole. For the EXACT TypeScript of a type/interface/function, call nifra_types instead (don't read .d.ts files).

输入参数limitquery

nifra_example

Get a verified nifra example

Get a verified, copy-pasteable Nifra code example for a task - auth route, file upload, ISR page, loader/action, typed client, SSE, deployment, and more. Every snippet is typechecked against the installed Nifra version, so it compiles as-is. Returns code as text for direct use. Call with no query for the grouped index; pass query (e.g. "protected route", "upload", "isr revalidate") for matching snippets.

输入参数limitquery

nifra_types

Look up nifra API types

Get the exact TypeScript declaration of any exported @nifrajs/* symbol - interface, type, class, function, or const. Each signature is generated from the package's built .d.ts and returns the complete declaration rather than prose. Pass `name` for an exact symbol (e.g. "RateLimitStore", "RouteSchema", "Context", "rateLimit"); pass `query` to search by keyword; omit both for the per-package index of names. A `name` lookup is always the complete declaration; a `query` returns a one-line summary plus the signature, collapsing an oversized body - pass `full: true` to override.

输入参数fullnamelimitquery

nifra_learn

Guided nifra learning path

Walk the guided path to build a nifra app end to end - an ORDERED sequence (create → page route → loader → typed API → typed client → auth → background jobs → deploy), not the random-access search of nifra_docs/nifra_example. Call with no args for the step index; pass `step: N` for that step's goal, how to do it (which tool emits the correct artifact), and how to verify it. Use it when scaffolding a new app or learning nifra's flow - each step composes the other nifra_* tools.

输入参数step

nifra_frontend

Frontend footgun guidance

Diagnose a client-side Nifra problem by symptom across every adapter (React, Preact, Solid, Vue, Svelte, and vanilla). Returns the likely cause, a concrete fix, and how to verify it. Covers the Nifra server/client seam, hydration mismatches, duplicated framework runtimes, loader-data typing, and adapter-specific reactivity guidance. Call with no args for the index; pass `symptom` (e.g. "hydration mismatch", "value stopped updating") and/or `adapter` to filter.

输入参数limitadaptersymptom

nifra_runtime

Runtime differences

Explain a behavior that differs between Bun, Node, Deno and Cloudflare Workers by symptom. These are runtime behaviors, not Nifra's: request-target and Host handling, pipelining, JSON content-type, engine error messages, recursion depth, .env loading, and runtime-specific APIs. Returns what each runtime does, the fix (and the Nifra option that decides it when there is one), how to verify it, and the versions it was measured on. Call with no args for the index; pass `symptom` (e.g. "path guard skipped", "env var undefined") and/or `runtime` to filter.

输入参数limitruntimesymptom

版本历史

4
  1. v5.12.1最新Nov 4, 2026
  2. v5.12.0Nov 3, 2026
  3. v5.11.0Nov 3, 2026
  4. v2.8.1Sep 16, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分