MCP 生产宿主与 Tool Schema 治理

🏠 返回 07-README | ⬅️ 14-A2A协议与Agent互操作-Task生命周期 | ➡️ 16-Voice与实时对话Agent-生产架构


§0 面试前 Checklist

金句(90s):见各 L1。

L1 · MCP 在生产栈中的位置

SSE

Agent Runtime

MCP Server Java

Domain API

Registry

角色 职责
MCP Client LangGraph / Spring AI
MCP Server 鉴权、schema、执行、审计
Registry tool_schema_ref pin

L2 · 宿主设计(深展)

2.1 部署形态

形态 适用 风险
Sidecar 强隔离 资源多
共享服务 推荐 需 bulkhead
stdio dev only 无鉴权

2.2 Tool 设计十诫

# 规则
1 窄 Tool,禁万能 SQL
2 写 Tool 必 HITL
3 幂等键写操作必备
4 tenant 服务端强制
5 schema 版本进 Registry
6 错误码可机器读
7 超时 < Agent deadline
8 审计 log 脱敏
9 只读默认
10 红队非法 Tool 名 Golden

L3 · Schema 治理

阶段 动作
设计 JSON Schema 入 Git
PR breaking change 检测
发布 tool_schema_ref 写入 Release
回滚 先 schema 维

L4 · 与 A2A / gRPC

场景 选型
查订单 MCP get_order
调 Python 推理 gRPC 13
外包伙伴 A2A 14

L11 · STAR

STAR:schema 未 pin 全红

要素 内容
S 发版未绑 tool_schema_ref
A Release Record 四维绑定;CI 契约测
M illegal_tool_rate 飙升
P 回滚 schema;Canary

Q1 · 大厂题 #1

标准答案:结合本章 L2–L3 机制回答;强调 release_id、审计、Golden 门禁。

追问:如何回滚?→ Registry 先回滚 schema/prompt 维。

Q2 · 大厂题 #2

标准答案:结合本章 L2–L3 机制回答;强调 release_id、审计、Golden 门禁。

追问:如何回滚?→ Registry 先回滚 schema/prompt 维。

Q3 · 大厂题 #3

标准答案:结合本章 L2–L3 机制回答;强调 release_id、审计、Golden 门禁。

追问:如何回滚?→ Registry 先回滚 schema/prompt 维。

Q4 · 大厂题 #4

标准答案:结合本章 L2–L3 机制回答;强调 release_id、审计、Golden 门禁。

追问:如何回滚?→ Registry 先回滚 schema/prompt 维。

Q5 · 大厂题 #5

标准答案:结合本章 L2–L3 机制回答;强调 release_id、审计、Golden 门禁。

追问:如何回滚?→ Registry 先回滚 schema/prompt 维。

Q6 · 大厂题 #6

标准答案:结合本章 L2–L3 机制回答;强调 release_id、审计、Golden 门禁。

追问:如何回滚?→ Registry 先回滚 schema/prompt 维。

Q7 · 大厂题 #7

标准答案:结合本章 L2–L3 机制回答;强调 release_id、审计、Golden 门禁。

追问:如何回滚?→ Registry 先回滚 schema/prompt 维。

Q8 · 大厂题 #8

标准答案:结合本章 L2–L3 机制回答;强调 release_id、审计、Golden 门禁。

追问:如何回滚?→ Registry 先回滚 schema/prompt 维。

Q9 · 大厂题 #9

标准答案:结合本章 L2–L3 机制回答;强调 release_id、审计、Golden 门禁。

追问:如何回滚?→ Registry 先回滚 schema/prompt 维。

Q10 · 大厂题 #10

标准答案:结合本章 L2–L3 机制回答;强调 release_id、审计、Golden 门禁。

追问:如何回滚?→ Registry 先回滚 schema/prompt 维。

§15 Checklist

  • 机制与边界
  • 生产宿主/观测
  • Registry 绑定
  • STAR 各一条
  • Golden 负例

L6 · MCP 参数矩阵(扩展)

6.1 配置组 1

说明
slot_1_timeout_ms 320 超时
slot_1_max_tokens 4224 上下文
slot_1_retry 1 重试

6.2 配置组 2

说明
slot_2_timeout_ms 340 超时
slot_2_max_tokens 4352 上下文
slot_2_retry 2 重试

6.3 配置组 3

说明
slot_3_timeout_ms 360 超时
slot_3_max_tokens 4480 上下文
slot_3_retry 3 重试

6.4 配置组 4

说明
slot_4_timeout_ms 380 超时
slot_4_max_tokens 4608 上下文
slot_4_retry 3 重试

6.5 配置组 5

说明
slot_5_timeout_ms 400 超时
slot_5_max_tokens 4736 上下文
slot_5_retry 3 重试

6.6 配置组 6

说明
slot_6_timeout_ms 420 超时
slot_6_max_tokens 4864 上下文
slot_6_retry 3 重试

6.7 配置组 7

说明
slot_7_timeout_ms 440 超时
slot_7_max_tokens 4992 上下文
slot_7_retry 3 重试

6.8 配置组 8

说明
slot_8_timeout_ms 460 超时
slot_8_max_tokens 5120 上下文
slot_8_retry 3 重试

6.9 配置组 9

说明
slot_9_timeout_ms 480 超时
slot_9_max_tokens 5248 上下文
slot_9_retry 3 重试

6.10 配置组 10

说明
slot_10_timeout_ms 500 超时
slot_10_max_tokens 5376 上下文
slot_10_retry 3 重试

6.11 配置组 11

说明
slot_11_timeout_ms 520 超时
slot_11_max_tokens 5504 上下文
slot_11_retry 3 重试

6.12 配置组 12

说明
slot_12_timeout_ms 540 超时
slot_12_max_tokens 5632 上下文
slot_12_retry 3 重试

6.13 配置组 13

说明
slot_13_timeout_ms 560 超时
slot_13_max_tokens 5760 上下文
slot_13_retry 3 重试

6.14 配置组 14

说明
slot_14_timeout_ms 580 超时
slot_14_max_tokens 5888 上下文
slot_14_retry 3 重试

6.15 配置组 15

说明
slot_15_timeout_ms 600 超时
slot_15_max_tokens 6016 上下文
slot_15_retry 3 重试

6.16 配置组 16

说明
slot_16_timeout_ms 620 超时
slot_16_max_tokens 6144 上下文
slot_16_retry 3 重试

6.17 配置组 17

说明
slot_17_timeout_ms 640 超时
slot_17_max_tokens 6272 上下文
slot_17_retry 3 重试

6.18 配置组 18

说明
slot_18_timeout_ms 660 超时
slot_18_max_tokens 6400 上下文
slot_18_retry 3 重试

6.19 配置组 19

说明
slot_19_timeout_ms 680 超时
slot_19_max_tokens 6528 上下文
slot_19_retry 3 重试

6.20 配置组 20

说明
slot_20_timeout_ms 700 超时
slot_20_max_tokens 6656 上下文
slot_20_retry 3 重试

6.21 配置组 21

说明
slot_21_timeout_ms 720 超时
slot_21_max_tokens 6784 上下文
slot_21_retry 3 重试

6.22 配置组 22

说明
slot_22_timeout_ms 740 超时
slot_22_max_tokens 6912 上下文
slot_22_retry 3 重试

6.23 配置组 23

说明
slot_23_timeout_ms 760 超时
slot_23_max_tokens 7040 上下文
slot_23_retry 3 重试

6.24 配置组 24

说明
slot_24_timeout_ms 780 超时
slot_24_max_tokens 7168 上下文
slot_24_retry 3 重试

6.25 配置组 25

说明
slot_25_timeout_ms 800 超时
slot_25_max_tokens 7296 上下文
slot_25_retry 3 重试

2.20 Tool 模板 #0

field type required
tenant_id string yes
idempotency_key string write only

2.21 Tool 模板 #1

field type required
tenant_id string yes
idempotency_key string write only

2.22 Tool 模板 #2

field type required
tenant_id string yes
idempotency_key string write only

2.23 Tool 模板 #3

field type required
tenant_id string yes
idempotency_key string write only

2.24 Tool 模板 #4

field type required
tenant_id string yes
idempotency_key string write only

2.25 Tool 模板 #5

field type required
tenant_id string yes
idempotency_key string write only

2.26 Tool 模板 #6

field type required
tenant_id string yes
idempotency_key string write only

2.27 Tool 模板 #7

field type required
tenant_id string yes
idempotency_key string write only

2.28 Tool 模板 #8

field type required
tenant_id string yes
idempotency_key string write only

2.29 Tool 模板 #9

field type required
tenant_id string yes
idempotency_key string write only

2.30 Tool 模板 #10

field type required
tenant_id string yes
idempotency_key string write only

2.31 Tool 模板 #11

field type required
tenant_id string yes
idempotency_key string write only

2.32 Tool 模板 #12

field type required
tenant_id string yes
idempotency_key string write only

2.33 Tool 模板 #13

field type required
tenant_id string yes
idempotency_key string write only

2.34 Tool 模板 #14

field type required
tenant_id string yes
idempotency_key string write only

2.35 Tool 模板 #15

field type required
tenant_id string yes
idempotency_key string write only

2.36 Tool 模板 #16

field type required
tenant_id string yes
idempotency_key string write only

2.37 Tool 模板 #17

field type required
tenant_id string yes
idempotency_key string write only

2.38 Tool 模板 #18

field type required
tenant_id string yes
idempotency_key string write only

2.39 Tool 模板 #19

field type required
tenant_id string yes
idempotency_key string write only
Logo

欢迎加入 MCP 技术社区!与志同道合者携手前行,一同解锁 MCP 技术的无限可能!

更多推荐