Read-only MCP server that finds deleted SQL Server rows from the transaction log (fn_dblog).
English | 繁體中文
A read-only MCP server that lets an AI assistant answer "what rows were just deleted from this SQL Server table?" by reading the database's transaction log (fn_dblog). No Audit, CDC or Change Tracking needs to be enabled beforehand.
It is a thin wrapper over the decoding engine from LogCarver (MIT). Everything runs on your machine and nothing is sent anywhere.
Status: early (v0.1). On NuGet and in the official MCP registry as
io.github.caiderek/logcarver-mcp.
One tool, find_deleted_rows. It only runs SELECTs. It never changes data, and the optional undo SQL is plain text that the tool never executes.
| Parameter | Meaning |
|---|---|
table (required) | Schema-qualified, e.g. dbo.Orders |
database | Defaults to the database in the connection string. Any other database is refused unless listed in LOGCARVER_MCP_ALLOWED_DATABASES |
operations | delete (default), update, insert, all |
from, to | ISO 8601 time window, server-local time, no zone conversion |
key | Column=Value, return one row's history only. Column name is case-insensitive; dates, bit, decimals and hex binary match as you would write them |
maxRows | Default 20, max 500, 0 = counts only. The most recent events are kept |
includeUndoSql | Also return suggested SQL that would reverse each event |
The result is JSON: a summary (counts, truncation, warnings and notes) and events (kind, timestamp, LSN, transaction id, before/after column values, note). Binary values are hex strings and decimals are strings, so nothing is silently rounded.
fn_dblog requires it)..ldf.TRUNCATE and DROP cannot be recovered.time and xml columns and off-row LOB values are refused or flagged needsManualReview; they are never guessed.notes.The connection string comes from an environment variable, so credentials never pass through the AI conversation:
LOGCARVER_MCP_CONNECTION_STRING=Server=localhost;Database=MyDb;Integrated Security=true;TrustServerCertificate=true
Or point LOGCARVER_MCP_CONNECTION_STRING_FILE at a file that contains it.
The login is sysadmin and the caller is an AI, so the tool may only read the connection string's database. To let it read others, list them (comma or semicolon separated):
LOGCARVER_MCP_ALLOWED_DATABASES=Sales;HR
Row values come straight from the database. They are data, not instructions, and the tool description tells the model so.
Needs the .NET 10 SDK or runtime.
dotnet tool install -g LogCarver.Mcp
Or run it without installing, through dnx:
dotnet dnx LogCarver.Mcp --yes
claude mcp add logcarver --env LOGCARVER_MCP_CONNECTION_STRING="Server=localhost;Database=MyDb;Integrated Security=true;TrustServerCertificate=true" -- logcarver-mcp
With dnx instead of a global tool, end the command with -- dotnet dnx LogCarver.Mcp --yes.
git clone --recurse-submodules https://github.com/caiderek/LogCarver.Mcp
dotnet build
dotnet run --project src/LogCarver.Mcp
dotnet test tests/LogCarver.Mcp.Tests
dotnet test tests/LogCarver.Mcp.IntegrationTests
The integration tests need a local SQL Server and a sysadmin Windows login. They create and drop their own sandbox database, LogCarver_McpTests.
MIT, see LICENSE.
This listing does not have a supported local package template. Use the maintainer’s documentation for its hosted endpoint, authentication, and client-specific setup. No install command has been inferred.
LogCarver.McpotherLogCarver works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.