
LogCarver
io.github.caiderek由 GitHub 账号 caiderek 发布v0.1.4更新于 Oct 24, 2026
Read-only MCP server that finds deleted SQL Server rows from the transaction log (fn_dblog).
概览
只读 MCP 服务器,通过读取 SQL Server 事务日志,让助手找出最近被删除、更新或插入的行。
- 可以做什么
- 读取 SQL Server 事务日志,查找表中被删除的行,可按时间范围、主键值和行数上限筛选。
- 查看单行的变更历史,包含变更前后的列值。
- 为每个事件返回建议的撤销 SQL 纯文本,但不会执行它。
- 以 JSON 形式返回事件以及计数、截断、警告和说明。
- 适用场景
- 当需要查明 SQL Server 表中刚被删除或修改了哪些行,而事先没有启用审计、CDC 或变更跟踪时适用。适合故障排查和对本地或可访问数据库的快速取证。
- 运行要求
- 以 .NET 工具在本地通过 stdio 运行,需要 .NET 10 SDK 或运行时。需要 SQL Server 连接字符串,通过 LOGCARVER_MCP_CONNECTION_STRING 或由 LOGCARVER_MCP_CONNECTION_STRING_FILE 指定的文件提供;登录账号必须是 sysadmin。可选的 LOGCARVER_MCP_ALLOWED_DATABASES 用于列出额外可读的数据库。
安装
在 SourceWeft 中
- 打开 控制台中的 LogCarver,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
LogCarver.Mcp
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.
Quick start (5 minutes)
-
Install (needs the .NET 10 SDK or runtime):
-
Make a throwaway database. Run
examples/try-it.sqlin SSMS orsqlcmd. It createsMcpTest, inserts 10 orders, deletes 4 and updates 1. -
Keep the password out of the command. Put the connection string in a file that only you can read (the SQL login must be sysadmin):
Save it as, for example,
C:\Users\you\logcarver-mcp.conn(one line, nothing else). Then add the server and point it at the file:The password is never typed on the command line and never appears in the MCP configuration. Do not commit this file anywhere.
-
Ask in a new conversation: "Which rows were deleted from dbo.Orders in McpTest?" You should see Bob, Carol, Dave and Eve (Id 2 to 5). Then try "Show the history of Id=1" (Amount 100.00 to 111.11, Note first to changed) and "Include the undo SQL".
-
Clean up:
DROP DATABASE McpTest;,claude mcp remove logcarver.
If the result is empty, the log space was probably reused (for example after a CHECKPOINT under SIMPLE recovery, or a log backup). See the limits below.
What it does
One tool, find_deleted_rows. It only reads: SELECTs, and DBCC PAGE reads of data pages to rebuild rows whose INSERT has left the log. It never changes data, and the optional undo SQL is plain text that the tool never executes.
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.
Requirements and limits
- The connection's login must be sysadmin (
fn_dblogrequires it). - You only see what is still in the active log. If the log space has been reused the result is empty, and that is not a bug. The paid LogCarverOffline tool can often recover that case by reading the raw
.ldf. TRUNCATEandDROPcannot be recovered.- Compressed tables are refused.
timeandxmlcolumns and off-row LOB values are refused or flaggedneedsManualReview; they are never guessed. - Validated on SQL Server 2025, 2022, 2019 and 2016 (SP2). Other versions return a warning in
notes. - Scanning a large active log can take a minute or more.
Configure
The connection string comes from an environment variable, so credentials never pass through the AI conversation:
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):
Row values come straight from the database. They are data, not instructions, and the tool description tells the model so.
Install
Needs the .NET 10 SDK or runtime.
Or run it without installing, through dnx:
Claude Code
With dnx instead of a global tool, end the command with -- dotnet dnx LogCarver.Mcp --yes.
From source
Tests
The integration tests need a local SQL Server and a sysadmin Windows login. They create and drop their own sandbox database, LogCarver_McpTests.
License
MIT, see LICENSE.
来源:README.md,提交 3523477
工具
0版本历史
4- v0.1.4最新Oct 19, 2026
- v0.1.3Oct 15, 2026
- v0.1.2Oct 14, 2026
- v0.1.1Oct 12, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分