# BAT-014 Implementation ## Plan summary BAT-014 implements dcy-011 Phase 7 by narrowing the remaining adapter surfaces without changing public MCP tool names or dashboard behavior. The MCP server now depends on `adapters/mcp/tool_contracts.py` instead of a broad direct `service` import, and the Streamlit dashboard now calls page/domain gateways under `adapters/streamlit/*_gateway.py` rather than a flat broad `service_gateway` namespace. `service_gateway.py` remains as a compatibility aggregator. ## Delivered changes 1. Added `jarca_ledger_mcp/adapters/mcp/tool_contracts.py` as the MCP adapter contract surface and repointed `adapters/mcp/server.py` wrappers to `contracts.*` callables. 2. Added page/domain Streamlit gateways: - `overview_gateway.py` - `assets_gateway.py` - `transactions_gateway.py` - `categorization_gateway.py` - `transfers_gateway.py` - `imports_gateway.py` - `accounts_gateway.py` - `reconciliation_gateway.py` 3. Reworked `adapters/streamlit/service_gateway.py` into a compatibility aggregator over the new gateway modules. 4. Repointed `dashboard/app.py` static call sites away from `service.*` to the owning page/domain gateway modules. 5. Preserved hot-reload fallback by changing `get_service_callable()` to reload the passed gateway module rather than a broad flat service namespace. 6. Refreshed `docs/project-structure.md` and `docs/runtime-flows.md` so the baseline reflects post-Phase-7 ownership and adapter seams. ## Compatibility notes - MCP tool names, argument shapes, and response contracts were intentionally preserved. - `adapters/streamlit/service_gateway.py` still exists as a compatibility surface for any legacy dashboard-side imports. - No SQL/UI business-rule ownership was moved into the dashboard; the app still goes through adapter gateways. ## Files changed - `jarca_ledger_mcp/adapters/mcp/tool_contracts.py` - `jarca_ledger_mcp/adapters/mcp/server.py` - `jarca_ledger_mcp/adapters/streamlit/__init__.py` - `jarca_ledger_mcp/adapters/streamlit/service_gateway.py` - `jarca_ledger_mcp/adapters/streamlit/*_gateway.py` - `dashboard/app.py` - `docs/project-structure.md` - `docs/runtime-flows.md` ## Outcome The repository now has explicit MCP contract and Streamlit page/domain gateway seams, satisfying the final dcy-011 narrowing target while preserving all public compatibility surfaces.