Forge
markdowndeeb25a2
1<!-- English translation of adr/0008-mcp-contracts-and-testable-infrastructure.md. Canonical Russian: ../../adr/0008-mcp-contracts-and-testable-infrastructure.md -->
2
3#ADR 0008: Stable MCP contracts and testable infrastructure
4
5**Status:** Accepted · Implemented
6**Date:** 2026-04-02
7## Related ADRs
8
9### Outside ADR
10
11| Document | Role |
12|----------|------|
13| [MCP-PROTOCOL.md](../../MCP-PROTOCOL.md) | MCP PROTOCOL |
14
15### Implementation snapshot
16
17| Element | Meaning |
18|---------|----------|
19| — | `IIdeMcpActions`, MCP executor, contracts in MCP-PROTOCOL |
20
21---
22## Context
23
24The agent communicates with the IDE via MCP. Within the application, predictable boundaries are needed: otherwise the tools duplicate business rules, and git/processes cannot be replaced in tests.
25
26## Solution
27
28###MCP
29
30Agent contracts (`IIdeMcpActions`, DTO) - **stable**; changes consciously and with versioning of the contract where this is accepted in the repo.
31
32The MCP implementation **delegates** to services and ViewModels without duplicating the same business rules in each tool handler.
33
34### Outside world
35
36Git, `Process`, long-term operations are behind **abstraction**, which can be replaced in tests (interface or `internal` + `InternalsVisibleTo` - depending on the situation).
37
38## Consequences
39
40New tools are added based on existing services; heavy logic is not copied to the MCP command manager layer.
41
42## Rejected alternatives
43
44- Making each tool self-sufficient with direct access to the file system and processes - rejected as unsupported as the number of commands grows.
View only · write via MCP/CIDE