Pre-alpha 文档
绑定一个 MCP Tool,不削弱持久执行语义。
只发现一次 Stateless MCP 2026-07-28 Tool,在本地固定 Identity 与 Schema,并保留不确定 Write Outcome。
只接受明确收窄的 Profile
- Transport
- 生产环境使用经过验证的 HTTPS;Literal-loopback HTTP 仅用于受控 Sidecar 与测试。Redirect、HTTP Retry、Session 与 SSE 全部 Fail Closed。
- Discovery
- 启动时只执行一次 Modern Discovery,限制 Tool Catalog 分页,要求精确协议 Version 与 Tools Capability,并固定 Server 自报 Name/Version。
- Schema
- Remote Input/Output JSON Schema 必须与权威本地 Registry 的 RFC 8785 Canonical Bytes 完全一致。Remote Annotation 永远不能定义本地 Risk 或 Policy。
- Result
- 只接受 Complete Structured Content,并在本地有界校验。当前 Profile 拒绝 Artifact、Image、Audio、Embedded-resource 与 Resource-link Materialization。
在 Readiness 阶段冻结 Binding
本地 ToolDescriptor 必须来自审核过的配置。Server Upgrade 或 Schema
变化需要新 Binding;Runtime Call 不会静默重新发现。
let adapter = McpRemoteTool::connect(
local_descriptor,
"lookup_issue",
ProviderEndpoint::https("https://mcp.example.com/v1/")?,
McpServerIdentity::new("issue-service", "2026.09.0")?,
Arc::new(schema_registry),
Arc::new(authorization_provider),
McpHttpOptions::default(),
)
.await?; TLS 验证配置 Endpoint。Discovery 中的 Implementation Name/Version 是 Server 自报 Metadata;Pinning 可以检测 Drift,但不能替代 mTLS 或已认证 Gateway。
为每个已 Admission Attempt 解析 Secret
多租户部署应基于 Vault-backed Handle 实现 McpAuthorizationProvider。Adapter 取得 Call Gate 后才解析 Attempt Credential,从 Debug
中 Redact Authorization,Exchange 后清空 Slot,也不会把 Credential 写入 MCP
Metadata。Static Bearer 只适用于受控单租户 Binding。
保持 Lost Write 的不确定性
-
本地校验
Network Dispatch 前拒绝不符合 Pinned Schema 的 Input。
-
只调用一次
每个已 Admission 的持久化 Attempt 只发送一次
tools/call。 -
不虚构 Success
本地声明的 Write 丢失 Response 时,返回
UnknownExternal Effect、AmbiguousExternalOutcome与ReconcileFirst。 -
校验 Result
只接受通过本地 Pinned Output Schema 的 Complete Structured Output。
不再次调用 Tool 的权威对账
可信 Worker 或运维边界可以把精确的 Unknown Physical Attempt 转换为经过验证的
Result 或 Error。Runtime 会把证据绑定到 Invocation 与 Attempt,使用冻结的本地
Schema 校验 Result JSON,并在一个带 Fence 的 PostgreSQL Transaction 中提交独立
Audit Event。整个过程不会解析或 Dispatch Tool Provider。
let reconciliation = ToolReconciliationHandoff::result(
live_fence,
unknown_invocation,
reconciliation_event_id,
authoritative_result,
)?;
match executor.commit_tool_reconciliation(reconciliation).await? {
ToolReconciliationOutcome::Committed { .. } => acknowledge(),
ToolReconciliationOutcome::Idempotent { .. } => acknowledge(),
} 同一事件的精确 Retry 是幂等的。Persistence Failure 后,Handoff 仍保留权威 Evidence,并且只能为同一 Run 重新绑定新的 Live Fence。
补录已确认的失败,不重新发起写入
运维工具 stateknot_reconcile_tool_error_v1 需要独立的
stateknot:reconcile-error 权限,以及当前资源和证据授权。 仅接受原始
Unknown 尝试“确认未生效”not_applied 或 “确认已生效”applied 的证据,将 Failed 记录与授权审计原子提交。 未知或部分生效仍须保留为未决状态。
宿主固定使用 RetryAdvice::Never。未生效不等于从未执行、没有费用或可以安全重试。
回包丢失后,以完整相同请求恢复原回执;成功和失败提交竞争时,只允许一方成为最终事实。
原成功结果入口及其权限保持独立。这不代替 Provider
费用结算,也不代表完成生产发布验收。
查看失败结果核对接入与故障处理指南, 了解宿主注册、请求字段、权威证据要求及 PostgreSQL 16/17 验证方法。
明确当前拒绝项
- Stateful Session、SSE、Legacy Initialization 与 Reconnect。
- MRTR、Tasks、Incomplete Result、Progress 与 Artifact Content。
- 要求 StateKnot Idempotency-key Injection 的 Tool;Generic MCP 没有承载该 Durable Key 的安全标准字段。
- Server Behavior、Resource/Prompt Client、Roots、Sampling、Elicitation、 Logging 与 MCP Apps。独立 Server Profile 不会扩大该严格 Remote Tool 合约。
运行 Profile 与持久执行 Contract
cargo test -p stateknot-integrations --test mcp_contract --locked
cargo test -p stateknot-integrations --test mcp_durable --locked -- --test-threads=1
Suite 证明 Discovery Order、Identity/Schema Pinning、Credential Header、
Annotation Distrust、Pre-registration Drift Rejection 与 Ambiguous Lost
Write。PostgreSQL 16/17 Matrix 还会证明 Durable-before-dispatch
State、Lost Write Response、Unknown、Duplicate
Suppression、权威 Reconciliation,以及始终只有一次 Physical Network
Call。查看完整Profile 与运维合约和冻结的 MCP Conformance 状态。StateKnot 不声明完整的官方 MCP Client 或 Server Conformance。