
Api Governance
io.github.coderiftsv1.0.3更新於 Oct 8, 2026
Signed, offline-verifiable contract-change authorization. Only a granted change can proceed.
概覽
讓助理在合併或部署前預檢 API 契約變更、取得簽章的治理決策,並驗證回執。
- 功能
- 這是一個託管的 Streamable HTTP MCP 伺服器,只暴露三個工具。preflight_change_set 接收變更前後的契約成品,回傳破壞性變更分析與風險分數;在 authorize 模式下回傳治理決策(ALLOW、WARN、REQUIRE_APPROVAL、BLOCK),並可能簽發簽章的鏈式回執。verify_receipt 驗證回執的簽章、內容綁定,以及針對指定操作目前是否仍獲授權;get_decision_details 依 id 或指紋取回過去的決策。
- 適用情境
- 適合希望助理或 CI 步驟在 API 契約變更合併、部署或註冊前先行把關的情境,或代理需要一份可離線驗證的簽章紀錄,證明某項變更已獲授權時。analyze 模式僅提供資訊,不授予任何許可。
- 執行需求
- 遠端端點 Streamable HTTP;不需要本機執行環境或安裝套件。initialize、tools/list 與 analyze 呼叫不需要金鑰。authorize 呼叫需要 API 金鑰,透過 Authorization 標頭(Bearer)或 X-API-Key 傳送;Claude Code 外掛會讀取 CODERIFTS_API_KEY。金鑰需在供應商的註冊頁面申請。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Api Governance,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。
其他 MCP 客戶端
把它新增到你客戶端的 mcpServers 設定中。
{
"mcpServers": {
"api-governance": {
"type": "http",
"url": "https://app.coderifts.com/mcp"
}
}
}README
CodeRifts — contract-change authorization
Only a granted change can proceed. Before a contract change merges, deploys or registers, CodeRifts decides whether it is authorized — and the check is red without a grant.
One grant binds three things: the authorization, its single use, and the target state the change moves to. The decision is signed, and the receipt verifies offline — you do not have to trust our database to check what was authorized.
Every decision also names what it does not prove.
- Hosted MCP server:
https://app.coderifts.com/mcp - Manifest:
https://coderifts.com/mcp.json— the canonical published document. Themcp.jsonat the root of this repository is a pointer to it, not a second copy. - Official MCP Registry:
io.github.coderifts/api-governance - Website:
https://coderifts.com - Live demo PR:
https://github.com/coderifts/demo/pull/4
Install
GitHub Copilot reads the same server under three different root keys — servers in
.vscode/mcp.json, mcpServers in the cloud agent's MCP settings, and mcp-servers in a custom
agent's frontmatter — and npx coderifts copilot-setup writes all three (details below).
A key is needed only to authorize; get one at https://app.coderifts.com/api/signup.
Claude Code plugin
Install the CodeRifts marketplace, then the api-governance plugin (MCP server + skill).
Requires CODERIFTS_API_KEY for tool calls.
Local checkout (after clone):
The plugin wires the hosted MCP at https://app.coderifts.com/mcp and the
api-governance skill. Tools exposed: preflight_change_set, verify_receipt,
get_decision_details only.
Cursor plugin
Cursor Plugin package (measured Cursor layout: .cursor-plugin/plugin.json +
skills/ + rules/ + mcp.json + hooks/hooks.json). Same hosted MCP and the
same three tools as the Claude plugin — no fourth tool. Deterministic /
signed / fail-closed — not an AI compatibility scan.
Validate:
The generated-rule check is LIVE when CODERIFTS_APP_ROOT (default ~/coderifts-app)
has generated/agent-host/.cursor/rules/coderifts.mdc, and RECORDED against
fixtures/recorded/app-generator when it does not (weaker, named). A missing or
corrupt snapshot still exits 1 — no silent skip.
OpenAI / Codex package
Codex plugin package (measured OpenAI Codex layout: .codex-plugin/plugin.json +
.mcp.json + skills/ + AGENTS.md). Same hosted MCP and the same three tools
as the Claude plugin — no fourth tool.
Production pattern (function-calling apps)
OpenAI’s model only emits tool_call JSON; your app executes it. Wire governance at
that host loop — not as a Claude-style PreToolUse hook. Full steps + one canonical loop:
→ plugins/api-governance-openai/docs/openai-production-pattern.md
⚠ Still failing on the same one assertion, re-measured 2026-09-24: ALLOW factory ran — execute() did not run. The other eight assertions pass (4 ALLOW, 5 BLOCK), and the BLOCK side — the side that matters for a gate — is fully green: the factory does not run, the content is the gate denial with no fabricated success, and the decision identity is surfaced. The failing assertion is on the ALLOW path, where the dispatch wrapper returns the function result without having invoked the injected factory.
The 2026-09-14 version of this note ended "Investigation is in progress." That was dropped rather than re-dated: ten days on, it is a claim about activity that nothing here can verify, and a README that reports its own diligence is reporting the one thing a reader cannot check. What a reader can check is the assertion name and today's date.
Local checkout in Codex (team marketplace path):
Validate package consistency (manifest, tool parity, AGENTS.md empty-diff vs regeneration):
AGENTS.md regeneration is LIVE when ~/coderifts-app (or CODERIFTS_APP_ROOT) exists,
and RECORDED against fixtures/recorded/app-generator when it does not (weaker, named).
A missing or corrupt snapshot still exits 1. Directory listing / account submission steps are
not automated here.
GitHub Copilot kit
Reference copies of the generated Copilot MCP configs + instructions (single source:
coderifts-app generators). Same hosted MCP and the same three tools — no fourth tool.
Primary install (living command — prefer this over copying from the kit):
Agent-host instructions (including .github/copilot-instructions.md) come from:
Three Copilot surfaces (root keys differ)
From the generated guide (copilot/docs/copilot-mcp.md — do not re-author this table):
Tools allowlisted everywhere: preflight_change_set, verify_receipt, get_decision_details.
Vendored reference tree (copilot/)
Validate empty-diff vs regeneration + 3-tool discipline:
Empty-diff vs regeneration is LIVE when CODERIFTS_APP_ROOT has the generators, and
RECORDED against fixtures/recorded/app-generator when it does not (weaker, named).
A missing or corrupt snapshot still exits 1. The kit is a communication / distribution
mirror — npx coderifts copilot-setup remains the install path.
Agent Skill (skills.sh)
The skills CLI discovers skills/api-governance/SKILL.md at this repository's root and installs it under
the name api-governance. Where it lands depends on the agent (the CLI's own table): .agents/skills/api-governance/
for most agents (Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, …) and .claude/skills/api-governance/ for
Claude Code.
One skill, one name (2026-09-29). The three SKILL.md carriers — Claude
(plugins/api-governance/skills/api-governance/), Cursor (plugins/api-governance-cursor/skills/coderifts/) and
Codex/OpenAI (plugins/api-governance-openai/skills/api-governance/) — carry the same body byte for byte and the
same name: coderifts, the name skills.sh lists (npx skills add coderifts/api-governance installs
./.agents/skills/coderifts/, measured 2026-09-29). Only the frontmatter description is per host. All three are
generated by coderifts-app scripts/generate-skill-carriers.js from agent/skills/coderifts/SKILL.md;
test/one-skill.test.js holds them together. The website's .well-known/agent-skills/coderifts/SKILL.md is the
Cursor carrier, vendored.
MCP server
CodeRifts runs as a hosted Streamable HTTP MCP server. Any MCP-compatible agent (Claude Desktop, Cursor, LangGraph, AutoGen, custom) can connect and run governance checks before tool calls or merges.
- Endpoint:
https://app.coderifts.com/mcp - Transport: Streamable HTTP (protocol version
2025-06-18) - Server:
CodeRifts API Governancev1.0.3— read frominitialize→result.serverInfo.versionon 2026-09-24. A version typed into a README is a claim with a date on it;npm run validate:tools-wirecompares the TOOLS to the live server on every push, pull request and daily cron, but nothing compares this line, so re-read it rather than trust it. - Auth:
initialize,tools/listand an analyzetools/callneed no key (measured live 2026-09-26). An authorize call mints a signed receipt and needs an API key — sendAuthorization: Bearer <key>orX-API-Key: <key>.
Connect
Verify the connection
Expected: a JSON-RPC result with serverInfo and capabilities.tools.
Try without a key
An analyze call over MCP needs no key:
Measured response (live, 2026-09-26 — removing name from GET /pets), in the tool result:
That is information, not permission: may_execute is false on every analyze answer. To act,
call again with preflight_mode: "authorize" and context.operation, with a key.
Two public REST endpoints need no auth at all:
Both return HTTP 200 without a key. They do not share a response shape:
GET /api/v1/public/preflightis analyze-only. There is nodecisionfield. The body carriesanalysis_outcome(Petstore URL:NO_BREAK_DETECTED),authorization_effect: NONE, andmay_execute: false.POST /api/v1/public/actionguard-checkdoes return adecisionfield (unpinneduses: @mainpayload:WARN) plusexecution_action: CONTINUE_WITH_MONITORING.
Tools
The hosted MCP server exposes exactly three tools (from live tools/list; pinned in this
repository as tools.wire.v1.json, which npm run validate:tools-wire
checks against the live server on every push, pull request and the daily cron):
On the authorize path of preflight_change_set, the decision envelope includes fields such as decision, execution_action, risk_score, safe_for_agent, and related analysis fields so agent runtimes can branch on a stable contract. Prefer branching on execution_action when present.
How agents use it
- Before merging an API change (or before an agent acts on a contract change), call
preflight_change_setwith full before/after artifacts andpreflight_mode: "authorize"(pluscontext.operation). - Branch on
execution_actiononly:CONTINUEproceeds,CONTINUE_WITH_MONITORINGproceeds with a wired monitoring sink,REQUEST_APPROVALpauses for a human,STOPstops the merge / aborts the agent step. Any other value is not permission — fail closed. - Before acting under the receipt you hold, call
verify_receiptwith the same context the preflight was made under, and act only whencurrently_authorizedistrue. Do not re-preflight unless the change set or operation changed. - To inspect a prior decision by id, call
get_decision_details.
Decision logic is deterministic: a single breaking change is never silently allowed. Tests can pass and still ship a broken contract — CodeRifts checks the contract itself at PR time.
Also available
- GitHub App on the GitHub Marketplace — installs without configuration and posts a signed contract-change decision (ALLOW / WARN / REQUIRE_APPROVAL / BLOCK) on every pull request, across four gates: API contract, schema-vs-code, auth surface and workflow actions. ⚠ It reports by default: the check's phase-1 conclusion is clamped to
neutralandMERGEGATE_ENFORCEdefaults false, so it prevents a merge only once the check is required on the branch and that variable is on. The platform truth table is the source of truth for that distinction: https://coderifts.com/docs/platform-truth-table/ - SDKs:
npm install @coderifts/sdk(TypeScript),pip install coderifts-sdk(Python). - CLI:
coderifts(npm) with a pre-push hook. - Integrations: Backstage plugin, VS Code extension, LangGraph / AutoGen / CrewAI.
Links
- Website: https://coderifts.com
- Decision Spec: https://coderifts.com/decision-spec/
- API reference: https://app.coderifts.com/api/docs
- Manifest: https://coderifts.com/mcp.json
- Receipt verifier (verify our receipts without trusting us): https://github.com/coderifts/receipt-verifier
- Contact: [email protected]
License
See LICENSE.
來源:README.md,提交 b22a061
工具
0版本歷史
2- v1.0.3最新Sep 20, 2026
- v1.0.2Sep 16, 2026

