feat(backend): MCP d'édition de templates (#81)

Ajoute le MCP dédié à l'édition de templates : catalogue et classification
des templates (mcp/templates.rs infrastructure + app-tauri), use cases et
provider (application/template), enforcement de la policy des tools (mod.rs,
server.rs, tools.rs), avec la parité côté chemin OpenAI-compatible
(openai_tools.rs x2).

Lots B1 (catalogue/classification), B2 (use cases/provider) et B3
(enforcement policy) livrés en un seul commit cohérent.

QA vert (seul l'échec de bind loopback #80, connu et non-régression, écarté).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-20 18:45:02 +02:00
parent 448edfc364
commit ef84d5cc49
17 changed files with 1171 additions and 49 deletions

View File

@ -54,6 +54,8 @@ pub const READ_ONLY_TOOLS: &[&str] = &[
"idea_ticket_list",
"idea_ticket_read_carnet",
"idea_sprint_list",
"idea_template_list",
"idea_template_read",
];
/// Canonical write/action MCP tools denied by default.
@ -74,6 +76,9 @@ pub const WRITE_ACTION_TOOLS: &[&str] = &[
"idea_ticket_update_carnet",
"idea_ticket_link",
"idea_ticket_unlink",
"idea_template_create",
"idea_template_update",
"idea_template_delete",
];
/// All MCP tool names that have an explicit access classification.
@ -127,6 +132,7 @@ pub fn tool_returns_reply(tool: &str) -> bool {
| "idea_run_in_background"
| "idea_workstate_read"
) || is_ticket_tool(tool)
|| is_template_tool(tool)
}
/// Whether `tool` is a public ticket MCP tool.
@ -135,6 +141,12 @@ pub fn is_ticket_tool(tool: &str) -> bool {
super::tickets::is_ticket_tool(tool)
}
/// Whether `tool` is a public template MCP tool.
#[must_use]
pub fn is_template_tool(tool: &str) -> bool {
super::templates::is_template_tool(tool)
}
/// The full catalogue advertised on `tools/list`.
///
/// Exactly the tools whose mapping target already exists as an
@ -349,6 +361,7 @@ pub fn catalogue() -> Vec<ToolDef> {
},
];
tools.extend(super::tickets::catalogue());
tools.extend(super::templates::catalogue());
tools
}