vibelawyer
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@vibelawyer Create a case from the PDFs in data/case_001 and run the full review."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
vibelawyer —— 通用化刑事案件阅卷 MCP
本地 FastMCP 阅卷工具箱。给定卷宗 PDF 目录,由 任意 Coding Agent(Cursor / Kimi Code / OpenCode / Codex / Claude Desktop 等)调用工具,产出:
阅卷笔录(Word
.docx)—— 七部分结构 + 案件基本信息 + 阅卷结论(结构化数据完整渲染,无截断)阅卷目录(Excel
.xlsx)—— 分卷总览 / 阅卷目录 / 案件信息 / 证据索引
不依赖 Claude Code CLI。 LLM 推理由宿主 Agent 提供;PDF 解析、OCR、Word/Excel 生成均在本机完成,卷宗不经过本服务上传。
事实与证据须标注来源卷宗及页码(如 见《主卷》P55-76),并可机器校验,落实「禁止幻觉、结论可回溯」。
对任意刑事案件通用,不假定具体罪名或当事人。本仓库不收录真实卷宗;运行时将 PDF 放入本地
data/(已 gitignore),产物写入output/(已 gitignore)。
两种用法(可穿插)
同一 case_id 下,完整流程与零散按需共用全部工具,工作区状态共享。
模式 | 何时用 | 怎么做 |
完整阅卷 | 「把这案件按标准流程阅完」 |
|
按需调用 | 「只查某页 / 只补一条供述 / 只出 Word」 |
|
可先按 playbook 走完大半,再零散补登;也可先散读若干页,再按 playbook 补齐缺步。服务端不强制锁步;顺序约束写在 Skill / playbook 里,由宿主 Agent 遵守。
Related MCP server: file-analysis
架构
┌──────── 宿主 Coding Agent(Cursor / Kimi / OpenCode / Codex …)────────┐
│ 读 skills/vibelawyer-review/SKILL.md;完整流程或按需调 MCP 工具 │
└───────────────────────────────┬───────────────────────────────────────┘
│ stdio / http
▼
┌──────── vibelawyer-mcp(FastMCP)─────────────────────────────────────┐
│ create_case / 读卷 / record_* / validate / write_outputs / download │
│ CaseWorkspace(case_id 隔离)+ 本机 PDF/OCR │
└───────────────────────────────┬───────────────────────────────────────┘
▼
docling → pypdfium2 → tesseract chi_sim
→ 阅卷笔录.docx + 阅卷目录.xlsx组件 | 作用 |
原子工具(本地 | |
FastMCP 对外暴露;passthrough 复用 handler | |
标准步骤与铁律;与 Skill / | |
宿主可加载的阅卷 Skill | |
多案件 |
start_review 只下发 playbook,不启动后台 LLM job。
可选遗留:pip install 'vibelawyer[legacy-agent]' + python -m vibelawyer.run --legacy(需本机 Claude Code CLI,非默认路径)。
安装
pip install vibelawyer
# 开发安装
pip install -e .Python ≥ 3.11
无需 Claude Code CLI
可选(推荐):本地 docling venv(
~/.local/share/docling-venv)提升扫描件 OCR可选:
tesseract+chi_sim作为 OCR 回退
接入宿主 Agent(推荐)
uvx vibelawyer
# 等价别名:
# uvx --from vibelawyer vibelawyer-mcp
# 已 pip install 时:vibelawyer 或 vibelawyer-mcpCursor / 通用 mcp.json
{
"mcpServers": {
"vibelawyer": {
"command": "uvx",
"args": ["vibelawyer"]
}
}
}Claude Desktop(claude_desktop_config.json)
{
"mcpServers": {
"vibelawyer": {
"command": "uvx",
"args": ["vibelawyer"]
}
}
}Kimi Code / OpenCode / Codex
在各自 MCP 配置中填入同一 command / args。已安装包时可将 command 改为 vibelawyer(或别名 vibelawyer-mcp)、args 留空。本地 CLI 指引用 vibelawyer-cli。
配置完成后,让 Agent 阅读并遵循:
skills/vibelawyer-review/SKILL.md
(或调用 start_review 获取与 Skill 同源的结构化 playbook。)
典型流程
A. 完整阅卷
create_case(case_dir="/绝对路径/到卷宗目录")→case_id
(可选defendant_hint/charge_hint/output_dir)start_review(case_id)→ 拿到 steps / 铁律 / 调用约定按步:编目录 → 起诉书/当事人 → 被告供述 → 同案 → 证人 → 程序性文书 → 书证/流水 → 结论
每步用get_case_status或get_workspace_summary核实登记计数(勿信口头「已完成」)validate_citations→write_outputs→download_output(fmt="docx"|"xlsx")
B. 按需单次调用
create_case(...)
list_volumes / search_volumes / read_pages / get_volume_outline # 只读
record_* / add_* # 补登记
write_outputs / download_output # 仅导出CLI 辅助
python -m vibelawyer.run # 打印 MCP 接入指引
python -m vibelawyer.run --print-playbook # 打印完整 playbook(Markdown)
# 诊断 / 渲染冒烟(不调用 LLM)
python scripts/diag.py
python scripts/smoke_render.pyHTTP(可选)
VIBELAWYER_MCP_TRANSPORT=http VIBELAWYER_MCP_PORT=8000 vibelawyer
# 或别名:vibelawyer-mcp
# 可选鉴权:VIBELAWYER_MCP_TOKEN=<secret>工具一览(约 25 个)
Passthrough 读/写/校验工具签名:tool_name(case_id, args={...})。
生命周期与工作流
工具 | 作用 |
| 发现 PDF、建会话,返回 |
| 会话列表与各部分登记计数 |
| 下发 playbook(宿主执行;无后台 job) |
| 说明无后台 job,并再次附上 playbook |
| 取回 |
读卷
工具 | 作用 |
| 卷宗名 / 文件 / 页数 |
| 逐页概览(定位文书边界) |
| 页码区间文本(含本地 OCR) |
| 跨卷关键词检索 |
| 渲染页面图像(视觉) |
登记(强制带来源卷宗名 + 页码)
工具 | 笔录部分 |
| 案件基本信息 |
| 一、当事人(仅本案被告人) |
| 二、起诉书 / 指控事实 |
| 三~五、供述与证言(宜含 |
| 六、程序性文书(含文号) |
| 七、书证与资金流水 |
| 阅卷目录条目 |
| 结论与资金勾稽 |
校验与导出
工具 | 作用 |
| 各部分登记进度 |
| 校验引用页码合法性 |
| 生成 Word 笔录 + Excel 目录 |
标准阅卷步骤(playbook)
与 playbook.py / Skill 一致:
编制阅卷目录 —
add_catalog_entry,定位起诉书页起诉书与当事人 —
set_case_basic/record_party/record_indictment/add_charged_fact被告人供述 —
record_statement(role=defendant),含逐字full_text同案人供述 — 无则跳过;有则
role=codefendant证人证言 —
role=witness程序性文书 —
record_procedural_doc(尽量含文号)书证与流水 —
record_documentary_evidence+ 流水类add_transaction阅卷结论 —
record_conclusions/record_funds_summary(不做正式辩护策略)校验导出 —
validate_citations→write_outputs→download_output
铁律(摘要)
只能依据
read_pages实际读到的内容登记,严禁编造每条记录必须带来源卷宗名与页码
交付物 = 工具调用,不是口头报告
先
get_volume_outline再精读;用search_volumes防遗漏每步结束用
get_workspace_summary/get_case_status核实计数
阅卷笔录结构
当事人基本情况(职务犯罪含任职情况)
起诉书、起诉意见书内容
被告人的供述和辩解
同案人员的供述和辩解
证人证言
程序性文书
书证
附:阅卷目录、阅卷结论(核心事实 / 证据链条 / 矛盾点 / 待核查疑点)。
在新案件上使用
新建本地目录,放入卷宗 PDF(文件名即卷宗名;会清理
(2)等后缀)宿主 Agent:
create_case(case_dir="<绝对路径>")完整流程走 Skill,或按需调工具后
write_outputs
无需改代码即可用于受贿、贪污、诈骗、非法吸收公众存款等;职务犯罪会提取任职情况。
约束与边界
仅本地工具面:解析 / OCR / 生成在本机;不把卷宗上传到 vibelawyer 服务(宿主模型调用由其厂商负责)
可回溯:事实须带来源页码;
validate_citations防幻觉页码范围:只做阅卷目录与笔录梳理,不生成正式辩护策略或出庭意见
仓库不含案卷:
data/、output/、tessdata/已 gitignore,勿提交真实卷宗或当事人信息
目录结构
vibelawyer/
tool_spec.py 本地 @tool / ToolSpec
tools.py 原子工具 handler
playbook.py 宿主步骤与铁律(与 Skill 同源)
mcp_server.py FastMCP Server
sessions.py case_id 会话
workspace.py CaseWorkspace + 引用校验
pdf_volume.py docling / pypdfium2 / tesseract
config.py 案件发现与配置
orchestrator.py 可选 legacy(Claude Code)
agents.py 分步提示别名
run.py CLI 指引 / --print-playbook / --legacy
generators/ docx + xlsx
skills/vibelawyer-review/SKILL.md
scripts/diag.py
scripts/smoke_render.pyLicense
MIT
Available Tools
25 toolsadd_catalog_entryB
登记阅卷目录(卷宗目录)一条:卷宗名称、页码、所含文件、笔录时间等。
参数结构(args 字段): {volume_name(必填): 卷宗名称; file_name(必填): 本卷所含文件名称; page_range(必填); doc_type(必填); record_time(必填); note(必填)}
Inputs: case_id (required), args. Returns: object
add_charged_factA
登记起诉书指控的单笔事实(第三/四部分的整理依据)。
参数结构(args 字段): {index(必填): 第几笔事实(从1开始); description(必填): 该笔事实概述:时间/地点/人物/行为/金额; volume(必填): 来源卷宗; page_start(必填): 来源起始页; page_end(必填): 来源结束页; amount(必填); time_period(必填)}
Inputs: case_id (required), args. Returns: object
add_transactionA
为已登记的书证逐笔登记资金流水(转账记录/回款/返利/工资提成等)。银行流水类书证必须逐笔登记,不得只写汇总——逐笔流水是金额勾稽与辩护核账的基础。
参数结构(args 字段): {evidence_name(必填): 所属书证名称(须与 record_documentary_evidence 登记的 name 完全一致); date(必填): 交易日期; payer(必填): 付款方; payee(必填): 收款方; amount(必填): 金额(保留原文表述,如 人民币45万元); account(必填); note(必填); page(必填)}
Inputs: case_id (required), args. Returns: object
create_caseA
创建案件会话:发现 case_dir 下卷宗 PDF,登记页数。返回 case_id 与卷宗清单. 随后可 start_review 获取宿主执行 playbook,或直接调用读卷/登记工具。
Inputs: case_dir (required), output_dir, charge_hint, defendant_hint, +1 more. Returns: object
download_outputB
下载已生成的阅卷笔录(docx)或阅卷目录(xlsx);若文件未生成则按当前工作区即时渲染兜底. fmt: 'docx' | 'xlsx'.
Inputs: case_id (required), fmt.
get_case_statusB
查询案件会话当前状态(含工作区登记计数).
Inputs: case_id (required). Returns: object
get_page_imageA
将指定页渲染为图片返回(用于扫描件无文本层时的视觉识别)。模型应直接‘看图’提取文字与结构信息,再通过对应 record_* 工具登记。
参数结构(args 字段): {volume(必填): 卷宗名称; page(必填): 页码(1-based)}
Inputs: case_id (required), args. Returns: object
get_review_progressA
查询阅卷进度:无后台 job;请结合 get_case_status 的 section_counts 判断宿主执行进度.
Inputs: case_id (required). Returns: object
get_volume_outlineA
获取某卷的逐页概览(每页字数 + 首行内容),用于在大卷中快速定位文书边界,再决定 read_pages 精读哪些页。
参数结构(args 字段): {volume(必填): 卷宗名称; max_pages(必填)}
Inputs: case_id (required), args. Returns: object
get_workspace_summaryC
查看当前阅卷工作区进度:各部分已登记记录数与案件基本信息。
参数结构(args 字段): {}
Inputs: case_id (required), args. Returns: object
list_casesA
列出全部案件会话及状态.
Inputs: no named parameters. Returns: object
list_volumesC
列出本案全部卷宗:卷宗名称、文件名、总页数。阅卷第一步应先调用此工具掌握卷宗全貌。
参数结构(args 字段): {}
Inputs: case_id (required), args. Returns: object
read_pagesA
读取指定卷宗的某一页码区间文本,每页标注页码。扫描件/乱码页会自动经本地中文OCR提取文字,故大多数页面可直接拿到可读文本。仅当某页仍提示 needs_ocr(OCR失败/空白页)时,才需改用 get_page_image 视觉识别(若环境支持视觉)或如实标注内容无法识别。所有引用须以 见《卷名》P起-止 的格式回溯到此处读取的页码。
参数结构(args 字段): {volume(必填): 卷宗名称(见 list_volumes 的名称,如:刑事侦查案卷); start_page(必填): 起始页码(1-based,含); end_page(必填): 结束页码(1-based,含)}
Inputs: case_id (required), args. Returns: object
record_conclusionsB
登记阅卷结论:核心事实、证据链条、矛盾点、待核查疑点。供后续辩护意见参考。
参数结构(args 字段): {core_facts(必填); evidence_chain(必填); contradictions(必填); doubts(必填)}
Inputs: case_id (required), args. Returns: object
record_documentary_evidenceA
登记书证(第七部分,客观证据)。须列明时间、文件名称、卷宗页码、主要内容,并按待证事实分组(fact_group);含转账/流水内容的书证登记后再用 add_transaction 逐笔登记资金流水。
参数结构(args 字段): {name(必填): 文件名称; volume(必填): 卷宗; page_start(必填): 起始页; page_end(必填): 结束页; doc_no(必填); time(必填); source(必填); fact_group(必填); content_summary(必填)}
Inputs: case_id (required), args. Returns: object
record_funds_summaryA
登记资金勾稽摘要(辩护关键数字):报案合计/合同合计/指控金额/已返还/违法所得/已退赔。由结论员在综合全部书证与笔录后计算登记;各口径不一致时必须在 note 中说明差异。
参数结构(args 字段): {reported_amount(必填); contract_amount(必填); charged_amount(必填); returned_amount(必填); illegal_income(必填); restitution(必填); note(必填)}
Inputs: case_id (required), args. Returns: object
record_indictmentA
登记起诉书/起诉意见书内容(第二部分)。full_text_summary 应原样复制涉及被告人的指控事实。
参数结构(args 字段): {doc_type(必填): 文书类型:起诉书 / 起诉意见书; volume(必填): 来源卷宗; page_start(必填): 来源起始页; page_end(必填): 来源结束页; defendant(必填); charge(必填); total_amount(必填); issuer(必填); issue_date(必填); legal_basis(必填); sentencing_circumstances(必填); full_text_summary(必填)}
Inputs: case_id (required), args. Returns: object
record_partyA
登记当事人基本情况(第一部分)。职务犯罪须填 position 与 appointment_history。
参数结构(args 字段): {name(必填): 姓名; volume(必填): 来源卷宗; page_start(必填): 来源起始页; page_end(必填): 来源结束页; gender(必填); ethnicity(必填); birth(必填); native_place(必填); id_no(必填); education(必填); occupation(必填); position(必填); appointment_history(必填); address(必填)}
Inputs: case_id (required), args. Returns: object
record_procedural_docA
登记程序性文书(第六部分)。包含从被调查至当前的全部程序性文书,需含文号、时间、地点。
参数结构(args 字段): {doc_type(必填): 文书类型:立案决定书/拘留/逮捕/取保候审/监视居住/搜查/扣押/鉴定意见/移送起诉等; volume(必填): 卷宗; page_start(必填): 起始页; page_end(必填): 结束页; doc_no(必填); time(必填); location(必填); fact_group(必填); content_summary(必填)}
Inputs: case_id (required), args. Returns: object
record_statementA
登记供述/辩解或证言。role=defendant(被告人)/codefendant(同案人)/witness(证人)。须提取笔录时间、办案人员、办案地点、是否同步录音录像、笔录内容;full_text 必须逐字转录全部问答(辩护引用原话是刚需,仅登记摘要视为未完成)。
参数结构(args 字段): {person(必填): 供述/证言人姓名; role(必填): defendant / codefendant / witness 之一; volume(必填): 卷宗; page_start(必填): 起始页; page_end(必填): 结束页; record_time(必填); investigators(必填); location(必填); has_av_recording(必填); occasion(必填); charged_fact_ref(必填); content_summary(必填); full_text(必填)}
Inputs: case_id (required), args. Returns: object
search_volumesB
在卷宗中检索关键词,返回命中卷宗/页码与上下文片段。用于快速定位某事实、某人的所有出现位置。
参数结构(args 字段): {query(必填): 检索关键词(如人名、金额、罪名、日期); volume(必填)}
Inputs: case_id (required), args. Returns: object
set_case_basicC
登记案件基本信息表:主体、涉嫌罪名、涉案金额、卷宗数量。
参数结构(args 字段): {case_name(必填); defendant(必填); charge(必填); total_amount(必填); volume_count(必填)}
Inputs: case_id (required), args. Returns: object
start_reviewA
下发标准阅卷 playbook,由宿主 Agent 按 steps 顺序调用 MCP 工具完成阅卷.
不再启动后台 Claude/LLM job(不依赖 Claude Code CLI)。 model / effort / max_turns 由宿主自行决定,本参数仅保留兼容、写入提示。 进度请用 get_case_status / get_workspace_summary 查看登记计数。
Inputs: case_id (required), model, effort, max_turns. Returns: object
validate_citationsB
校验所有已登记记录的来源引用是否落在真实卷宗页码区间内,返回不合规项。阅卷结束前必跑。
参数结构(args 字段): {}
Inputs: case_id (required), args. Returns: object
write_outputsC
生成阅卷笔录(Word)与阅卷目录(Excel)(含案件信息表与结论),返回文件路径。
参数结构(args 字段): {fmt(必填)}
Inputs: case_id (required), args. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 25 tools
Most tools are clearly separated by document type, but get_case_status, get_workspace_summary, and get_review_progress all report overlapping progress/count information, creating real ambiguity. get_page_image and read_pages are well-distinguished, so the confusion is limited mainly to the status/progress cluster.
Naming is predominantly verb_noun snake_case, e.g. list_volumes, record_party, validate_citations. Minor inconsistencies exist: set_case_basic vs. the record_* family, add_* vs. record_*, and a somewhat mixed use of list_/get_ for retrieval.
25 tools is at the heavy end and includes at least three near-redundant status/progress tools. The many record_* tools are defensible because they map to distinct evidence and document categories, but the set would feel tighter with the status cluster consolidated.
The toolset covers the full review workflow: locating and reading volumes, registering parties/evidence/statements/transactions, validating citations, and exporting outputs. The main gaps are the absence of update/delete tools for correcting mis-registered records and no way to retrieve individual registered records, but these are workable gaps rather than blocking ones.
Maintenance
Related MCP Connectors
Search, read and cite litigation case files, with the rights you hold in each matter.
PDF, photo, email, and file comparison evidence checks with plain-language reports.
Contract review that keeps your contracts: cited answers, Word redlines, key-date alerts.
Evidence boards for investigations: add files, link them, keep a chronology, review with citations.
Related MCP Servers
- AlicenseBqualityAmaintenanceLocal-first MCP server that transforms civil case PDFs into queryable cases with structural provenance, evidence IDs, and page-level verification for drafting and factual review.22Apache 2.0
- FlicenseAqualityDmaintenanceEnables local analysis of unstructured documents (PDF, DOCX, PPTX, SVG, PNG) by extracting text and structure with citation anchors, and verifies summaries against source material before a human approves saving a report.9-
- AlicenseAqualityCmaintenanceEnables coding agents to maintain durable, private, local memory by storing and linking records across collections, with structured review, search, and audit history.23MIT
- AlicenseNot gradedqualityCmaintenanceEnables local, on-device legal document analysis including clause extraction, risk flagging, compliance checking, and clause-level version comparison without sending documents externally.51 npm1MIT