feat(mcp): add restore plan and integrity checks#1381
Open
Conversation
Expose read-only restore planning and post-restore integrity check modes through MCP.
PR Build Metrics✅ All clear — no issues detected
Binary Size
Dependency ChangesNo dependency changes. govulncheck OutputBuild Info
History (2 previous)
🤖 Updated on each push. |
Use multiple replica transactions so the MCP restore-plan tests prove TXID and timestamp targets are propagated and cap the ordered plan.
Close transient NATS and SFTP clients after restore planning and join cleanup errors. Use a corrupt restore fixture to verify quick and full integrity checks run and remove failed outputs.
Preserve restore planning and integrity checks on top of the shared MCP resource ownership and client lifecycle contract.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a read-only
litestream_restore_planMCP tool that resolves configured database paths and replica URLs in-process, accepts optional TXID or timestamp targets, and returns the ordered restore plan produced bylitestream.CalcRestorePlan. The tool advertisesreadOnlyHint: trueand does not create its optional output path.Adds an
integrity_checkoption tolitestream_restorewithnone,quick, andfullmodes, passes the selected mode to the restore library, and reports it in the restore result.This is a stacked PR containing only the issue #1371 delta above #1367. It does not pull in other MCP branches.
Motivation and Context
The MCP restore surface could perform a restore but could not safely preview the snapshot and LTX files that would be applied. It also always reported the integrity mode as
noneand provided no way to request the library-supported post-restore checks.Investigation evidence:
integrity_checktonone.litestream.CalcRestorePlan.Closes #1371
How Has This Been Tested?
go test ./cmd/litestream -run 'Test(RestorePlanTool|RestoreTool|MCP)' -count=1go test -v ./cmd/litestreamgo build ./...go test ./...go test -race -v ./...pre-commit run --all-filesTypes of changes
Checklist
go fmt,go vet)go test ./...)