
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 分