Minimal MCP server for scanner capture (ADF/duplex/page-size), batching, and multipage assembly.
- Small, typed MCP server exposing tools for device discovery and scan jobs
- JSON Schema–validated inputs with deterministic, typed outputs
- Smart device selection (prefers ADF/duplex, avoids camera backends), robust defaults
Note: This package targets Node 22 and Linux SANE backends (scanimage
).
Quick Start (MCP client config)
Add a server entry to your MCP client configuration:
{
"mcpServers": {
"scan": {
"command": "npx",
"args": ["scan-mcp"],
"env": {
"INBOX_DIR": "~/Documents/scanned_documents/inbox"
}
}
}
}
- Call
start_scan_job
without adevice_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
.
Install
- Run with npx:
npx scan-mcp
- CLI help:
scan-mcp --help
- Install npm:
npm i -g scan-mcp
thenscan-mcp
- From source (development):
npm install
npm run build
- MCP clients can run via
node dist/mcp.js
ornpx tsx src/mcp.ts
System Requirements
- Linux with SANE utilities:
scanimage
(and optionallyscanadf
) - TIFF tools:
tiffcp
(preferred) or ImageMagickconvert
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
/SCANADF_BIN
(defaults:scanimage
/scanadf
): override binary paths.TIFFCP_BIN
/IM_CONVERT_BIN
(defaults:tiffcp
/convert
): multipage assembly 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.
Tools
list_devices
: Discover connected scanners with backend details.get_device_options
: Probe options for a givendevice_id
.start_scan_job
: Start a job (auto-selects device if omitted). Creates per-page TIFFs, assembles documents.get_job_status
: Inspect job state and artifact paths.cancel_job
: Request job cancellation (best-effort during scan loops).
See JSON Schemas in schemas/
for shapes of inputs/outputs. Tests assert against these contracts.
How Selection and Defaults Work
Defaults aim for 300dpi, reasonable color mode, and ADF/duplex when available.