benbjohnson / benbjohnson/litestream

fix(mcp): report the running instance's version, not a PATH binary (closes #1353)

Open
#1,365 0 comments 0 reactions 1 assignee View on GitHub

@corylanou is already working on this.

Since Jul 16, 2026.

bug
Dominant language
Go
Stars
14.4k
Forks
417
Avg merge
7d 1h
Merged PRs (30d)
21

Description

## Problem

Two distinct "versions" are wrong/conflated in the MCP server today, and #1353 is about the first:

1. **The `litestream_version` tool** execs whatever `litestream` is on `$PATH` (`cmd/litestream/mcp.go:250`). It should report the version of the **Litestream instance the MCP server represents / is connected to** — i.e. the running daemon — not an unrelated binary that happens to be first on `$PATH`. This is #1353.
2. **The MCP server's own handshake identity** is hardcoded `"1.0.0"` (`cmd/litestream/mcp.go:33`), unrelated to the real build.

These must not be conflated:
- *"What Litestream instance am I talking to?"* (version of the daemon being operated on) → **tool result**.
- *"What build is running the MCP server component?"* → **MCP handshake identity**.

They happen to coincide **today** only because the MCP server runs **embedded inside the `replicate` daemon process** (`cmd/litestream/replicate.go:184-189`): the in-process build `Version` (`cmd/litestream/main.go:40`) equals the daemon's version, which the daemon already reports over IPC (`server.go:511` sets `InfoResponse.Version = s.Version`, wired at `replicate.go:306`).

## Fix (current embedded architecture)

- `litestream_version` returns the running instance's version from the same source the daemon reports it — in-process `Version` (== `s.Server.Version` == `/info`'s `InfoResponse.Version`) — with **no exec**.
- Set the MCP server handshake version in `server.NewMCPServer` to the real build `Version` instead of `"1.0.0"`.

## Future (standalone / remote) — cross-ref only, out of scope here

Once the MCP server can run **standalone** (#1370) or against a **remote daemon** (#1367), the MCP process is no longer the daemon and the two versions diverge. In that mode the tool must source the instance version from the **connected daemon over IPC** (`/info` → `InfoResponse.Version`, `server.go:509,538-544`), not from the MCP process's own binary (it may additionally surface the MCP server's own build for diagnostics). Those issues own that mechanism; this issue fixes the embedded case and must not bake in an assumption that blocks it.

## Acceptance

- `litestream_version` reports the running instance's version with no subprocess, matching `litestream version` of the daemon build.
- The MCP handshake advertises the real build version, not `"1.0.0"`.
- Closes #1353.

## Cross-refs

Sole owner of the #1353 version bug. #1367 (in-process refactor) converts the **other** tools and must not touch/reintroduce version reporting; #1367 and #1370 own the remote/standalone "connected-daemon version" behavior described above.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.