Scan Mcp

io.github.jacksenechal由 GitHub 帳號 jacksenechal 發布v0.3.0更新於 Oct 24, 2026

MCP server for scanner discovery and batch capture via SANE

發布方自己的服務:scan.mx Email Diagnostics

已驗證STDIO僅桌面效率與工作流檔案與儲存

概覽

AI 產生的概覽

本機 MCP 伺服器,讓助理探索 SANE 掃描器並執行批次掃描工作,在本機組裝多頁 TIFF 文件。

可以做什麼
  • 探索已連接的掃描器並讀取裝置的 SANE 選項
  • 啟動掃描工作,可設定解析度、色彩模式、進紙來源、雙面、紙張尺寸與文件拆分策略
  • 檢視、列出與取消工作,並讀取工作的 manifest 與事件日誌
  • 將頁面與文件 TIFF 產物寫入指定的收件目錄,可選擇裁切載片紙
適用情境
適合在裝有 SANE 相容掃描器的 Linux 機器上,讓助理驅動文件擷取:自動進紙器批次掃描、雙面工作、多頁組裝,以及事後檢視工作狀態與產物。
執行需求
透過 npx 以 stdio 在本機執行,需要 Node 22 以上。需要 Linux 與 SANE 的 scanimage,以及用於多頁組裝和載片紙裁切的 tiffcp 與 ImageMagick convert。選用環境變數包括 INBOX_DIR、SCANIMAGE_BIN、TIFFCP_BIN、IM_CONVERT_BIN、SCAN_MOCK、後端偏好清單,以及選用 HTTP 傳輸用的 MCP_HTTP_PORT 與 MCP_HTTP_HOST。
安裝前請注意
選用的 HTTP 傳輸沒有身分驗證;把 MCP_HTTP_HOST 放寬到預設回送位址之外,會把掃描器控制暴露到網路。掃描工作會寫入 INBOX_DIR 並可能產生裁切衍生檔案,請指向可接受寫入的目錄。它會操作實體硬體,工作可能占用掃描器直到完成或被取消。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Scan Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[scan-mcp logo]

scan-mcp

[CI] [npm version] [node-current] [npm downloads]

Minimal MCP server for scanner capture (ADF/duplex/page-size), batching, and multipage assembly.

Features

  • Small, typed MCP server exposing tools for device discovery and scan jobs
  • zod-validated inputs; the JSON Schemas in schemas/ document the contract and are contract-tested
  • Smart device selection (prefers ADF/duplex, avoids camera backends), robust defaults
  • Local-first transports: stdio by default to keep everything on-device, optional HTTP for your own network deployments

Note: This package targets Node 22 and Linux SANE backends (scanimage).

Quick Start (local stdio, default)

Add a server entry to your MCP client configuration:

{  "mcpServers": {    "scan": {      "command": "npx",      "args": [        "-y",        "scan-mcp"      ],      "env": {        "INBOX_DIR": "~/Documents/scanned_documents/inbox"      }    }  }}
  • This invocation runs over stdio for a privacy-first, single-machine setup.
  • Call start_scan_job without a device_id to auto-select a scanner and begin scanning.
  • Artifacts are written under INBOX_DIR per job: job-*/page_*.tiff, doc_*.tiff, manifest.json, events.jsonl. When crop_carrier_sheets is set and a carrier sheet is detected, a page_*.cropped.tiff derivative is also written per affected page.

Streamable HTTP transport

Prefer to attach the scanner to another machine on your network? scan-mcp also supports the streamable HTTP transport:

bash
scan-mcp --http
  • Default port is 3001; set MCP_HTTP_PORT to override (for example MCP_HTTP_PORT=3333 scan-mcp --http).
  • Binds 127.0.0.1 by default. Set MCP_HTTP_HOST to expose it on other interfaces (for example MCP_HTTP_HOST=:: for all, or a LAN address); the server has no authentication, so only do that on a trusted network.
  • HTTP responses use server-sent events (SSE) for streaming tool output; clients such as Claude Desktop and Windsurf support this transport.
  • There is currently no authentication; widen the bind address only on a trusted internal network.

Install

  • Run with npx: npx scan-mcp (recommended)
    • The CLI runs a quick preflight check for Node 22+ and required scanner/image tools and prints installation hints if anything is missing.
    • See recommended server config above
  • Use npx scan-mcp --http to launch the streamable HTTP transport when running on another machine.
  • CLI help: scan-mcp --help
  • From source (for development):
    • npm install
    • npm run build
  • For Cline setup, and other automated agentic installation, see llms-install.md

System Requirements

  • Linux with SANE utilities: scanimage
  • TIFF tools: tiffcp (multipage assembly) and ImageMagick convert (carrier-sheet detection and cropping); preflight requires both

Environment Variables

  • SCAN_MOCK (default: false): mock SANE calls and generate fake TIFFs for testing.
  • INBOX_DIR (default: scanned_documents/inbox): base directory for job runs and artifacts.
  • SCANIMAGE_BIN (default: scanimage): override the binary path.
  • TIFFCP_BIN / IM_CONVERT_BIN (defaults: tiffcp / convert): multipage assembly and image analysis tools.
  • SCAN_EXCLUDE_BACKENDS (CSV): backends to exclude (e.g., v4l).
  • SCAN_PREFER_BACKENDS (CSV): preferred backends (e.g., epjitsu,epson2).
  • PERSIST_LAST_USED_DEVICE (default: true): persist and lightly prefer last used device.
  • LOG_LEVEL (default: info): pino log level.
  • MCP_HTTP_PORT (default: 3001): TCP port for the HTTP transport.
  • MCP_HTTP_HOST (default: 127.0.0.1): bind address for the HTTP transport.

API

Tools

  • list_devices

    • Discover connected scanners with backend details.
    • Inputs: none.
  • get_device_options

    • Get SANE options for a specific device.
    • Inputs:
      • device_id (string): Target device identifier.
  • start_scan_job

    • Begin a scanning job; omitting device_id triggers auto-selection and default options.
    • Inputs (all optional unless noted):
      • device_id (string)
      • resolution_dpi (integer, 50–1200)
      • color_mode (Color | Gray | Lineart): color_mode defaults to Lineart (document-first); at >= 600dpi it defaults to Color, since high-dpi capture usually means artwork/photos where 1-bit destroys information. Pass color_mode explicitly to override either default; high dpi is the only signal used.
      • source (Flatbed | ADF | ADF Duplex)
      • duplex (boolean)
      • page_size (Letter | A4 | Legal | Custom)
      • custom_size_mm { width, height }
      • doc_break_policy { type (page_count | none), page_count }: split the batch into documents of page_count pages
      • output_format (string, default tiff)
      • tmp_dir (string)
      • crop_carrier_sheets (boolean, default false): detect carrier-sheet leading-edge band and write cropped page derivatives; raw pages are kept
  • get_job_status

    • Inspect job state and artifact counts.
    • Inputs:
      • job_id (string)
  • cancel_job

    • Request job cancellation; best effort during scan loops.
    • Inputs:
      • job_id (string)
  • list_jobs

    • List recent jobs from the inbox directory.
    • Inputs (optional):
      • limit (integer, max 100)
      • state (running | completed | cancelled | error | unknown)
  • get_manifest

    • Fetch a job's manifest.json.
    • Inputs:
      • job_id (string)
  • get_events

    • Retrieve a job's events.jsonl log.
    • Inputs:
      • job_id (string)

See JSON Schemas in schemas/ for input shapes. Runtime validation is zod (src/server/register.ts); the schemas document the contract and tests assert against them.

How Selection and Defaults Work

Defaults aim for 300dpi, reasonable color mode, and ADF/duplex when available. Full details on scoring and fallbacks live in docs:

  • Selection and defaults: docs/SELECTION.md

Project Layout

  • src/mcp.ts — MCP server entry and tool registration
  • src/services/* — hardware interface and job orchestration
  • schemas/ — JSON Schemas documenting the tool contracts (used by tests)
  • docs/ — architecture, conventions, and deep dives

Development

  • npm run dev (stdio MCP server), npm run dev:http (HTTP transport)
  • make verify runs lint, typecheck, and tests
  • Conventions: docs/CONVENTIONS.md and architecture in docs/BLUEPRINT.md

Roadmap

Tracking ideas and future improvements are documented in docs/ROADMAP.md.

來源:README.md,提交 685772b

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

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

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Scan 整合