Sign Cli

io.github.DrBaher由 GitHub 账号 DrBaher 发布v0.9.0更新于 Oct 24, 2026

Agent-first e-signature MCP server with offline PAdES signing and hash-chained audit.

已验证STDIO仅桌面效率与工作流安全与监控

概览

AI 生成的概览

面向电子签名流程的本地 MCP 服务器:创建、发送、审批、签署和验证 PDF,支持离线 PAdES 签名与哈希链审计。

可以做什么
创建和管理签名请求,支持多文档、多签署人、CSV 批量发送和供应商模板,发送具备幂等性,并在签署前校验哈希、标题和签署人邮箱。以签署人身份使用一次性、有时限的令牌审批、签署或填写理由拒绝,并可获取文档、查看已有签名后再会签。使用自签发证书离线签署 PDF,自动检测签名字段、盖章并封装,一次调用完成 DOCX 到已封装 PDF 的转换。检查并验证任意来源的已签名 PDF,重算摘要、校验 PKCS#7 签名并给出信任标签。查看并验证哈希链审计记录,用 RFC 3161 时间戳锚定并导出归档包。
适用场景
适合让助手端到端推进合同或 NDA 的签署流程,而实际签署动作仍由人完成;也适合需要完全离线、可验证签名 PDF 且不依赖第三方供应商的场景。此外可用于审计和验证已签署的 PDF。
运行要求
以本地进程运行,通过 npm 包 @drbaher/sign-cli(Node.js)或独立二进制安装,仅支持桌面端。离线本地供应商无需注册或 API 密钥。托管供应商(Dropbox Sign、DocuSign、SignWell)需要各自的凭据,可在命名配置中通过环境变量引用。可选 HTTP API 使用 --auth-token 或 SIGN_HTTP_AUTH_TOKEN 提供的 Bearer 令牌。
安装前请注意
签署、发送、审批、拒绝和批量发送都会改变状态,并可能触达真实收件人;开发期间应保持测试模式,或用 --read-only true 阻止变更类工具。审批令牌为一次性,应交给人类签署人而非代理。托管供应商会把文档和签署人数据发送给第三方。切勿提交 .env 文件或 API 密钥,在聊天或日志中泄露的密钥应轮换。未配置认证令牌时,MCP HTTP 传输会拒绝 show_secrets。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Sign Cli,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[sign-cli]

sign-cli

Fully-offline e-signature CLI. The built-in PAdES signer (PKCS#7 in /ByteRange, self-issued cert) produces real, cryptographically verifiable signed PDFs with no signup and no third-party provider — or routes through Dropbox Sign / DocuSign / SignWell when you need an external trust anchor. Per-signer approval tokens (TTL-bounded, scoped to one email), hash-chained audit events, RFC 3161 timestamping, named profiles, a 19-tool MCP server, and a 20-route HTTP API.

The asymmetry is the architecture: an agent can drive every step except the actual signing gesture, which stays gated behind a human.

Part of the contract-ops CLI suite — optional. sign-cli works entirely on its own; it's also the signing + audit step of the contract-ops suite: template-vault-cli → draft-cli → nda-review-cli → docx2pdf-cli → sign-cli, with drift detection via compare-cli.

Run this

bash
npx @drbaher/sign-cli demo

That single command runs the entire lifecycle — create (consent + email-verification gates on) → send → watch the gates block signing → verify email → capture consent → approve → sign → verify chain → export receipt — against the offline local provider, then deletes everything. No signup. No keys. ~5 seconds.

Live demo → — read-only, resets every 4 hours. Self-host: see deploy/README.md.

Where to go next

If you are…Start here
A new user evaluating the toolThis README's Quick start, then Standard user journey
An operator wiring up a hosted providerdocs/setup/ — Dropbox / DocuSign / SignWell / embedded
An LLM agent driving the CLIAGENTS.md → docs/agent-guide.md → docs/recipes/
An auditor verifying a signed bundledocs/reference/audit-chain.md, docs/reference/legal.md
A contributordocs/reference/architecture.md, docs/regression-testing.md
Adding a new CLI to the suiteThe build-a-CLI playbook — the conventions every suite CLI follows

Concept deep-dives live in docs/reference/; task-oriented recipes in docs/recipes/.

Quick start

bash
# Installnpm i -g @drbaher/sign-cli
# Or run without installingnpx @drbaher/sign-cli demo
# After install, the binary is named `sign`sign --versionsign demosign init        # wizard: provider selection + .envsign doctor preflight   # structured per-check readiness report

Or download a standalone binary from Releases — ./sign-linux-x64 demo. See DISTRIBUTION.md for every install path.

What this gives you

  • Offline PAdES signing with a self-issued cert — real PKCS#7 signed PDFs, no signup, no API keys.
  • Three hosted providers when you need them: Dropbox Sign, DocuSign, SignWell. Same surface across all four.
  • Per-signer approval tokens (single-use, TTL-bounded, tied to one email). Tokens go to the human, not the agent.
  • Consent + attribution evidence, opt-in per request: --require-consent gates signing on a recorded intent-to-sign attestation + electronic-records consent (versioned canonical texts, hashed into the audit chain); --require-email-verification gates it on a mailbox-control code; signer record-identity logs how identity was checked out-of-band. No KYC data is collected — by design. See docs/reference/consent-and-identity.md.
  • Hash-chained audit chain with append-only DB triggers + RFC 3161 anchors. See docs/reference/audit-chain.md.
  • Idempotent request send — refuses to double-send unless --force true; pair with --idempotency-key for safe retries.
  • Multi-document + multi-signer requests; CSV-driven bulk send.
  • Templates from each provider's dashboard via request from-template.
  • Auto-detect signature field (sign pdf detect-signature-field + sign sign --auto-place). Detects AcroForm /Sig widgets and anchor text in English + French/EU conventions.
  • Inspect any signed PDF with sign pdf inspect — parses PAdES PKCS#7 from sign-cli or any other producer (Adobe, DocuSign, Dropbox Sign, SignWell). Returns signer CN/email, cert subject + issuer, validity window, fingerprint, trust label (self_signed_local / self_signed_other / ca_signed / unknown), and message-digest match.
  • Counter-sign visibility — signer fetch-document and the MCP signer_fetch_document tool surface existingSignatures, so a signer can see what they're countersigning before they sign.
  • One-shot DOCX → sealed PDF via sign document (chains the bundled docx2pdf-cli, auto-place, stamp, PAdES-seal, verify in one call against a scoped temp DB).
  • Sandbox via --read-only true on both mcp serve and serve. Mutating tools/routes return FORBIDDEN_READ_ONLY.
  • Path-traversal guards on every input and output path. See docs/reference/security-controls.md.
  • Named profiles bundle provider + dbPath + credentials (with {{env:VAR}} references for shell-managed secrets). See docs/reference/profiles.md.
  • PDF verification end-to-end offline: request verify-signed-pdf recomputes the digest, extracts X.509 signer certs, supports --recipient <email> for a redacted single-signer view, and reports per-signer trust labels.

Standard user journey

bash
sign request create \  --title "Mutual NDA" \  --document ./nda.pdf \  --signer name:Alice,email:[email protected],order:1 \  --signer name:Bob,email:[email protected],order:2 \  --provider signwell
sign approve --request-id <id> --token <token1>sign approve --request-id <id> --token <token2>
sign request send --request-id <id> --provider signwell --test-mode true
sign request watch \  --request-id <id> --provider signwell \  --interval-seconds 5 --fetch-final true \  --out ./signed.pdf
sign audit show --request-id <id>

Or fully offline:

bash
sign request create --title "Mutual NDA" --document ./nda.pdf \  --signer name:Alice,email:[email protected],order:1 \  --signer name:Bob,email:[email protected],order:2 \  --provider local --auto-approve truesign request send --request-id <id> --provider local# Each signer runs:sign sign --request-id <id> --token <their-token> \  --require-hash <sha256> --require-title "^Mutual NDA$"

For full provider-specific setup, see docs/setup/.

One-shot DOCX → sealed PDF

bash
sign document contract.docx \  --signer "Alice Founder" --signer-email "[email protected]" \  --name-signature "Alice Founder" --auto-place first \  --out contract.sealed.pdf

sign document chains: convert (via the bundled docx2pdf-cli) → detect signature field → stamp → PAdES-seal → verify chain. All intermediate state lives in a scoped temp DB.

MCP server (for LLM agents)

bash
sign mcp serve                  # stdio MCP serversign mcp serve --read-only true # sandboxed: mutating tools return FORBIDDEN_READ_ONLYsign mcp tools                  # print the catalog (live; don't hardcode the list)

19 tools, split read-only vs mutating. Backed by the same SignCliError envelopes you'd see at the CLI. The full discovery contract, wire-up snippets (Claude Desktop, Cursor), and read-only walkthrough are in AGENTS.md. Three resource shapes (request://<id> snapshot, .../document PDF blob, .../audit chain) and four agent-as-signer prompt templates (review_and_sign, policy_check, inbox_triage, verify_receipt) are also exposed.

HTTP API (for non-MCP clients)

bash
sign serve --port 4000 --auth-token <t> --read-only true --rate-limit 5curl http://127.0.0.1:4000/v1/openapi.json    # discover the route catalog

Twenty routes under /v1/*, 1:1 parity with the MCP tool surface — same input shape, same path-traversal guards, same read-only gating. Bearer auth via --auth-token or SIGN_HTTP_AUTH_TOKEN. Responses are { ok, result } on success or the standard error envelope on failure.

Signer-side flow (agent-friendly)

For --provider local, an agent can act as a signer end-to-end without an email link. Set SIGN_LOCAL_AUTOCOMPLETE=false so the local provider holds at sent until each signer explicitly runs sign sign.

bash
# As the requester (agent or human)sign request create --title "Mutual NDA" --document ./nda.pdf \  --signer name:Alice,email:[email protected],order:1 \  --signer name:Bob,email:[email protected],order:2 \  --provider local --auto-approve true# response includes per-signer tokenssign request send --request-id <id> --provider local
# As the signer, with their tokensign signer list --signer-email [email protected]sign signer fetch-document --request-id <id> --token alice-tok-... --out ./nda.pdf# fetch-document surfaces `existingSignatures` so the signer can see what they're countersigningsign sign --request-id <id> --token alice-tok-... \  --require-hash <sha256> --require-title "^Mutual NDA$" --require-signer-email [email protected]# orsign signer decline --request-id <id> --token alice-tok-... --reason "Terms changed"

Multi-signer: status only flips to completed when every signer is in signedBy[]. Pre-sign safety checks (--require-hash / --require-title / --require-signer-email) throw PRE_SIGN_*_MISMATCH before any state mutation.

Templates

Reuse a template defined in the provider dashboard (no PDF upload):

bash
sign request from-template \  --template-id tmpl_abc --provider dropbox \  --signer role:Buyer,name:Alice,email:[email protected],order:1 \  --signer role:Seller,name:Bob,email:[email protected],order:2 \  --prefill name:purchase_price,value:1000 \  --auto-approve true
sign request send --request-id <id> --provider dropbox --test-mode true

Each --signer must include role:<roleName> matching a template role. --prefill name:K,value:V[,signer:N] populates template fields. Per-provider behavior: DocuSign uses per-signer text tabs; Dropbox uses custom_fields; SignWell uses placeholders.

Field placement

By default the hosted providers auto-append a generic signature page. For real contracts, pass --field (repeatable) on request create:

bash
sign request create \  --title "NDA" --document ./contract.pdf \  --signer name:Alice,email:[email protected],order:1 \  --field signer:1,page:1,x:100,y:200,type:signature \  --field signer:1,page:1,x:100,y:240,type:date

Spec: signer:<order> (required), doc:<i> (multi-doc index), type:signature|initials|date|text|name|email, page:<n> x:<pt> y:<pt> (coordinate), or DocuSign-only anchor:"text" with optional x-offset / y-offset / anchor-units. The fields persist on the request and forward to the provider at send time.

Auto-detect signature field

For --provider local, sign sign --auto-place calls the detector and uses the top candidate iff there's a unique high-confidence (≥0.8) match.

bash
# Inspect candidates firstsign pdf detect-signature-field --pdf ./contract.pdf
# Auto-place (errors loudly on ambiguity)sign sign --request-id <id> --token <t> --name-signature "Alice" \  --auto-place first   # or true | last | all | page:N | index:N

Adjustment strategies in priority order: underline-snap (0.95), below-anchor-probe (0.85, French/EU conventions), whitespace-probe (0.75), shrink-to-fit (0.50). Date anchors are detected separately via sign pdf detect-date-field. Full reference in docs/agent-guide.md §6.4a.

Bulk send

bash
sign request bulk \  --csv ./signers.csv \  --document ./contract.pdf --provider dropbox \  --title "Q2 NDA for {{email}}" --test-mode true

Each row becomes its own request with autoApprove: true. Title template supports {{email}}, {{name}}, {{row}}. Exit code 3 if any row failed; JSON output lists per-row results.

Trust beyond the provider

bash
# Inspect any signed PDF (ours, Adobe's, DocuSign's, …) — no DB lookup requiredsign pdf inspect --pdf ./signed.pdf
# Inspect the embedded PKCS#7 of a request we sentsign request verify-signed-pdf --request-id <id>sign request verify-signed-pdf --request-id <id> --recipient [email protected]   # single-signer view
# Anchor the audit head against a public RFC 3161 TSAsign audit anchor --request-id <id>
# Bundle for archivalsign audit export --request-id <id> --out ./bundle/

audit verify walks the local hash chain. request verify-signed-pdf recomputes the SHA-256 over the /ByteRange, compares it to the messageDigest in the embedded PKCS#7, and verifies the PKCS#7 signature value against the signer certificate's public key (RSA/ECDSA) — so a forged or tampered signature fails, exit 3, not just a modified-after-signing one. sign pdf inspect works on any signed PDF (no request id required). audit anchor issues a TimeStamp token from a TSA. See docs/reference/audit-chain.md for the full model.

Profiles

bash
sign profile init --name prod --provider signwell --db "~/.sign-cli/prod.db" --strict-provider truesign profile set --name prod --key credentials.SIGNWELL_API_KEY --value "{{env:SIGNWELL_API_KEY}}"sign --profile prod request show --request-id <id># Or implicitly via a project-level sign-profile.json (git/npm-style upward discovery)

Resolution order: flag > env > project profile > user profile > built-in default. Credentials redacted by default in profile show (--show-secrets true to reveal). Over the MCP HTTP transport, show_secrets is refused unless an --http-auth-token is configured (it stays available on stdio MCP and the CLI). See docs/reference/profiles.md.

Doctor

bash
sign doctor                       # legacy env-report; always exits 0sign doctor preflight             # structured per-check report; exit 0 ok, 1 failedsign doctor providers             # capability matrix across all providerssign doctor account-check --provider signwell   # provider /me check

preflight runs env-health checks (runtime:node_version, storage:db_path) on every provider, then provider-scoped checks layer on top. Branch on checks[].name for agent self-recovery.

Security notes

License

MIT. See LICENSE.

See also

  • AGENTS.md — the agent quickstart (output contract, exit codes, discovery, failure recovery).
  • docs/agent-guide.md — canonical agent reference (per-command schemas, side effects, idempotency).
  • docs/setup/ — provider setup (Dropbox, DocuSign, SignWell, embedded).
  • docs/recipes/ — task-oriented recipes (preflight, agent-loop-mcp, weekly anchor, auditor handoff, sign as Alice, EU NDA).
  • docs/reference/ — concept deep-dives (audit chain, exit codes, profiles, security model, architecture, legal posture, comparison).
  • TROUBLESHOOTING.md — error catalog.
  • CHANGELOG.md — what landed and when.
  • integrations/ — Claude Desktop config, langchain starter.
  • deploy/ — Fly / Render / Railway configs for the hosted demo.

来源:README.md,提交 df6fe27

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.9.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分