# BAT-015 Implementation ## Code changes - `jarca_ledger_mcp/adapters/mcp/server.py` - Added `McpRuntimeConfig` dataclass. - Added env parsing for `JARCA_MCP_TRANSPORT`, `JARCA_MCP_HOST`, `JARCA_MCP_PORT`, `JARCA_MCP_STREAMABLE_HTTP_PATH`, `JARCA_MCP_SSE_PATH`, `JARCA_MCP_MESSAGE_PATH`, `JARCA_MCP_STATELESS_HTTP`. - Instantiates FastMCP with configured host/port/path values. - Calls `mcp.run(transport=_runtime_config.transport)`. - `tests/test_mcp_http_runtime.py` - Added config tests for default stdio, streamable-http env, and invalid transport rejection. ## Deployment files - `Dockerfile` - Builds `jarca-ledger:latest` from `python:3.12-slim`. - Installs `.[dashboard]` dependencies. - Exposes port 8000 and runs `jarca-ledger-mcp`. - Adds TCP healthcheck against `127.0.0.1:${JARCA_MCP_PORT}`. - `.dockerignore` - Excludes `.env`, DBs, financial source files, tests/docs/scripts not needed in image, and local artifacts. - `docker-compose.yml` - Defines `container_name: jarca-ledger`. - Maps `8000:8000`. - Mounts `/volume1/docker/jarca-ledger/data:/data`. - Sets streamable-http MCP env. - Uses `restart: unless-stopped`. ## Data migration implementation 1. Created a consistent source snapshot inside the old `jarca` container using SQLite backup API. 2. Copied snapshot to the host temp path. 3. Backed up the initial empty `jarca-ledger` DB under `/data/backups/pre_migration_empty_20260705152129.sqlite3`. 4. Stopped `jarca-ledger`, removed WAL/SHM sidecars, copied the snapshot to `/data/ledger.sqlite3`, normalized permissions, and restarted. 5. Waited for Docker health to become `healthy`. ## Documentation changes - Added `docs/runbooks/docker-network-mcp-deploy.md`. - Added this StagePilot post-implementation trace: dcy-013, REQ-019, BAT-015. - Updated `docs/project-structure.md` and `docs/runtime-flows.md` to include Docker/network MCP runtime.