Skip to content

feat(mcp): add daemon control tools#1382

Open
corylanou wants to merge 5 commits into
issue-1368-refactor-mcp-migrate-to-the-official-modelcontextprotocol-gofrom
issue-1372-feat-mcp-add-daemon-control-tools-list-sync-info-start-stop
Open

feat(mcp): add daemon control tools#1382
corylanou wants to merge 5 commits into
issue-1368-refactor-mcp-migrate-to-the-official-modelcontextprotocol-gofrom
issue-1372-feat-mcp-add-daemon-control-tools-list-sync-info-start-stop

Conversation

@corylanou

Copy link
Copy Markdown
Collaborator

Description

Adds seven daemon-control tools to the official MCP SDK surface:

  • litestream_list and litestream_daemon_info are annotated read-only.
  • litestream_sync, litestream_start, litestream_stop, litestream_register, and litestream_unregister are annotated mutating and destructive.
  • Each tool calls the corresponding HTTP endpoint over the daemon Unix socket and accepts optional socket and timeout inputs.
  • Sync exposes the daemon's wait behavior for remote replication.
  • Successful daemon responses are returned as JSON text, while missing or refused sockets return a clear no-daemon error.

Motivation and Context

The daemon already exposes /list, /sync, /info, /start, /stop, /register, and /unregister, but the MCP server did not register tools for those endpoints. Assistants therefore could not inspect or control the running daemon through MCP.

The MCP behavior test now exercises all seven methods, paths, request bodies, and responses over a real Unix socket. A separate matrix verifies that every tool reports no Litestream daemon is running when the socket is absent.

Scope

In scope:

  • Official Go SDK tool registration and annotations.
  • Unix-socket IPC requests with context and timeout propagation.
  • Daemon response and connection error handling.
  • Tool schema, behavior, and no-daemon tests.

Not in scope:

  • Structured outputs beyond the existing text output contract.
  • Standalone MCP transport changes.
  • Changes from other MCP feature branches.

Behavior Change

Scenario Before After
List or inspect a running daemon No MCP tool Read-only MCP tools call daemon IPC
Sync, start, stop, register, or unregister No MCP tool Destructive MCP tools call daemon IPC
Sync and wait for remote replication Unavailable through MCP litestream_sync accepts wait: true
Daemon is not running No daemon tool behavior Clear no-daemon tool error

How Has This Been Tested?

  • go test -race ./...
  • go vet ./...
  • go mod verify
  • pre-commit run --all-files
  • validation_dir=$(mktemp -d); go build -o "${validation_dir}/litestream" ./cmd/litestream
  • validation_dir=$(mktemp -d); GOOS=windows CGO_ENABLED=0 go test -c -o "${validation_dir}/litestream.test.exe" ./cmd/litestream

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project (go fmt, go vet)
  • I have tested my changes (go test ./...)
  • I have updated the documentation accordingly (not needed; no configuration or CLI behavior changed)

Related

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

PR Build Metrics

All clear — no issues detected

Check Status Summary
Binary size 38.38 MB (+92.0 KB / +0.23%)
Dependencies No changes
Vulnerabilities None detected
Go toolchain 1.25.12 (latest)
Module graph 1248 edges (0)

Binary Size

Size Change
Base (eb6c415) 38.29 MB
PR (5967896) 38.38 MB +92.0 KB (+0.23%)

Dependency Changes

No dependency changes.

govulncheck Output

=== Symbol Results ===

No vulnerabilities found.

Your code is affected by 0 vulnerabilities.
This scan also found 0 vulnerabilities in packages you import and 1
vulnerability in modules you require, but your code doesn't appear to call these
vulnerabilities.
Use '-show verbose' for more details.

Build Info

Metric Value
Build time 2s
Go version go1.25.12
Commit 5967896

History (3 previous)

Commit Updated Status Summary
07adbd1 2026-07-18 23:56 UTC 38.38 MB (+92.0 KB / +0.23%)
d4b16a9 2026-07-18 21:11 UTC 38.36 MB (+92.0 KB / +0.23%)
c62a03d 2026-07-17 17:29 UTC 38.36 MB (+92.0 KB / +0.23%)

🤖 Updated on each push.

Reject timeout values that overflow time.Duration and could disable
socket deadlines.

Cover timeout, cancellation, stale-socket, and daemon error paths.
@corylanou
corylanou marked this pull request as ready for review July 17, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant