Summary
PR #124 introduced spec.SafetyFromMCPMeta and spec.MergeToolSafety for mapping MCP tool descriptor metadata onto spec.safety, but no production path calls them yet. Author-set spec.safety in YAML is the only source of truth today.
This issue tracks wiring MCP tool discovery / registry merge so server-provided flags populate tool safety with correct precedence.
Motivation
Issue #103 defined precedence:
explicit Policy rule > spec.safety (author-set) > MCP meta.mcp_flags > fail-closed default
Without discovery wiring, MCP tools always fall through to fail-closed defaults unless authors duplicate flags in YAML.
Scope
In scope
- When MCP tools are listed/discovered (stdio or HTTP transport), read
meta.mcp_flags.{trusted,side_effects,requires_approval} and map via spec.SafetyFromMCPMeta.
- Merge with author
spec.safety using spec.MergeToolSafety (author wins per field when set).
- Run merge before or as part of
NormalizeProjectGraph / graph load so validate, plan, and run see effective safety.
- Unit/integration tests: MCP meta only, author overrides MCP, missing meta → fail-closed.
Out of scope
Acceptance criteria
References
Notes
Discovery hook point may be internal/tools/mcp and/or project loader / registry — confirm where tool descriptors are first merged into ProjectGraph.Tools before implementing.
Summary
PR #124 introduced
spec.SafetyFromMCPMetaandspec.MergeToolSafetyfor mapping MCP tool descriptor metadata ontospec.safety, but no production path calls them yet. Author-setspec.safetyin YAML is the only source of truth today.This issue tracks wiring MCP tool discovery / registry merge so server-provided flags populate tool safety with correct precedence.
Motivation
Issue #103 defined precedence:
Without discovery wiring, MCP tools always fall through to fail-closed defaults unless authors duplicate flags in YAML.
Scope
In scope
meta.mcp_flags.{trusted,side_effects,requires_approval}and map viaspec.SafetyFromMCPMeta.spec.safetyusingspec.MergeToolSafety(author wins per field when set).NormalizeProjectGraph/ graph load sovalidate,plan, andrunsee effective safety.Out of scope
Acceptance criteria
spec.safetyinherit flags frommeta.mcp_flagswhen present.spec.safetyfields override MCP for the same field; unset author fields can fall back to MCP.References
internal/spec/safety.go(MCPMetaFlagsKey,SafetyFromMCPMeta,MergeToolSafety)Notes
Discovery hook point may be
internal/tools/mcpand/or project loader / registry — confirm where tool descriptors are first merged intoProjectGraph.Toolsbefore implementing.