kcp-harness — KCP compliance proxy

no.cantara由 cantara.no 发布v0.4.1更新于 Oct 24, 2026

MCP compliance proxy between agent and tools: deterministic governance, fail-closed, audit trail.

发布方自己的服务:Cantara wiki — community knowledge web

概览

AI 生成的概览

一个位于 AI 编码代理与其工具之间的 MCP 合规代理,以确定性方式治理知识访问并生成审计产物。

可以做什么
拦截代理发出的与知识相关的工具调用,并通过不涉及 LLM 的确定性 14 道门规划器进行路由。提供 kcp_plan、kcp_load、kcp_trace、kcp_validate、harness_status、harness_budget、harness_temporal_check、harness_approvals 和 harness_assess 等治理工具。在代理正常运行时附带生成决策轨迹、仅追加的审计日志、预算账本、时间漂移事件和人工审批工单。故障关闭:如果请求无法验证,代理将得不到任何内容。
适用场景
适用于代理需要对受治理知识进行可审计、可复现且受预算控制的访问的场景,例如企业或合规敏感的编码工作流。它旨在增加治理层而不替换代理,并支持与 Claude Code、Cursor、Copilot、Windsurf、Cline、Continue、Crush、OpenClaw 和 Pi 等代理集成。
运行要求
作为本地进程通过 stdio 运行,可通过 npm 安装(npm install -g kcp-harness)或用 npx 运行;也提供预构建的原生二进制文件。需要 harness.yaml 配置和 knowledge.yaml 清单。未声明身份验证、环境变量或请求头。仅限桌面端。
安装前请注意
该代理会治理并记录工具调用,包括直通决策,并可暂停调用以等待指定人员审批。审批规则可能涵盖 Write 和 Edit 等写入工具,预算上限按币种强制执行。工单存储目录本身不受该工具保护,且只有在启用 require_signed_resolutions 时才会在每次读取时验证签名决议。

安装

在 SourceWeft 中

  1. 打开 控制台中的 kcp-harness — KCP compliance proxy,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

kcp-harness

🧾 See it run — interactive KCP playground · read the reveal

Deterministic knowledge governance for any AI agent.

Your agent can read every file in your project. Can it prove why it read what it read?

KCP Harness is an MCP compliance proxy that sits between an AI coding agent and its tools. It intercepts knowledge-related calls, routes them through the kcp-agent deterministic planner (14-gate cascade, no LLM), and produces compliance artifacts — decision traces, audit logs, budget ledgers — as a side effect of normal agent operation.

The agent can't bypass governance because it only talks to the proxy's MCP interface. The proxy decides what knowledge is accessible, tracks spend, and logs every decision. Fail-closed: if the harness can't verify a request, the agent gets nothing.

Agent (Claude Code / Cursor / Copilot / Windsurf / Cline / Crush / OpenClaw / ...)  │  │  MCP tool call  v┌─────────────────────────────────────────────────────────┐│  kcp-harness                                            ││                                                         ││  classify → govern (14 gates) → execute → audit         ││                                                         ││  Side outputs:                                          ││  · Decision traces     (per-request, deterministic)     ││  · Audit log           (append-only JSONL)              ││  · Budget ledger       (itemized, ceiling-enforced)     ││  · Temporal drift      (plan validity over time)        ││  · Approval tickets    (named-human sign-off, durable)  ││  · Confidence verdicts (post-synthesis gate)            │└─────────────────────────────────────────────────────────┘  │  vKnowledge manifests (knowledge.yaml)

Documentation →

Why

Enterprises need agents that are defensible — auditable, reproducible, budget-controlled, temporally pinned. Today's agents can't prove why they read what they read. The harness adds a compliance layer without replacing the agent.

What you keepWhat the harness adds
Your agent (Claude Code, Cursor, Copilot, ...)Deterministic knowledge selection
Your workflow (coding, reviewing, shipping)Decision traces (14 gates per unit)
Your tools (MCP servers, shell, browser)Budget enforcement (ceiling, per-currency)
Temporal governance (drift detection)
Append-only audit log
Replay / cross-examination
Human-approval gates (named reviewer + policy citation)
Confidence gating (post-synthesis, route-to-human)

You sell the compliance layer. The agents are pluggable.

Install

bash
npm install -g kcp-harness

Or use without installing:

bash
npx kcp-harness --help

Native executables

Pre-built binaries (no Node/Deno required) for Linux x64/arm64, macOS x64/arm64, and Windows x64 — grab them from a release. To build one yourself:

bash
npm ci && npm run builddeno compile --allow-read --allow-env --allow-net --allow-run \  --node-modules-dir=auto --output kcp-harness dist/cli.js

Quick start

1. Initialize

bash
kcp-harness init          # creates harness.yaml

2. Generate agent integration

bash
kcp-harness integrate claude-code    # or: pi, cursor, copilot, windsurf, cline, continue, crush, openclaw

3. Start coding

Your agent now routes knowledge access through the harness. Every decision is logged.

Supported agents

AgentConfigIntegration
Claude Code.mcp.json + PreToolUse hookskcp-harness integrate claude-code
Cursor.cursor/mcp.json + .mdc ruleskcp-harness integrate cursor
GitHub Copilot.vscode/mcp.json (uses "servers" key)kcp-harness integrate copilot
Windsurfglobal config + .windsurfruleskcp-harness integrate windsurf
ClineMCP settings + .clineruleskcp-harness integrate cline
Continue.continue/mcpServers/*.yamlkcp-harness integrate continue
Crushcrush.json + PrepareStepkcp-harness integrate crush
OpenClawopenclaw.json + plugin hookskcp-harness integrate openclaw
Pi.pi/mcp.json + project skillskcp-harness integrate pi

Each agent has its own MCP config format, rules file, and quirks. The integrate command handles them all — one governance layer, any agent.

How it works

Every tool call flows through a five-stage pipeline:

1. RECEIVE      MCP JSON-RPC request from agent2. CLASSIFY     Knowledge-navigation or pass-through?3. GOVERN       14-gate cascade (audience → temporal → budget → ...)4. EXECUTE      Call downstream tool / return content5. AUDIT        Log decision to append-only audit log

Classifier

The classifier examines each tool call and determines whether it targets governed knowledge. Read("docs/api.md") where docs/ is governed? Route through the planner. Read("package.json") where package.json isn't governed? Pass through. KCP tools (kcp_plan, kcp_load) are always governed.

Governor

Two automated modes, plus a human gate that outranks both:

  • Plan-first (fast path) — the agent calls kcp_plan first. The harness caches the approved plan. Subsequent reads are checked against the cached plan — no re-planning.
  • Auto-plan (fallback) — the agent reads a governed path without planning. The harness runs the planner automatically. Slower, but governance is enforced even for agents that don't know about kcp_plan.
  • Human approval — calls matching a governance.approvals rule are held for a named reviewer (pending), no matter what the automated paths would decide. Tickets survive restarts and resolve via the kcp-harness approvals CLI (or any custom ApprovalProvider channel). Resolutions require a named reviewer and a policy citation.

The 14-gate cascade

Every knowledge unit is evaluated through 14 deterministic gates, in order:

audience → not_for → temporal → deprecated → supersession → relevance →skill_eligibility → attestation → payment → access → strict → max_units →money_budget → context_budget

A unit must pass all gates. The gate that blocks it is recorded in the decision trace. Same inputs → same plan. No model involved.

For the skill_eligibility gate's subject matter — governed kind: skill units — the authoring conventions, linter, and conformance vectors live in Cantara/kcp-skill.

MCP tools

Once connected, agents can use these governance tools:

ToolDescription
kcp_planDeterministic load plan — which units, in what order, which skipped and why
kcp_loadPlan + load eligible unit content
kcp_traceFull 14-gate decision trace
kcp_validateLint a knowledge.yaml
harness_statusCurrent governance state
harness_sessionApproved plans + known units for this session
harness_budgetItemized spend tracking
harness_temporal_checkPlan drift detection
harness_approvalsHuman-approval tickets (pending / approved / dismissed / expired)
harness_assessConfidence-gate a synthesized answer before acting on it

Compliance artifacts

Audit log

Append-only JSONL. Every decision — governed or pass-through — is logged with sequence number, timestamp, tool, targets, and governance decision:

bash
cat .kcp-harness/audit.jsonl | jq 'select(.governed == true)'

Budget ledger

Append-only itemized spend tracking. Per-currency running totals. Ceiling enforcement — a load that would exceed the budget is rejected atomically (no partial loads).

Temporal governance

Plans are registered with a temporal watcher. On subsequent calls, the watcher re-evaluates against the current time. If units have drifted (expired, newly valid), the harness emits a drift event. Long-running sessions stay honest.

Approval tickets

Calls matching an approval rule open a durable ticket (pending_review → approved | dismissed | expired, plus used for a consumed one-shot grant). The ticket store survives restarts — sessions are ephemeral, human review is not. Every resolution records who approved, when, and which policy it satisfies — evidence generated at approval time, never reconstructed from logs.

An approval is a bounded grant, never a standing permission. It covers the session that opened the ticket, the exact tool and target, and the call's arguments digest — and it lapses. Each rule sets grant: once | session | <duration> (default session), always capped by governance.approvals.grant_max (default 24h). A call outside a valid grant is denied, audited as grant_denied (expired, wrong_session, used, ...) and opens a new ticket. A standing permission is a policy rule, not a click. A grant's window is measured from the store's own clock, not the reviewer-supplied reviewedAt; the first valid resolution of a ticket wins (a dismissed ticket cannot be re-approved by an appended line); with approvals.require_signed_resolutions signatures are verified on every read, not only in resolve(); and approvals.require_args_binding refuses grants from tickets not bound to the call's arguments. What the ticket store does not protect — write access to its directory — is stated in the Ticket store trust model. See Governance Model.

Confidence verdicts

harness_assess runs kcp-agent's post-synthesis assess() over a synthesized answer before it may be acted on. The planner gates loading, grounding gates asserting, this gates acting. Below-threshold verdicts on routed configs open an approval ticket with the full verdict embedded as evidence.

Configuration

yaml
# harness.yamlversion: "1.0"
governance:  domains:    - manifest: "./knowledge.yaml"      paths: ["docs/", "src/"]
  policy:    fail_closed: true    audit_all: true    max_units: 5    budget:      amount: 1.00      currency: USDC
  confidence:                  # optional post-synthesis gate (harness_assess)    threshold: 0.7    severity: critical    route_to_role: account-owner
  approvals:                   # optional human-approval gates    provider: file    rules:      - match: { tools: [Write, Edit], paths: [records/] }        required_role: account-owner        expires_after: 72h        policy_ref: POL-7.2        grant: session           # once | session | 15m / 4h / 1d  (default: session)    grant_max: 24h               # hard cap on any approval's validity (default 24h)    # require_signed_resolutions: true  # + trusted_keys: verify signatures on every read (recommended)    require_args_binding: true   # refuse grants not bound to the call's arguments (recommended)
audit:  path: ".kcp-harness/audit.jsonl"

CLI

kcp-harness serve  [--config harness.yaml]   Start the MCP proxykcp-harness init                             Create a harness.yaml templatekcp-harness check  [--config harness.yaml]   Validate configurationkcp-harness integrate <agent> [options]       Generate agent integration fileskcp-harness integrate --list                  List supported agentskcp-harness export   [options]               Export compliance evidence (SOC 2 / ISO 27001)kcp-harness dashboard [options]              Launch the live compliance dashboardkcp-harness approvals list [--state s]        List human-approval ticketskcp-harness approvals approve <id> --reviewer <name> --policy-ref <ref>kcp-harness approvals dismiss <id> --reviewer <name> --policy-ref <ref>

Library

ts
import { classify, govern, BudgetLedger, TemporalWatch } from "kcp-harness";import { generate, listAgents } from "kcp-harness";
// Classify a tool callconst result = classify("Read", { file_path: "docs/api.md" }, governedDomains);
// Generate integration filesconst output = generate("claude-code", { manifest: "./knowledge.yaml", paths: ["docs/"] });

Architecture

┌──────────────────────────────────────────────┐│  Layer 3: Integration Packages               ││  Agent-specific configs + rules files        ││  (claude-code, cursor, copilot, ...)         │├──────────────────────────────────────────────┤│  Layer 2: KCP Compliance Harness             │  ← THIS│  MCP proxy — deterministic governance        │├──────────────────────────────────────────────┤│  Layer 1: kcp-agent (planner core)           ││  14-gate cascade, decision traces            │└──────────────────────────────────────────────┘

Forking agents puts you in competition. A harness puts you in composition.

Tests

bash
npm test     # 314 tests across 20 test files

Covers the classifier, governor (incl. approval precedence), approval state machine + providers, confidence-gate wiring, proxy, audit, budget ledger, temporal watch, evidence export, dashboard, and all agent integrations.

License

Apache-2.0 · By eXOReaction AS, hosted under Cantara.

来源:README.md,提交 2c399d2

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.4.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Cantara 集成