tabnas

dev.tabnas由 tabnas.dev 發布官方發布者v0.1.20更新於 Oct 24, 2026

Seven tools over the tabnas parsing engine: parse, validate, diagnose, fixtures, compare.

已驗證Streamable HTTP可網頁執行開發者工具資料與分析

概覽

AI 產生的概覽

tabnas 提供七個以 tabnas 解析引擎為基礎的工具,讓助理解析輸入、驗證語法、解釋解析錯誤、執行測試樣例並比較語法版本。

可以做什麼
  • 以序列化語法解析輸入,回傳語法樹或結構化診斷資訊
  • 驗證語法規格,包含規則參照檢查,並解釋解析失敗原因與對應的錯誤碼條目
  • 以 TSV 測試樣例對語法逐列執行並回報通過或失敗
  • 列出內建語法外掛並檢視單一外掛的完整描述
  • 將候選語法與基準語法比較,檢查接受範圍與語法樹變化,回傳證據與信心程度而非單純結論
適用情境
適合在以 tabnas 引擎開發或維護語法與解析器時使用:確認語法變更仍能接受既有文件並產生相同語法樹、排查解析失敗,或在助理工作階段中執行測試樣例集。
執行需求
可使用託管的 streamable HTTP 端點,或透過 npm 套件 @tabnas/mcp 以 npx 在本機執行(需 Node.js)。未宣告任何驗證、環境變數或請求標頭。語法必須以序列化 GrammarSpec JSON 傳入,不支援 ABNF、EBNF 或 GBNF 原始碼。
安裝前請注意
託管端點在共用基礎設施上解析攻擊者可控的文字,並設有上限:請求內容 256 KB、每個 IP 約每分鐘 60 次請求;文件內容不會被記錄或儲存。本機 stdio 被描述為免費、私密且不限量。語法參數視為資料,會先經過防火牆,拒絕原型汙染鍵、ref 鍵、plugins 鍵以及超過 5000 條規則的語法。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 tabnas,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/dev.tabnas%2Fmcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "tabnas": {
      "type": "http",
      "url": "https://mcp.tabnas.dev/mcp"
    }
  }
}

README

tabnas/mcp

The tabnas agent tooling: one TypeScript codebase, two front-ends: an MCP server (stdio) and the unified tabnas CLI, sharing a single core (ts/src/core.ts) so the two can never disagree. For each operation the CLI's --json output and the MCP tool result are byte-identical, and the test suite holds them to it.

The website page for this package: per-client setup, the tool contracts, the hosted endpoint's bounds: tabnas.dev/mcp.

Published as @tabnas/mcp. This repo is TypeScript-only: it is tooling over the engine, not a parity package, so there is no Go port.

Install

bash
npm install -g @tabnas/mcp     # the `tabnas` CLInpx --yes @tabnas/mcp          # run the MCP server directly (stdio)

MCP client configuration (stdio):

json
{  "mcpServers": {    "tabnas": {      "command": "npx",      "args": ["--yes", "@tabnas/mcp@<x.y.z>", "mcp"]    }  }}

Fill in <x.y.z> with the current version: npm view @tabnas/mcp version. This README does not name it: a repo cannot carry an exact pin of its own published version, because the commit that updates it becomes the next release's content, leaving it one release behind forever.

The server is started by the mcp subcommand of the CLI (tabnas mcp), which is exactly what the skills package's mcp.json invokes as npx --yes @tabnas/mcp@<x.y.z> mcp. (--yes matters: on a cache miss npx would otherwise prompt on the stdin the MCP transport owns. Pin an exact version so the tools cannot drift under an installed client: skills/mcp.json carries the real one, written from the registry by its tools/sync-mcp-pin.js and checked by tools/validate.js --online.)

The seven tools

ToolAnswersResult
parsedoes this input parse, and to what tree?{ok:true, tree} | {ok:false, diagnostic}
validate_grammaris this serialized GrammarSpec valid?{ok:true, v} | {ok:false, errors:[{path,message}]}
explain_parse_errorwhy did this parse fail?{failed:false} | {failed:true, diagnostic, registry}
test_grammardo these TSV fixtures pass?{pass, fail, rows:[{row,input,expected,got,ok}]}
list_pluginswhat grammar plugins exist?{plugins:[...]}
describe_pluginone plugin's full descriptorthe tabnas.plugin.json object
compare_grammarsdoes a grammar change still accept what the old one accepted, and build the same trees?{normalForm, proven[], observed[], changes[], counterexamples[], confidence, why}

Notes on the contracts:

  • Every operation builds a fresh engine instance per call. parse applies options first, then grammar. With no grammar the instance is exactly what new Tabnas() gives: the bare engine defines no rules, so every input yields an undefined tree (serialized as {"ok":true}).
  • A grammar argument is validated before it is used, by every operation that accepts one; an invalid grammar is rejected with the validate_grammar error shape {ok:false, errors:[{path,message}]}.
  • validate_grammar layers: an ADR-10 security scan (below), structural validation against the bundled grammar.schema.json (Ajv, draft 2020-12), then an engine load in a fresh instance whose thrown message becomes the error. v is the grammar's declared builtin config-schema version (absent means 1).
  • Security (ADR-10): a serialized grammar and its options are data, never code. A firewall runs first on every grammar-accepting op and on request options, rejecting: any own key named __proto__, constructor, or prototype anywhere in the tree (prototype-pollution defense, since the engine's grammar merge has no __proto__ guard); a ref key (live functions are not JSON); any function reference that is not a $-suffixed engine builtin; a plugins key, whether a request option or inside grammar.options (a plugin is live code); and grammars over 5000 rules (a CPU bound). "Validate this grammar" never becomes "run this code", or "pollute this process".
  • A non-diagnostic engine throw (for example, options.parser.start set to a non-function) is caught and returned as the same clean {ok:false, errors:[{path:"",message}]} shape, so the CLI and the MCP tool agree.
  • explain_parse_error joins the diagnostic with the bundled error-code registry entry ({code, message, hint}); registry is null for a code the registry does not know (for example, a plugin-declared code).
  • test_grammar takes TSV content in the fleet fixture convention (@tabnas/support): line 1 is a header, the input column is escape-decoded, the expected column is JSON or ERROR / ERROR:<code>. Columns default to positions 0 and 1; options.inputCol / options.expectedCol select by position or header name. Specs over 10000 rows are refused.

MCP resources (served verbatim from the bundled data/): tabnas://schema/grammar, tabnas://schema/diagnostic, tabnas://errors, tabnas://plugins, tabnas://divergence.

CLI

tabnas parse    [file|-] [--grammar g.json] [--json]tabnas validate --grammar g.json [--json]tabnas diagnose [file|-] [--grammar g.json] [--json]tabnas test     --spec fixtures.tsv [--grammar g.json] [--json]tabnas plugins  [name] [--json]tabnas compare  --a old.json --b new.json [--corpus dir|file] [--depth n] [--json]tabnas mcp                                        # run the MCP server (stdio)

Input comes from file, or stdin when the argument is - or absent. The CLI never touches the network. tabnas mcp starts the stdio MCP server (the same server as npx @tabnas/mcp); it speaks JSON-RPC on stdout and prints nothing else there.

--json prints exactly the core result JSON: the same bytes the MCP tool returns for the same request (stable key order; the golden contract, enforced by ts/test/golden.test.js). Without --json you get a readable rendering; a parse failure prints the engine's own rendered error message.

Exit codes:

CodeMeaning
0success: parse succeeded / grammar valid / all fixture rows passed
1the operation said no: parse failure, invalid grammar, fixture failures, unknown plugin
2usage error: unknown flags or command, missing/unreadable files, malformed grammar JSON

Passing a grammar that isn't already a GrammarSpec

Every tool takes a serialized GrammarSpec, pure JSON. It does not take ABNF, EBNF, GBNF or jsonic source, and it never will: compiling those means running a compiler, and the tools' one hard rule is that a grammar is data, never code (ADR-10). Compile first, then pass the result.

js
const { abnfConvert, toPureSpec } = require('@tabnas/abnf')
const spec = toPureSpec(abnfConvert(abnfSource, { builtins: true }))// -> { options, rule, v, meta } — validates clean, safe to send

Use toPureSpec. It is the function for this, and the two obvious alternatives are both wrong:

  • abnfCompile() returns jsonic text, not an object. Useful for writing a grammar file; not what a tool argument wants.
  • abnfConvert() alone returns a spec carrying ref (empty, when converted with builtins: true) and mark fields. The firewall rejects the presence of ref, not merely its contents, deliberately, since "empty enough" is not a property worth reasoning about at a security boundary, and m marks are not part of the serialized form. toPureSpec strips both and stamps v.

toRecognitionSpec is the same thing for a grammar that only needs to decide accept/reject, without the tree-building builtins.

The equivalent for the other front-ends is tabnas parse --grammar g.json, where g.json is whatever your build step wrote.

Grammar compatibility (compare)

Two questions, reported separately, because they fail differently:

  1. Acceptance. Does the candidate still accept what the baseline accepted?
  2. Output. For inputs both accept, is the resulting tree the same?

The second is the one users feel. A change that still accepts every historical document but reshapes the tree silently breaks every downstream consumer, and an acceptance-only test reports success.

The report carries evidence and confidence, never a bare verdict. There is deliberately no compatible: true field. Language inclusion is undecidable in general, so a tool that printed one would eventually be wrong in production:

  • proven[]. What was established statically, and on what basis. Anything outside the decidable subset is not-proven, which is a statement about this tool, not a claim that the grammars are incompatible.
  • observed[]. What actually ran, and how much of it.
  • changes[] / counterexamples[]. Concrete differences, with inputs.
  • confidence + why. How much weight the absence of findings can bear. confidence: "low" with a stated reason is a successful run.

The check that earns its keep is alternate ordering. Alternates are first-match-wins, so one inserted earlier can shadow a later one and narrow the accepted language while a set comparison calls it an addition. compare walks positions, not membership, and reports a shadowed alternate that used to be reachable.

--corpus takes a .tsv fixture file or a directory of them, loaded through @tabnas/support, the same loader the fixture runners use. Real inputs are the only tier that measures what your documents actually do:

bash
tabnas compare --a v1.json --b v2.json --corpus ../json/test/spec

Exit code is 1 when any change is found, so it works as a release gate.

The hosted endpoint

mcp.tabnas.dev serves the same seven tools over streamable HTTP (POST /mcp, plus GET /health and GET /.well-known/mcp), for agents that cannot run npx. Local stdio stays the recommended path: it is free, private, reproducible, and unlimited.

The hosted service is the same core, so it answers identically; it is also bounded, because it parses attacker-controlled text on shared infrastructure. A 256 KB body cap and 60 requests per minute per IP, both reported up front by /.well-known/mcp and named in the refusal (limit_exceeded / rate_limited) along with the local alternative. The rate limit is Cloudflare's, which counts per IP per data centre and approximately, so it is a shield against sustained abuse, not an exact quota, and a short burst may exceed 60 before refusals begin. Document content is never logged, stored, or used for training; telemetry records shape only: tool name, size bucket, duration, status, error code.

Bundled data

Published packages do not carry the fleet's contract files (the parser's npm files exclude schema/; plugin packages do not ship tabnas.plugin.json), so this repo commits generated copies in data/: the grammar and diagnostic schemas, the error-code registry, DIVERGENCE.md, and every fleet plugin descriptor (plugins.json, sorted by name). Regenerate from sibling checkouts (../<repo> beside this repo) with:

bash
cd ts && npm run gen-data

The build compiles data/ into ts/src/data-bundle.ts (generated, gitignored) and the code reads that static import, never the filesystem, because the hosted Worker does not have one. The test suite fails on a stale regeneration or a stale embed, and checks the embedded set against the directory rather than a hand-kept list. Derive, never duplicate (ADR-10).

data/grammar.schema.json gets the same treatment for a different reason: Ajv validates by generating JavaScript and calling new Function, which Cloudflare Workers forbid outright, so tools/build-validator.js precompiles the schema into ts/src/grammar-validator.js at build time. Same Ajv, same error shapes, compiled earlier.

Build & test

bash
cd tsnpm installnpm test        # builds first, then runs every test/*.test.js

npm test ends with test/workerd.test.js, which boots the real wrangler.json in real workerd and speaks HTTP to it. It is the only test whose failure means "the hosted endpoint will not deploy", and it needs the wrangler devDependency (and the workerd binary npm installs alongside it). It adds a few seconds; a Node-level test cannot replace it, because every deploy-blocking defect this repo has had was green under Node.

Working in the fleet layout (sibling checkouts beside this repo), symlink the siblings after npm install so you test against source (npm replaces these on every install, so re-make them after one):

bash
rm -rf node_modules/@tabnas/parser node_modules/@tabnas/supportln -s ../../../../parser/ts node_modules/@tabnas/parserln -s ../../../../support/ts node_modules/@tabnas/support

CI

.github/workflows/ci.yml, a caller of the org's tabnas/.github polyglot-ci.yml (ts-only, with parser and support cloned as siblings), promoted from ci/ci.yml in a14741c. A change to it is made in .github/workflows/ directly, in a reviewed pull request (admin ADR-8, as amended 2026-09-24).

CI runs test/workerd.test.js, which boots the real wrangler.json in real workerd, so the hosted endpoint's deployability is gated on every push, not discovered at deploy time.

License

MIT. See LICENSE.

來源:README.md,提交 3cc5c8c

工具

7

parse

Parse input with the tabnas engine. Returns {ok:true, tree} or, on parse failure, {ok:false, diagnostic} — the structured diagnostic described by resource tabnas://schema/diagnostic. An invalid grammar is rejected as {ok:false, errors:[{path,message}]}. Without a grammar the bare engine is used, which defines no rules and produces an undefined tree for every input.

輸入參數input必填grammaroptions

validate_grammar

Validate a serialized GrammarSpec. Structural validation against the bundled grammar schema, an engine load in a fresh instance, and a check that every rule reference (`p`, `r`) names a rule the grammar actually defines — a dangling reference loads cleanly and then fails at parse time with `unknown_rule`. Returns {ok:true, v} (v = declared builtin config-schema version, absent means 1) or {ok:false, errors:[{path,message}]}. Security: a grammar carrying a `ref` key, or any function reference that is not a $-suffixed engine builtin, is rejected — validating a grammar never runs supplied code.

輸入參數grammar必填

explain_parse_error

Parse input and explain the failure. Returns {failed:false} when the input parses; otherwise {failed:true, diagnostic, registry} where registry is the error-code registry entry {code,message,hint} for the diagnostic code (resource tabnas://errors), or null for a code the bundled registry does not know (e.g. a plugin-declared code).

輸入參數input必填grammar

test_grammar

Run TSV fixture content against a grammar in a fresh instance, using the fleet fixture convention (@tabnas/support): line 1 is a header, the input column is escape-decoded, the expected column is JSON or ERROR / ERROR:<code>. Returns {pass, fail, rows:[{row,input,expected,got,ok}]}. Refuses more than 10000 rows.

輸入參數spec必填grammaroptions

list_plugins

List every bundled tabnas plugin descriptor (tabnas.plugin.json of each fleet repo), sorted by name. Returns {plugins:[...]}.

無需輸入參數。

describe_plugin

The full descriptor for one plugin, by package name ('@tabnas/csv') or bare fleet name ('csv'). Unknown names get {ok:false, errors} naming the known plugins.

輸入參數name必填

compare_grammars

Grammar compatibility (AX plan Phase 5): does candidate grammar B still accept what baseline A accepted, and does it build the same tree for inputs both accept? Returns EVIDENCE AND CONFIDENCE, never a bare verdict: {normalForm, proven[], observed[], changes[], counterexamples[], confidence, why}. confidence:'low' with a stated reason is a successful run, not a failure — language inclusion is undecidable in general, so anything outside the decidable subset is reported not-proven rather than incompatible. Supply `corpus` (real inputs) for the tier that measures what your documents actually do.

輸入參數a必填b必填depthcorpusoptions

版本歷史

6
  1. v0.1.20最新Oct 8, 2026
  2. v0.1.19Oct 7, 2026
  3. v0.1.18Oct 6, 2026
  4. v0.1.17Oct 3, 2026
  5. v0.1.16Sep 23, 2026
  6. v0.1.15Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分